/**
 * 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 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;
  }

}

@@ -1,140 +1,4 @@
-/**%0D%0A * Entity representing the PDC record structure in storage.%0D%0A * TODO apply TDA (tell don't ask) principle to getter methods.%0D%0A */%0D%0A
 pack
@@ -228,16 +228,87 @@
 .Id;%0D%0A%0D%0A
+/**%0D%0A * Entity representing the PDC record structure in storage.%0D%0A */%0D%0A
 public c
@@ -458,25 +458,27 @@
 ing institut
-e
+ion
 ;%0D%0A  private
@@ -727,133 +727,8 @@
  *%0D%0A
-   * TODO move the SimpleDateFormat initialization elsewhere%0D%0A   * TODO set the time zone through the properties file%0D%0A   *%0D%0A
    *
@@ -1071,17 +1071,19 @@
 institut
-e
+ion
  = insti
@@ -1334,44 +1334,8 @@
 %0D%0A%0D%0A
-%0D%0A  /**%0D%0A   *%0D%0A   * @return%0D%0A   */%0D%0A
   pu
@@ -1392,42 +1392,8 @@
 %0D%0A%0D%0A
-  /**%0D%0A   *%0D%0A   * @return%0D%0A   */%0D%0A
   pu
@@ -1462,42 +1462,8 @@
 %0D%0A%0D%0A
-  /**%0D%0A   *%0D%0A   * @return%0D%0A   */%0D%0A
   pu
@@ -1507,25 +1507,27 @@
 urn institut
-e
+ion
 ;%0D%0A  %7D%0D%0A%0D%0A  
@@ -1528,42 +1528,8 @@
 %0D%0A%0D%0A
-  /**%0D%0A   *%0D%0A   * @return%0D%0A   */%0D%0A
   pu
@@ -1598,42 +1598,8 @@
 %0D%0A%0D%0A
-  /**%0D%0A   *%0D%0A   * @return%0D%0A   */%0D%0A
   pu
@@ -1670,42 +1670,8 @@
 %0D%0A%0D%0A
-  /**%0D%0A   *%0D%0A   * @return%0D%0A   */%0D%0A
   pu

make changes based on Denis Review