diff --git a/orcid-core/src/main/java/org/orcid/pojo/ajaxForm/Date.java b/orcid-core/src/main/java/org/orcid/pojo/ajaxForm/Date.java index abe25f83d29..a9c4f1d4964 100644 --- a/orcid-core/src/main/java/org/orcid/pojo/ajaxForm/Date.java +++ b/orcid-core/src/main/java/org/orcid/pojo/ajaxForm/Date.java @@ -22,6 +22,7 @@ public class Date implements ErrorsInterface, Required, Serializable, Comparable private String month; private String day; private String year; + private Long timestamp; private boolean required = true; private String getRequiredMessage; @@ -171,6 +172,10 @@ public void setYear(String year) { this.year = year; } + public Long getTimestamp() { return timestamp; } + + public void setTimestamp(Long timestamp) { this.timestamp = timestamp; } + @Override public int hashCode() { final int prime = 31; diff --git a/orcid-core/src/main/java/org/orcid/pojo/ajaxForm/Email.java b/orcid-core/src/main/java/org/orcid/pojo/ajaxForm/Email.java index a54750d6053..7b65d9f3190 100644 --- a/orcid-core/src/main/java/org/orcid/pojo/ajaxForm/Email.java +++ b/orcid-core/src/main/java/org/orcid/pojo/ajaxForm/Email.java @@ -1,5 +1,6 @@ package org.orcid.pojo.ajaxForm; +import java.sql.Timestamp; import java.util.ArrayList; import java.util.List; @@ -43,22 +44,6 @@ public static Email valueOf(org.orcid.jaxb.model.v3.release.record.Email e) { email.setVerified(e.isVerified()); email.setVisibility(e.getVisibility()); - if (e.getCreatedDate() != null) { - Date createdDate = new Date(); - createdDate.setYear(String.valueOf(e.getCreatedDate().getValue().getYear())); - createdDate.setMonth(String.valueOf(e.getCreatedDate().getValue().getMonth())); - createdDate.setDay(String.valueOf(e.getCreatedDate().getValue().getDay())); - email.setCreatedDate(createdDate); - } - - if (e.getLastModifiedDate() != null) { - Date lastModifiedDate = new Date(); - lastModifiedDate.setYear(String.valueOf(e.getLastModifiedDate().getValue().getYear())); - lastModifiedDate.setMonth(String.valueOf(e.getLastModifiedDate().getValue().getMonth())); - lastModifiedDate.setDay(String.valueOf(e.getLastModifiedDate().getValue().getDay())); - email.setLastModified(lastModifiedDate); - } - if (e.getSource().getSourceName() != null) { email.setSourceName(e.getSource().getSourceName().getContent()); } @@ -80,6 +65,7 @@ public static Email valueOf(org.orcid.jaxb.model.v3.release.record.Email e) { createdDate.setYear(String.valueOf(e.getCreatedDate().getValue().getYear())); createdDate.setMonth(String.valueOf(e.getCreatedDate().getValue().getMonth())); createdDate.setDay(String.valueOf(e.getCreatedDate().getValue().getDay())); + createdDate.setTimestamp(e.getCreatedDate().getValue().toGregorianCalendar().getTimeInMillis()); email.setCreatedDate(createdDate); }