Skip to content

Commit

Permalink
replace verification date cutoff with new flag (#7154)
Browse files Browse the repository at this point in the history
* replace verification date cutoff with new flag

* tweak unit test

---------

Co-authored-by: Angel Montenegro <[email protected]>
  • Loading branch information
auumgn and amontenegro authored Dec 17, 2024
1 parent 7c9c86e commit 2c38123
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;

import static org.orcid.core.constants.EmailConstants.VERIFICATION_DATE_CUTOFF;

public class SummaryManagerImpl implements SummaryManager {
@Resource(name = "recordNameManagerReadOnlyV3")
Expand Down Expand Up @@ -284,7 +283,7 @@ public RecordSummaryPojo getRecordSummaryPojo(String orcid) {
for (EmailDomain ed : recordSummary.getEmailDomains().getEmailDomains()) {
EmailDomainSummary eds = new EmailDomainSummary();
eds.setValue(ed.getValue());
if (ed.getVerificationDate() != null && ed.getVerificationDate().after(VERIFICATION_DATE_CUTOFF)) {
if (ed.getVerificationDate() != null) {
eds.setVerificationDate(ed.getVerificationDate().toString());
}
emailDomains.add(eds);
Expand Down Expand Up @@ -525,8 +524,8 @@ public void generateEmailDomainsSummary(RecordSummary recordSummary, String orci
for (ProfileEmailDomainEntity ped : emailDomains) {
ed = new EmailDomain();
ed.setValue(ped.getEmailDomain());
VerificationDate verificationDate = new VerificationDate(DateUtils.convertToXMLGregorianCalendar(ped.getDateCreated()));
if (verificationDate.after(VERIFICATION_DATE_CUTOFF)) {
if (!ped.getGeneratedByScript()) {
VerificationDate verificationDate = new VerificationDate(DateUtils.convertToXMLGregorianCalendar(ped.getDateCreated()));
ed.setVerificationDate(verificationDate);
}
edList.add(ed);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ public class EmailConstants {

public static final String DO_NOT_REPLY_VERIFY_ORCID_ORG = "ORCID - Do not reply <[email protected]>";

public static final VerificationDate VERIFICATION_DATE_CUTOFF;

static {
XMLGregorianCalendar gregorianCutoffDate = null;
VerificationDate verificationDate = null;
Expand All @@ -46,6 +44,5 @@ public class EmailConstants {
throw new RuntimeException("Error initializing XMLGregorianCalendar", e);
}

VERIFICATION_DATE_CUTOFF = verificationDate;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ public void getSummaryTest() {

// Email domains
assertEquals("2024-12-20", rs.getEmailDomains().getEmailDomains().get(0).getVerificationDate().toString());
assertEquals(null, rs.getEmailDomains().getEmailDomains().get(1).getVerificationDate());
assertNull(rs.getEmailDomains().getEmailDomains().get(1).getVerificationDate());
assertEquals(2, rs.getEmailDomains().getEmailDomains().size());
}

Expand Down Expand Up @@ -624,12 +624,14 @@ private List<ProfileEmailDomainEntity> getEmailDomains() {
emailDomain.setEmailDomain(EMAIL_DOMAIN);
emailDomain.setOrcid(ORCID);
emailDomain.setDateCreated(new Date(124, 11, 20));
emailDomain.setGeneratedByScript(false);
emailDomains.add(emailDomain);

ProfileEmailDomainEntity emailDomain2 = new ProfileEmailDomainEntity();
emailDomain2.setEmailDomain(EMAIL_DOMAIN + "2");
emailDomain2.setOrcid(ORCID);
emailDomain2.setDateCreated(new Date(124, 9, 20));
emailDomain2.setGeneratedByScript(true);
emailDomains.add(emailDomain2);

return emailDomains;
Expand Down

0 comments on commit 2c38123

Please sign in to comment.