Skip to content

Commit

Permalink
add timestamp to date pojo (#7057)
Browse files Browse the repository at this point in the history
* add timestamp to date pojo

* remove duplicated and unused code
  • Loading branch information
auumgn authored Jul 24, 2024
1 parent 94fa8bc commit e53fe24
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
5 changes: 5 additions & 0 deletions orcid-core/src/main/java/org/orcid/pojo/ajaxForm/Date.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
18 changes: 2 additions & 16 deletions orcid-core/src/main/java/org/orcid/pojo/ajaxForm/Email.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.orcid.pojo.ajaxForm;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;

Expand Down Expand Up @@ -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());
}
Expand All @@ -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);
}

Expand Down

0 comments on commit e53fe24

Please sign in to comment.