Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace verification date cutoff with new flag #7154

Merged
merged 4 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading