/**
 * Entity representing the PDC record structure in storage.
 * TODO apply TDA (tell don't ask) principle to getter methods.
 */
package de.ddb.pdc.storage;

import de.ddb.pdc.core.AnsweredQuestion;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.TimeZone;
import org.springframework.data.annotation.Id;

public class StorageModel {

  @Id
  private String id;

  private final String itemId;
  private final String itemCategory;
  private final String institute;
  private final boolean publicDomain;
  private final List<AnsweredQuestion> trace;
  private final String timestamp;

  /**
   * Constructor for the repository.
   * @param itemId
   * @param itemCategory
   * @param institute
   * @param publicDomain
   * @param trace
   * @param timestamp as a String, in U
   */
  public StorageModel(String itemId, String itemCategory, String institute,
      boolean publicDomain, List<AnsweredQuestion> trace, String timestamp) {

    this.itemId = itemId;
    this.itemCategory = itemCategory;
    this.institute = institute;
    this.publicDomain = publicDomain;
    this.trace = trace;
    this.timestamp = timestamp;
  }

  /**
   * Constructor for storing new records.
   * The timestamp is automatically assigned to the current date and time.
   * 
   * TODO move the SimpleDateFormat initialization elsewhere
   * TODO set the time zone through the properties file
   * 
   * @param itemId
   * @param itemCategory
   * @param institute
   * @param publicDomain
   * @param trace
   */
  public StorageModel(String itemId, String itemCategory, String institute,
          boolean publicDomain, List<AnsweredQuestion> trace) {

    this.itemId = itemId;
    this.itemCategory = itemCategory;
    this.institute = institute;
    this.publicDomain = publicDomain;
    this.trace = trace;
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
    this.timestamp = sdf.format(new Date());
  }
  
  
  /**
   * 
   * @return 
   */
  public String getItemId() {
    return itemId;
  }

  /**
   * 
   * @return 
   */
  public String getItemCategory() {
    return itemCategory;
  }

  /**
   * 
   * @return 
   */
  public String getInstitute() {
    return institute;
  }

  /**
   * 
   * @return 
   */
  public boolean isPublicDomain() {
    return publicDomain;
  }

  /**
   * 
   * @return 
   */
  public List<AnsweredQuestion> getTrace() {
    return trace;
  }

  /**
   * 
   * @return 
   */
  public String getTimestampAsString() {
    return timestamp;
  }

}

@@ -658,576 +658,8 @@
 %0D%0A%0D%0A
-  /**%0D%0A   * Constructor for the repository.%0D%0A   * @param itemId%0D%0A   * @param itemCategory%0D%0A   * @param institute%0D%0A   * @param publicDomain%0D%0A   * @param trace%0D%0A   * @param timestamp as a String, in U%0D%0A   */%0D%0A  public StorageModel(String itemId, String itemCategory, String institute,%0D%0A      boolean publicDomain, List%3CAnsweredQuestion%3E trace, String timestamp) %7B%0D%0A%0D%0A    this.itemId = itemId;%0D%0A    this.itemCategory = itemCategory;%0D%0A    this.institute = institute;%0D%0A    this.publicDomain = publicDomain;%0D%0A    this.trace = trace;%0D%0A    this.timestamp = timestamp;%0D%0A  %7D%0D%0A%0D%0A
   /*
@@ -780,25 +780,24 @@
  time.%0D%0A   *
- 
 %0D%0A   * TODO 
@@ -905,25 +905,24 @@
 s file%0D%0A   *
- 
 %0D%0A   * @para
@@ -1514,22 +1514,18 @@
 ;%0D%0A  %7D%0D%0A
-  %0D%0A  
+%0D%0A
 %0D%0A  /**%0D
@@ -1521,33 +1521,32 @@
 %0A%0D%0A%0D%0A  /**%0D%0A   *
- 
 %0D%0A   * @return %0D
@@ -1535,33 +1535,32 @@
  *%0D%0A   * @return
- 
 %0D%0A   */%0D%0A  publi
@@ -1613,33 +1613,32 @@
 %7D%0D%0A%0D%0A  /**%0D%0A   *
- 
 %0D%0A   * @return %0D
@@ -1627,33 +1627,32 @@
  *%0D%0A   * @return
- 
 %0D%0A   */%0D%0A  publi
@@ -1717,33 +1717,32 @@
 %7D%0D%0A%0D%0A  /**%0D%0A   *
- 
 %0D%0A   * @return %0D
@@ -1731,33 +1731,32 @@
  *%0D%0A   * @return
- 
 %0D%0A   */%0D%0A  publi
@@ -1815,33 +1815,32 @@
 %7D%0D%0A%0D%0A  /**%0D%0A   *
- 
 %0D%0A   * @return %0D
@@ -1829,33 +1829,32 @@
  *%0D%0A   * @return
- 
 %0D%0A   */%0D%0A  publi
@@ -1919,33 +1919,32 @@
 %7D%0D%0A%0D%0A  /**%0D%0A   *
- 
 %0D%0A   * @return %0D
@@ -1933,33 +1933,32 @@
  *%0D%0A   * @return
- 
 %0D%0A   */%0D%0A  publi
@@ -2033,17 +2033,16 @@
 **%0D%0A   *
- 
 %0D%0A   * @
@@ -2047,17 +2047,16 @@
  @return
- 
 %0D%0A   */%0D

Delete second constructor (not needed any more)