Skip to content

Commit

Permalink
Merge branch 'main' into api_limiting_http_request_filter
Browse files Browse the repository at this point in the history
  • Loading branch information
Camelia-Orcid authored Oct 28, 2024
2 parents 1ce5761 + aa2c36a commit a9453c3
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## v2.66.5 - 2024-10-15

[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.66.4...v2.66.5)

## v2.66.4 - 2024-10-11

[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.66.3...v2.66.4)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,7 @@ public MapperFacade getEmailMapperFacade() {
emailClassMap.field("primary", "primary");
emailClassMap.field("verified", "verified");
emailClassMap.fieldMap("visibility", "visibility").converter("visibilityConverter").add();
emailClassMap.field("verificationDate.value", "dateVerified");
addV3DateFields(emailClassMap);
registerSourceConverters(mapperFactory, emailClassMap);
emailClassMap.register();
Expand Down
18 changes: 18 additions & 0 deletions orcid-core/src/main/java/org/orcid/pojo/ajaxForm/Email.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ public class Email implements ErrorsInterface {

private Date lastModified;

private Date verificationDate;

private List<String> errors = new ArrayList<String>();

public static Email valueOf(org.orcid.jaxb.model.v3.release.record.Email e) {
Expand Down Expand Up @@ -76,6 +78,14 @@ public static Email valueOf(org.orcid.jaxb.model.v3.release.record.Email e) {
lastModifiedDate.setDay(String.valueOf(e.getLastModifiedDate().getValue().getDay()));
email.setLastModified(lastModifiedDate);
}

if (e.getVerificationDate() != null) {
Date verificationDate = new Date();
verificationDate.setYear(String.valueOf(e.getVerificationDate().getValue().getYear()));
verificationDate.setMonth(String.valueOf(e.getVerificationDate().getValue().getMonth()));
verificationDate.setDay(String.valueOf(e.getVerificationDate().getValue().getDay()));
email.setVerificationDate(verificationDate);
}
}
return email;
}
Expand Down Expand Up @@ -187,6 +197,14 @@ public void setLastModified(Date lastModified) {
this.lastModified = lastModified;
}

public Date getVerificationDate() {
return verificationDate;
}

public void setVerificationDate(Date verificationDate) {
this.verificationDate = verificationDate;
}

public List<String> getErrors() {
return errors;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static Emails valueOf(org.orcid.jaxb.model.v3.release.record.Emails e, Li

public org.orcid.jaxb.model.v3.release.record.Emails toV3Emails() {
org.orcid.jaxb.model.v3.release.record.Emails v3Emails = new org.orcid.jaxb.model.v3.release.record.Emails();
if(emails != null && !emails.isEmpty()) {
if (emails != null && !emails.isEmpty()) {
for(Email email : emails) {
v3Emails.getEmails().add(email.toV3Email());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static ProfileEmailDomain valueOf(ProfileEmailDomainEntity ed) {
Date createdDate = new Date();
LocalDate date = ed.getDateCreated().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
createdDate.setYear(String.valueOf(date.getYear()));
createdDate.setMonth(String.valueOf(date.getMonth()));
createdDate.setMonth(String.valueOf(date.getMonthValue()));
createdDate.setDay(String.valueOf(date.getDayOfMonth()));
createdDate.setTimestamp(ed.getDateCreated().toInstant().toEpochMilli());
emailDomain.setCreatedDate(createdDate);
Expand All @@ -36,10 +36,11 @@ public static ProfileEmailDomain valueOf(ProfileEmailDomainEntity ed) {
Date lastModifiedDate = new Date();
LocalDate date = ed.getLastModified().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
lastModifiedDate.setYear(String.valueOf(date.getYear()));
lastModifiedDate.setMonth(String.valueOf(date.getMonth()));
lastModifiedDate.setMonth(String.valueOf(date.getMonthValue()));
lastModifiedDate.setDay(String.valueOf(date.getDayOfMonth()));
emailDomain.setLastModified(lastModifiedDate);
}

}
return emailDomain;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public void testEmailToEmailEntity() throws JAXBException {
assertNotNull(entity);
assertNull(entity.getDateCreated());
assertNull(entity.getLastModified());
assertNull(entity.getDateVerified());
assertEquals("[email protected]", entity.getEmail());
assertEquals(org.orcid.jaxb.model.common_v2.Visibility.PUBLIC.name(), entity.getVisibility());

Expand All @@ -119,6 +120,8 @@ public void testEmailEntityToEmail() throws IllegalAccessException {
assertEquals(DateUtils.convertToDate("2015-06-05T10:15:20"), DateUtils.convertToDate(email.getCreatedDate().getValue()));
assertNotNull(email.getLastModifiedDate());
assertEquals(DateUtils.convertToDate("2015-06-05T10:15:20"), DateUtils.convertToDate(email.getLastModifiedDate().getValue()));
assertNotNull(email.getVerificationDate());
assertEquals(DateUtils.convertToDate("2015-06-05T10:15:20"), DateUtils.convertToDate(email.getVerificationDate().getValue()));
assertEquals("[email protected]", email.getEmail());
assertEquals(Visibility.PRIVATE, email.getVisibility());

Expand Down Expand Up @@ -159,6 +162,7 @@ private EmailEntity getEmailEntity() throws IllegalAccessException {
Date date = DateUtils.convertToDate("2015-06-05T10:15:20");
EmailEntity result = new EmailEntity();
DateFieldsOnBaseEntityUtils.setDateFields(result, date);
result.setDateVerified(date);
result.setEmail("[email protected]");
result.setCurrent(true);
result.setPrimary(true);
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,7 @@ the software.
<dependency>
<groupId>org.orcid</groupId>
<artifactId>orcid-model</artifactId>
<version>3.3.1</version>
<version>3.3.2</version>
</dependency>
<dependency>
<groupId>org.orcid</groupId>
Expand Down

0 comments on commit a9453c3

Please sign in to comment.