Skip to content

Commit

Permalink
merged main
Browse files Browse the repository at this point in the history
  • Loading branch information
George Nash authored and George Nash committed Oct 18, 2024
2 parents cdb018b + aa2c36a commit 3553397
Show file tree
Hide file tree
Showing 29 changed files with 399 additions and 85 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/maven_test_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ jobs:
uses: dorny/test-reporter@e9fa2f582c0ebbe2e263fd18fad744d52e0b0203
if: always()
with:
name: "${{ inputs.project }}: Unit tests results"
name: "maven_test_publish_${{ inputs.project }}"
path: ${{ inputs.project }}/target/surefire-reports/*.xml
reporter: java-junit
fail-on-error: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/maven_test_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- uses: dorny/test-reporter@e9fa2f582c0ebbe2e263fd18fad744d52e0b0203
with:
artifact: ${{ inputs.project }}
name: "${{ inputs.project }} Unit Tests" # Name of the check run which will be created
name: "maven_test_report_${{ inputs.project }}" # Name of the check run which will be created
path: '*.xml' # Path to test results (inside artifact .zip)
reporter: java-junit # Format of test results

40 changes: 40 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,43 @@
## 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)

## v2.66.3 - 2024-10-11

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

## v2.66.2 - 2024-10-10

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

## v2.66.1 - 2024-10-09

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

## v2.66.0 - 2024-10-09

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

### Feature

- map check names to their workflow files to allow for searching

## v2.65.6 - 2024-10-02

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

- [#7093](https://github.com/ORCID/ORCID-Source/pull/7093): Revert "Added the code to store deleted items in panoply dw_deleted_items table"
- [#7091](https://github.com/ORCID/ORCID-Source/pull/7091): Added the code to store deleted items in panoply dw_deleted_items table
- [#7090](https://github.com/ORCID/ORCID-Source/pull/7090): Removed all created date, last modified from email domain summary

## v2.65.5 - 2024-09-23

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

## v2.65.4 - 2024-09-19

[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.65.3...v2.65.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
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,11 @@
import org.orcid.pojo.summary.ExternalIdentifiersSummary;
import org.orcid.pojo.summary.RecordSummaryPojo;
import org.orcid.utils.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;

public class SummaryManagerImpl implements SummaryManager {

@Resource(name = "recordNameManagerReadOnlyV3")
private RecordNameManagerReadOnly recordNameManagerReadOnly;

Expand Down Expand Up @@ -285,8 +286,7 @@ public RecordSummaryPojo getRecordSummaryPojo(String orcid) {
for (EmailDomain ed : recordSummary.getEmailDomains().getEmailDomains()) {
EmailDomainSummary eds = new EmailDomainSummary();
eds.setValue(ed.getValue());
eds.setCreatedDate(ed.getCreatedDate().toFuzzyDate().toString());
eds.setLastModified(ed.getLastModified().toFuzzyDate().toString());
emailDomains.add(eds);
}
}
pojo.setEmailDomains(emailDomains);
Expand Down Expand Up @@ -520,31 +520,27 @@ public void generateEmailDomainsSummary(RecordSummary recordSummary, String orci
emailDomains = profileEmailDomainManagerReadOnly.getPublicEmailDomains(orcid);
List<EmailDomain> edList = new ArrayList<EmailDomain>();
if (emailDomains != null && !emailDomains.isEmpty()) {

EmailDomain ed = null;
for (ProfileEmailDomainEntity ped : emailDomains) {
ed = new EmailDomain();
ed.setValue(ped.getEmailDomain());
ed.setCreatedDate(Date.valueOf(ped.getDateCreated()));
ed.setLastModified(Date.valueOf(ped.getLastModified()));
edList.add(ed);
}
}

List<EmailDomain> emailDomainsTop3 = new ArrayList<EmailDomain>();
edList.stream().limit(3).forEach(t -> {
EmailDomain ed = new EmailDomain();
ed.setValue(t.getValue());
ed.setCreatedDate(t.getCreatedDate());
ed.setLastModified(t.getLastModified());
emailDomainsTop3.add(ed);
});

EmailDomains eds = new EmailDomains();
eds.setCount(edList.size());
if (!emailDomainsTop3.isEmpty()) {
eds.setEmailDomains(emailDomainsTop3);

}

recordSummary.setEmailDomains(eds);
}
}
Expand Down
32 changes: 7 additions & 25 deletions orcid-core/src/main/java/org/orcid/core/model/EmailDomain.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;

import org.orcid.jaxb.model.v3.release.common.FuzzyDate;
Expand All @@ -14,16 +15,12 @@
import io.swagger.v3.oas.annotations.media.Schema;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(propOrder = { "value","createdDate", "lastModified"})
@XmlRootElement(name = "education-qualification", namespace = "http://www.orcid.org/ns/summary")
@Schema(description = "Education Qualification")
@XmlType(propOrder = { "value"})
@XmlRootElement(name = "email-domain", namespace = "http://www.orcid.org/ns/summary")
@Schema(description = "Email Domain")
public class EmailDomain {
@XmlElement(name = "value", namespace = "http://www.orcid.org/ns/summary")
protected String value;
@XmlElement(name = "created-date", namespace = "http://www.orcid.org/ns/common")
protected Date createdDate;
@XmlElement(name = "last-modified-date", namespace = "http://www.orcid.org/ns/common")
protected Date lastModified;

public String getValue() {
return value;
Expand All @@ -32,26 +29,11 @@ public String getValue() {
public void setValue(String value) {
this.value = value;
}

public Date getCreatedDate() {
return createdDate;
}

public void setCreatedDate(Date createdDate) {
this.createdDate = createdDate;
}

public Date getLastModified() {
return lastModified;
}

public void setLastModified(Date lastModified) {
this.lastModified = lastModified;
}


@Override
public int hashCode() {
return Objects.hash(value, createdDate, lastModified);
return Objects.hash(value);
}

@Override
Expand All @@ -63,6 +45,6 @@ public boolean equals(Object obj) {
if (getClass() != obj.getClass())
return false;
EmailDomain other = (EmailDomain) obj;
return Objects.equals(createdDate, other.createdDate) && Objects.equals(lastModified, other.lastModified) && Objects.equals(value, other.value);
return Objects.equals(value, other.value);
}
}
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 @@ -5,8 +5,6 @@

public class EmailDomainSummary {
private String value;
private String createdDate;
private String lastModified;

public String getValue() {
return value;
Expand All @@ -16,22 +14,6 @@ public void setValue(String value) {
this.value = value;
}

public String getCreatedDate() {
return createdDate;
}

public void setCreatedDate(String createdDate) {
this.createdDate = createdDate;
}

public String getLastModified() {
return lastModified;
}

public void setLastModified(String lastModified) {
this.lastModified = lastModified;
}


public static EmailDomainSummary valueOf(ProfileEmailDomainEntity pem) {
EmailDomainSummary form = new EmailDomainSummary();
Expand All @@ -40,14 +22,6 @@ public static EmailDomainSummary valueOf(ProfileEmailDomainEntity pem) {
if(!PojoUtil.isEmpty(pem.getEmailDomain())) {
form.setValue(pem.getEmailDomain());
}

if (pem.getDateCreated() != null) {
form.setCreatedDate(org.orcid.pojo.ajaxForm.Date.valueOf(pem.getDateCreated()).toFuzzyDate().toString());
}

if (pem.getLastModified() !=null) {
form.setLastModified(org.orcid.pojo.ajaxForm.Date.valueOf(pem.getLastModified()).toFuzzyDate().toString());
}
}
return form;
}
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
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private RecordSummary getRecordSummary() {
EmailDomains emailDomains = new EmailDomains();
emailDomains.setCount(4);
emailDomains.setEmailDomains(new ArrayList<EmailDomain>());
emailDomains.getEmailDomains().add(getEmailDomain("sometrusted.org", getEmailDomainCreatedDate(), getEmailDomainLastModified()));
emailDomains.getEmailDomains().add(getEmailDomain("sometrusted.org"));
record.setEmailDomains(emailDomains);

//Set education/qualifications
Expand Down Expand Up @@ -163,7 +163,7 @@ private EducationQualification getEducationQualification(int putCode, String rol
return eq;
}

private EmailDomain getEmailDomain(String domainValue, Date created, Date modified) {
private EmailDomain getEmailDomain(String domainValue) {
EmailDomain emailDomain = new EmailDomain();
emailDomain.setValue(domainValue);
//emailDomain.setCreatedDate(created);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public void addSourceToEmail(String sourceId, String email) {
@Transactional
@UpdateProfileLastModified
public boolean verifyEmail(String email) {
Query query = entityManager.createNativeQuery("update email set is_verified = true, is_current=true, last_modified=now() where trim(lower(email)) = trim(lower(:email))");
Query query = entityManager.createNativeQuery("update email set is_verified = true, is_current=true, last_modified=now(), date_verified=now() where trim(lower(email)) = trim(lower(:email))");
query.setParameter("email", email);
return query.executeUpdate() > 0;
}
Expand Down
Loading

0 comments on commit 3553397

Please sign in to comment.