From 06d7026131720bebf28e883cdf030be6442830c0 Mon Sep 17 00:00:00 2001 From: andrej romanov <50377758+auumgn@users.noreply.github.com> Date: Sat, 10 Aug 2024 18:43:47 +0300 Subject: [PATCH 01/21] Add email domains (#7063) * fix typos * add db table * add togglz * add email domain logic * improve new domain logic * add another toggle * improve readability, add transactions, cleanup * remove todo * add indexes to profile email domain table * fix new domain visibility bug --- .../common/manager/EmailDomainManager.java | 2 +- .../manager/impl/EmailDomainManagerImpl.java | 6 +- .../impl/PeerReviewManagerReadOnlyImpl.java | 2 +- .../manager/v3/ProfileEmailDomainManager.java | 16 + .../manager/v3/impl/EmailManagerImpl.java | 26 +- .../impl/ProfileEmailDomainManagerImpl.java | 78 +++ .../ProfileEmailDomainManagerReadOnly.java | 16 + ...ProfileEmailDomainManagerReadOnlyImpl.java | 32 + .../java/org/orcid/core/togglz/Features.java | 8 +- .../java/org/orcid/pojo/ajaxForm/Emails.java | 16 +- .../pojo/ajaxForm/ProfileEmailDomain.java | 79 +++ .../src/main/resources/orcid-core-context.xml | 16 +- .../manager/EmailDomainManagerTest.java | 22 +- .../orcid/persistence/dao/EmailDomainDao.java | 2 +- .../dao/ProfileEmailDomainDao.java | 19 + .../dao/impl/EmailDomainDaoImpl.java | 2 +- .../dao/impl/ProfileEmailDomainDaoImpl.java | 89 +++ .../entities/ProfileEmailDomainEntity.java | 73 ++ .../main/resources/META-INF/persistence.xml | 1 + .../src/main/resources/db-master.xml | 641 +++++++++--------- .../create_profile_email_domain_table.xml | 64 ++ .../resources/orcid-persistence-context.xml | 10 +- .../loader/cli/EmailDomainLoader.java | 2 +- .../controllers/EmailDomainController.java | 4 +- .../controllers/ManageProfileController.java | 55 +- .../controllers/PublicRecordController.java | 19 +- 26 files changed, 925 insertions(+), 375 deletions(-) create mode 100644 orcid-core/src/main/java/org/orcid/core/manager/v3/ProfileEmailDomainManager.java create mode 100644 orcid-core/src/main/java/org/orcid/core/manager/v3/impl/ProfileEmailDomainManagerImpl.java create mode 100644 orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/ProfileEmailDomainManagerReadOnly.java create mode 100644 orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/impl/ProfileEmailDomainManagerReadOnlyImpl.java create mode 100644 orcid-core/src/main/java/org/orcid/pojo/ajaxForm/ProfileEmailDomain.java create mode 100644 orcid-persistence/src/main/java/org/orcid/persistence/dao/ProfileEmailDomainDao.java create mode 100644 orcid-persistence/src/main/java/org/orcid/persistence/dao/impl/ProfileEmailDomainDaoImpl.java create mode 100644 orcid-persistence/src/main/java/org/orcid/persistence/jpa/entities/ProfileEmailDomainEntity.java create mode 100644 orcid-persistence/src/main/resources/db/updates/create_profile_email_domain_table.xml diff --git a/orcid-core/src/main/java/org/orcid/core/common/manager/EmailDomainManager.java b/orcid-core/src/main/java/org/orcid/core/common/manager/EmailDomainManager.java index 167e25e2d2f..838e3a0c4f9 100644 --- a/orcid-core/src/main/java/org/orcid/core/common/manager/EmailDomainManager.java +++ b/orcid-core/src/main/java/org/orcid/core/common/manager/EmailDomainManager.java @@ -10,7 +10,7 @@ public interface EmailDomainManager { boolean updateCategory(long id, EmailDomainEntity.DomainCategory category); - EmailDomainEntity findByEmailDoman(String emailDomain); + EmailDomainEntity findByEmailDomain(String emailDomain); List findByCategory(EmailDomainEntity.DomainCategory category); diff --git a/orcid-core/src/main/java/org/orcid/core/common/manager/impl/EmailDomainManagerImpl.java b/orcid-core/src/main/java/org/orcid/core/common/manager/impl/EmailDomainManagerImpl.java index dcfe88f952b..73f34bd4ca8 100644 --- a/orcid-core/src/main/java/org/orcid/core/common/manager/impl/EmailDomainManagerImpl.java +++ b/orcid-core/src/main/java/org/orcid/core/common/manager/impl/EmailDomainManagerImpl.java @@ -48,11 +48,11 @@ public boolean updateCategory(long id, DomainCategory category) { } @Override - public EmailDomainEntity findByEmailDoman(String emailDomain) { + public EmailDomainEntity findByEmailDomain(String emailDomain) { if (emailDomain == null || emailDomain.isBlank()) { throw new IllegalArgumentException("Email Domain must not be empty"); } - return emailDomainDaoReadOnly.findByEmailDoman(emailDomain); + return emailDomainDaoReadOnly.findByEmailDomain(emailDomain); } @Override @@ -65,7 +65,7 @@ public List findByCategory(DomainCategory category) { @Override public STATUS createOrUpdateEmailDomain(String emailDomain, String rorId) { - EmailDomainEntity existingEntity = emailDomainDaoReadOnly.findByEmailDoman(emailDomain); + EmailDomainEntity existingEntity = emailDomainDaoReadOnly.findByEmailDomain(emailDomain); if(existingEntity != null) { if(!rorId.equals(existingEntity.getRorId())) { boolean updated = emailDomainDao.updateRorId(existingEntity.getId(), rorId); diff --git a/orcid-core/src/main/java/org/orcid/core/manager/read_only/impl/PeerReviewManagerReadOnlyImpl.java b/orcid-core/src/main/java/org/orcid/core/manager/read_only/impl/PeerReviewManagerReadOnlyImpl.java index cc1d26c72cc..54a8362bf22 100644 --- a/orcid-core/src/main/java/org/orcid/core/manager/read_only/impl/PeerReviewManagerReadOnlyImpl.java +++ b/orcid-core/src/main/java/org/orcid/core/manager/read_only/impl/PeerReviewManagerReadOnlyImpl.java @@ -51,7 +51,7 @@ public List findPeerReviews(String orcid) { } /** - * Get the list of peer reivews that belongs to a user + * Get the list of peer reviews that belongs to a user * * @param userOrcid * @param lastModified diff --git a/orcid-core/src/main/java/org/orcid/core/manager/v3/ProfileEmailDomainManager.java b/orcid-core/src/main/java/org/orcid/core/manager/v3/ProfileEmailDomainManager.java new file mode 100644 index 00000000000..93a8eb19c6f --- /dev/null +++ b/orcid-core/src/main/java/org/orcid/core/manager/v3/ProfileEmailDomainManager.java @@ -0,0 +1,16 @@ +package org.orcid.core.manager.v3; + +import org.orcid.core.manager.v3.read_only.ProfileEmailDomainManagerReadOnly; +import org.orcid.persistence.jpa.entities.EmailEntity; + +import java.util.List; + +/** + * + * @author Andrej Romanov + * + */ +public interface ProfileEmailDomainManager extends ProfileEmailDomainManagerReadOnly { + void updateEmailDomains(String orcid, org.orcid.pojo.ajaxForm.Emails emails); + void processDomain(String orcid, String email); +} diff --git a/orcid-core/src/main/java/org/orcid/core/manager/v3/impl/EmailManagerImpl.java b/orcid-core/src/main/java/org/orcid/core/manager/v3/impl/EmailManagerImpl.java index f79c7ce3955..87a4f3347df 100644 --- a/orcid-core/src/main/java/org/orcid/core/manager/v3/impl/EmailManagerImpl.java +++ b/orcid-core/src/main/java/org/orcid/core/manager/v3/impl/EmailManagerImpl.java @@ -10,8 +10,10 @@ import org.apache.commons.lang3.StringUtils; import org.orcid.core.manager.EncryptionManager; import org.orcid.core.manager.v3.EmailManager; +import org.orcid.core.manager.v3.ProfileEmailDomainManager; import org.orcid.core.manager.v3.SourceManager; import org.orcid.core.manager.v3.read_only.impl.EmailManagerReadOnlyImpl; +import org.orcid.core.togglz.Features; import org.orcid.jaxb.model.v3.release.common.Visibility; import org.orcid.jaxb.model.v3.release.record.Email; import org.orcid.persistence.aop.UpdateProfileLastModifiedAndIndexingStatus; @@ -38,6 +40,9 @@ public class EmailManagerImpl extends EmailManagerReadOnlyImpl implements EmailM @Resource(name = "sourceManagerV3") private SourceManager sourceManager; + @Resource(name = "profileEmailDomainManager") + private ProfileEmailDomainManager profileEmailDomainManager; + @Resource private TransactionTemplate transactionTemplate; @@ -62,9 +67,14 @@ public void removeEmail(String orcid, String email) { } @Override + @Transactional @UpdateProfileLastModifiedAndIndexingStatus public boolean verifyEmail(String orcid, String email) { - return emailDao.verifyEmail(email); + boolean result = emailDao.verifyEmail(email); + if (result && Features.EMAIL_DOMAINS.isActive()) { + profileEmailDomainManager.processDomain(orcid, email); + } + return result; } @Override @@ -72,7 +82,12 @@ public boolean verifyEmail(String orcid, String email) { public boolean verifyPrimaryEmail(String orcid) { try { String primaryEmail = emailDao.findPrimaryEmail(orcid).getEmail(); - return emailDao.verifyEmail(primaryEmail); + + boolean result = emailDao.verifyEmail(primaryEmail); + if (result && Features.EMAIL_DOMAINS.isActive()) { + profileEmailDomainManager.processDomain(orcid, primaryEmail); + } + return result; } catch (javax.persistence.NoResultException nre) { String alternativePrimaryEmail = emailDao.findNewestVerifiedOrNewestEmail(orcid); emailDao.updatePrimary(orcid, alternativePrimaryEmail); @@ -99,12 +114,17 @@ public boolean moveEmailToOtherAccount(String email, String origin, String desti } @Override + @Transactional public boolean verifySetCurrentAndPrimary(String orcid, String email) { if (PojoUtil.isEmpty(orcid) || PojoUtil.isEmpty(email)) { throw new IllegalArgumentException("orcid or email param is empty or null"); } - return emailDao.updateVerifySetCurrentAndPrimary(orcid, email); + boolean result = emailDao.updateVerifySetCurrentAndPrimary(orcid, email); + if (result && Features.EMAIL_DOMAINS.isActive()) { + profileEmailDomainManager.processDomain(orcid, email); + } + return result; } /*** diff --git a/orcid-core/src/main/java/org/orcid/core/manager/v3/impl/ProfileEmailDomainManagerImpl.java b/orcid-core/src/main/java/org/orcid/core/manager/v3/impl/ProfileEmailDomainManagerImpl.java new file mode 100644 index 00000000000..dbb8db060e3 --- /dev/null +++ b/orcid-core/src/main/java/org/orcid/core/manager/v3/impl/ProfileEmailDomainManagerImpl.java @@ -0,0 +1,78 @@ +package org.orcid.core.manager.v3.impl; + + +import org.orcid.core.manager.v3.ProfileEmailDomainManager; +import org.orcid.core.manager.v3.read_only.impl.ProfileEmailDomainManagerReadOnlyImpl; +import org.orcid.jaxb.model.v3.release.common.Visibility; +import org.orcid.persistence.dao.EmailDao; +import org.orcid.persistence.dao.EmailDomainDao; +import org.orcid.persistence.dao.ProfileEmailDomainDao; +import org.orcid.persistence.jpa.entities.EmailDomainEntity; +import org.orcid.persistence.jpa.entities.ProfileEmailDomainEntity; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.*; + +/** + * + * @author Andrej Romanov + * + */ +public class ProfileEmailDomainManagerImpl extends ProfileEmailDomainManagerReadOnlyImpl implements ProfileEmailDomainManager { + @Resource + protected ProfileEmailDomainDao profileEmailDomainDao; + + @Resource + protected EmailDomainDao emailDomainDao; + + @Resource + protected EmailDao emailDao; + + private static final String DEFAULT_DOMAIN_VISIBILITY = Visibility.PRIVATE.toString().toUpperCase(); + + @Transactional + public void updateEmailDomains(String orcid, org.orcid.pojo.ajaxForm.Emails newEmails) { + List existingEmailDomains = profileEmailDomainDao.findByOrcid(orcid); + + if (existingEmailDomains != null) { + // VISIBILITY UPDATE FOR EXISTING DOMAINS + for (org.orcid.pojo.ajaxForm.ProfileEmailDomain emailDomain : newEmails.getEmailDomains()) { + for (ProfileEmailDomainEntity existingEmailDomain : existingEmailDomains) { + if (existingEmailDomain.getEmailDomain().equals(emailDomain.getValue())) { + if (!existingEmailDomain.getVisibility().equals(emailDomain.getVisibility())) { + profileEmailDomainDao.updateVisibility(orcid, emailDomain.getValue(), emailDomain.getVisibility()); + } + } + } + } + + // REMOVE DOMAINS + for (ProfileEmailDomainEntity existingEmailDomain : existingEmailDomains) { + boolean deleteEmail = true; + for (org.orcid.pojo.ajaxForm.ProfileEmailDomain emailDomain : newEmails.getEmailDomains()) { + if (existingEmailDomain.getEmailDomain().equals(emailDomain.getValue())) { + deleteEmail = false; + break; + } + } + if (deleteEmail) { + profileEmailDomainDao.removeEmailDomain(orcid, existingEmailDomain.getEmailDomain()); + } + } + } + } + + public void processDomain(String orcid, String email) { + String domain = email.split("@")[1]; + EmailDomainEntity domainInfo = emailDomainDao.findByEmailDomain(domain); + // Check if email is professional + if (domainInfo != null && domainInfo.getCategory().equals(EmailDomainEntity.DomainCategory.PROFESSIONAL)) { + ProfileEmailDomainEntity existingDomain = profileEmailDomainDao.findByEmailDomain(orcid, domain); + // ADD NEW DOMAIN IF ONE DOESN'T EXIST + if (existingDomain == null) { + profileEmailDomainDao.addEmailDomain(orcid, domain, DEFAULT_DOMAIN_VISIBILITY); + } + } + } +} diff --git a/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/ProfileEmailDomainManagerReadOnly.java b/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/ProfileEmailDomainManagerReadOnly.java new file mode 100644 index 00000000000..aa0212332e9 --- /dev/null +++ b/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/ProfileEmailDomainManagerReadOnly.java @@ -0,0 +1,16 @@ +package org.orcid.core.manager.v3.read_only; + + +import org.orcid.persistence.jpa.entities.ProfileEmailDomainEntity; + +import java.util.List; + +/** + * + * @author Andrej Romanov + * + */ +public interface ProfileEmailDomainManagerReadOnly { + List getEmailDomains(String orcid); + List getPublicEmailDomains(String orcid); +} diff --git a/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/impl/ProfileEmailDomainManagerReadOnlyImpl.java b/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/impl/ProfileEmailDomainManagerReadOnlyImpl.java new file mode 100644 index 00000000000..dc97b2fb9c1 --- /dev/null +++ b/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/impl/ProfileEmailDomainManagerReadOnlyImpl.java @@ -0,0 +1,32 @@ +package org.orcid.core.manager.v3.read_only.impl; + + +import org.orcid.core.manager.read_only.impl.ManagerReadOnlyBaseImpl; +import org.orcid.core.manager.v3.read_only.ProfileEmailDomainManagerReadOnly; +import org.orcid.persistence.dao.ProfileEmailDomainDao; +import org.orcid.persistence.jpa.entities.ProfileEmailDomainEntity; + +import javax.annotation.Resource; +import java.util.List; + +/** + * + * @author Andrej Romanov + * + */ +public class ProfileEmailDomainManagerReadOnlyImpl extends ManagerReadOnlyBaseImpl implements ProfileEmailDomainManagerReadOnly { + @Resource + protected ProfileEmailDomainDao profileEmailDomainDao; + + public void setProfileEmailDomainDao(ProfileEmailDomainDao profileEmailDomainDao) { + this.profileEmailDomainDao = profileEmailDomainDao; + } + + public List getEmailDomains(String orcid) { + return profileEmailDomainDao.findByOrcid(orcid); + }; + + public List getPublicEmailDomains(String orcid) { + return profileEmailDomainDao.findPublicEmailDomains(orcid); + }; +} diff --git a/orcid-core/src/main/java/org/orcid/core/togglz/Features.java b/orcid-core/src/main/java/org/orcid/core/togglz/Features.java index 3bfe0bac62a..0151c946ae3 100644 --- a/orcid-core/src/main/java/org/orcid/core/togglz/Features.java +++ b/orcid-core/src/main/java/org/orcid/core/togglz/Features.java @@ -59,7 +59,13 @@ public enum Features implements Feature { PAPI_EVENTS, @Label("Enable summary endpoint in the Members API") - MAPI_SUMMARY_ENDPOINT; + MAPI_SUMMARY_ENDPOINT, + + @Label("Enable email domains") + EMAIL_DOMAINS, + + @Label("Enable email domains in the UI") + EMAIL_DOMAINS_UI; public boolean isActive() { return FeatureContext.getFeatureManager().isActive(this); diff --git a/orcid-core/src/main/java/org/orcid/pojo/ajaxForm/Emails.java b/orcid-core/src/main/java/org/orcid/pojo/ajaxForm/Emails.java index 2b78d0ba155..1ea3ad73889 100644 --- a/orcid-core/src/main/java/org/orcid/pojo/ajaxForm/Emails.java +++ b/orcid-core/src/main/java/org/orcid/pojo/ajaxForm/Emails.java @@ -1,16 +1,20 @@ package org.orcid.pojo.ajaxForm; +import org.orcid.core.togglz.Features; +import org.orcid.persistence.jpa.entities.ProfileEmailDomainEntity; + import java.util.ArrayList; import java.util.List; public class Emails implements ErrorsInterface { private List emails = null; + private List emailDomains = null; @SuppressWarnings("unused") private static final long serialVersionUID = 1L; private List errors = new ArrayList(); - public static Emails valueOf(org.orcid.jaxb.model.v3.release.record.Emails e) { + public static Emails valueOf(org.orcid.jaxb.model.v3.release.record.Emails e, List domains) { Emails emails = new Emails(); if (e != null && !e.getEmails().isEmpty()) { emails.setEmails(new ArrayList()); @@ -18,6 +22,12 @@ public static Emails valueOf(org.orcid.jaxb.model.v3.release.record.Emails e) { emails.getEmails().add(Email.valueOf(v3Email)); } } + if (domains != null && !domains.isEmpty() && Features.EMAIL_DOMAINS.isActive()) { + emails.setEmailDomains(new ArrayList()); + for (ProfileEmailDomainEntity domain : domains) { + emails.getEmailDomains().add(ProfileEmailDomain.valueOf(domain)); + } + } return emails; } @@ -46,4 +56,8 @@ public List getEmails() { public void setEmails(List emails) { this.emails = emails; } + + public List getEmailDomains() { return emailDomains; } + + public void setEmailDomains(List emailDomains) { this.emailDomains = emailDomains;} } diff --git a/orcid-core/src/main/java/org/orcid/pojo/ajaxForm/ProfileEmailDomain.java b/orcid-core/src/main/java/org/orcid/pojo/ajaxForm/ProfileEmailDomain.java new file mode 100644 index 00000000000..3ac0d064246 --- /dev/null +++ b/orcid-core/src/main/java/org/orcid/pojo/ajaxForm/ProfileEmailDomain.java @@ -0,0 +1,79 @@ +package org.orcid.pojo.ajaxForm; + +import org.orcid.persistence.jpa.entities.ProfileEmailDomainEntity; + +import java.time.LocalDate; +import java.time.ZoneId; + +public class ProfileEmailDomain { + + protected String value; + + protected String visibility; + + private Date createdDate; + + private Date lastModified; + + public static ProfileEmailDomain valueOf(ProfileEmailDomainEntity ed) { + ProfileEmailDomain emailDomain = new ProfileEmailDomain(); + + if (ed != null) { + emailDomain.setValue(ed.getEmailDomain()); + emailDomain.setVisibility(ed.getVisibility()); + + if (ed.getDateCreated() != null) { + 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.setDay(String.valueOf(date.getDayOfMonth())); + createdDate.setTimestamp(ed.getDateCreated().toInstant().toEpochMilli()); + emailDomain.setCreatedDate(createdDate); + } + + if (ed.getLastModified() != null) { + 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.setDay(String.valueOf(date.getDayOfMonth())); + emailDomain.setLastModified(lastModifiedDate); + } + } + return emailDomain; + } + + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public String getVisibility() { + return visibility; + } + + public void setVisibility(String visibility) { + this.visibility = visibility; + } + + 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; + } +} diff --git a/orcid-core/src/main/resources/orcid-core-context.xml b/orcid-core/src/main/resources/orcid-core-context.xml index 5bf56885446..3402d3db718 100644 --- a/orcid-core/src/main/resources/orcid-core-context.xml +++ b/orcid-core/src/main/resources/orcid-core-context.xml @@ -499,9 +499,19 @@ - - - + + + + + + + + + + + + + diff --git a/orcid-core/src/test/java/org/orcid/core/common/manager/EmailDomainManagerTest.java b/orcid-core/src/test/java/org/orcid/core/common/manager/EmailDomainManagerTest.java index 5a89982de1a..5eb7cde5b30 100644 --- a/orcid-core/src/test/java/org/orcid/core/common/manager/EmailDomainManagerTest.java +++ b/orcid-core/src/test/java/org/orcid/core/common/manager/EmailDomainManagerTest.java @@ -50,8 +50,8 @@ public void before() { when(emailDomainDaoReadOnlyMock.findByCategory(eq(DomainCategory.PERSONAL))).thenReturn(List.of(e1, e2)); when(emailDomainDaoReadOnlyMock.findByCategory(eq(DomainCategory.PROFESSIONAL))).thenReturn(List.of(e3)); - when(emailDomainDaoReadOnlyMock.findByEmailDoman("gmail.com")).thenReturn(e1); - when(emailDomainDaoReadOnlyMock.findByEmailDoman("orcid.org")).thenReturn(e3); + when(emailDomainDaoReadOnlyMock.findByEmailDomain("gmail.com")).thenReturn(e1); + when(emailDomainDaoReadOnlyMock.findByEmailDomain("orcid.org")).thenReturn(e3); when(emailDomainDaoMock.createEmailDomain(eq("new.domain"), eq(DomainCategory.PROFESSIONAL), eq("https://ror.org/0"))).thenReturn(new EmailDomainEntity("new.domain", DomainCategory.PROFESSIONAL, "https://ror.org/0")); when(emailDomainDaoMock.updateRorId(1000L, "https://ror.org/0")).thenReturn(true); @@ -95,23 +95,23 @@ public void updateCategoryTest() { } @Test(expected = IllegalArgumentException.class) - public void findByEmailDoman_NullDomainTest() { - edm.findByEmailDoman(null); + public void findByEmailDomain_NullDomainTest() { + edm.findByEmailDomain(null); } @Test(expected = IllegalArgumentException.class) - public void findByEmailDoman_EmptyDomainTest() { - edm.findByEmailDoman(" "); + public void findByEmailDomain_EmptyDomainTest() { + edm.findByEmailDomain(" "); } @Test - public void findByEmailDoman_NothingFoundTest() { - assertNull(edm.findByEmailDoman("other.com")); + public void findByEmailDomain_NothingFoundTest() { + assertNull(edm.findByEmailDomain("other.com")); } @Test - public void findByEmailDomanTest() { - EmailDomainEntity ede = edm.findByEmailDoman("gmail.com"); + public void findByEmailDomainTest() { + EmailDomainEntity ede = edm.findByEmailDomain("gmail.com"); assertNotNull(ede); assertEquals("gmail.com", ede.getEmailDomain()); assertEquals(DomainCategory.PERSONAL, ede.getCategory()); @@ -119,7 +119,7 @@ public void findByEmailDomanTest() { @Test(expected = IllegalArgumentException.class) public void findByCategory_NullCategoryTest() { - edm.findByEmailDoman(null); + edm.findByEmailDomain(null); } @Test diff --git a/orcid-persistence/src/main/java/org/orcid/persistence/dao/EmailDomainDao.java b/orcid-persistence/src/main/java/org/orcid/persistence/dao/EmailDomainDao.java index 93ea7a3bc35..9c7dc02e213 100644 --- a/orcid-persistence/src/main/java/org/orcid/persistence/dao/EmailDomainDao.java +++ b/orcid-persistence/src/main/java/org/orcid/persistence/dao/EmailDomainDao.java @@ -13,7 +13,7 @@ public interface EmailDomainDao extends GenericDao { boolean updateRorId(long id, String rorId); - EmailDomainEntity findByEmailDoman(String emailDomain); + EmailDomainEntity findByEmailDomain(String emailDomain); List findByCategory(EmailDomainEntity.DomainCategory category); } diff --git a/orcid-persistence/src/main/java/org/orcid/persistence/dao/ProfileEmailDomainDao.java b/orcid-persistence/src/main/java/org/orcid/persistence/dao/ProfileEmailDomainDao.java new file mode 100644 index 00000000000..679b40dde21 --- /dev/null +++ b/orcid-persistence/src/main/java/org/orcid/persistence/dao/ProfileEmailDomainDao.java @@ -0,0 +1,19 @@ +package org.orcid.persistence.dao; + +import org.orcid.persistence.jpa.entities.ProfileEmailDomainEntity; + +import java.util.List; + +public interface ProfileEmailDomainDao extends GenericDao { + ProfileEmailDomainEntity addEmailDomain(String orcid, String emailDomain, String visibility); + + void removeEmailDomain(String orcid, String emailDomain); + + boolean updateVisibility(String orcid, String emailDomain, String visibility); + + List findByOrcid(String orcid); + + List findPublicEmailDomains(String orcid); + + ProfileEmailDomainEntity findByEmailDomain(String orcid, String emailDomain); +} \ No newline at end of file diff --git a/orcid-persistence/src/main/java/org/orcid/persistence/dao/impl/EmailDomainDaoImpl.java b/orcid-persistence/src/main/java/org/orcid/persistence/dao/impl/EmailDomainDaoImpl.java index 6c75eec184f..c23525ea716 100644 --- a/orcid-persistence/src/main/java/org/orcid/persistence/dao/impl/EmailDomainDaoImpl.java +++ b/orcid-persistence/src/main/java/org/orcid/persistence/dao/impl/EmailDomainDaoImpl.java @@ -65,7 +65,7 @@ public boolean updateRorId(long id, String rorId) { } @Override - public EmailDomainEntity findByEmailDoman(String emailDomain) { + public EmailDomainEntity findByEmailDomain(String emailDomain) { TypedQuery query = entityManager.createQuery("from EmailDomainEntity where emailDomain = :emailDomain", EmailDomainEntity.class); query.setParameter("emailDomain", emailDomain); try { diff --git a/orcid-persistence/src/main/java/org/orcid/persistence/dao/impl/ProfileEmailDomainDaoImpl.java b/orcid-persistence/src/main/java/org/orcid/persistence/dao/impl/ProfileEmailDomainDaoImpl.java new file mode 100644 index 00000000000..9a8bffd0b4e --- /dev/null +++ b/orcid-persistence/src/main/java/org/orcid/persistence/dao/impl/ProfileEmailDomainDaoImpl.java @@ -0,0 +1,89 @@ +package org.orcid.persistence.dao.impl; + +import org.orcid.persistence.aop.UpdateProfileLastModifiedAndIndexingStatus; +import org.orcid.persistence.dao.ProfileEmailDomainDao; +import org.orcid.persistence.jpa.entities.ProfileEmailDomainEntity; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.transaction.annotation.Transactional; + +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.TypedQuery; +import java.util.List; + +public class ProfileEmailDomainDaoImpl extends GenericDaoImpl implements ProfileEmailDomainDao { + + private static final Logger LOG = LoggerFactory.getLogger(ProfileEmailDomainDaoImpl.class); + + public ProfileEmailDomainDaoImpl() { + super(ProfileEmailDomainEntity.class); + } + + @Override + @Transactional + @UpdateProfileLastModifiedAndIndexingStatus + public ProfileEmailDomainEntity addEmailDomain(String orcid, String emailDomain, String visibility) { + ProfileEmailDomainEntity e = new ProfileEmailDomainEntity(); + e.setEmailDomain(emailDomain); + e.setOrcid(orcid); + e.setVisibility(visibility); + entityManager.persist(e); + return e; + } + + @Override + @Transactional + @UpdateProfileLastModifiedAndIndexingStatus + public void removeEmailDomain(String orcid, String emailDomain) { + String deleteEmail = "delete from profile_email_domain where orcid = :orcid and trim(lower(email_domain)) = trim(lower(:emailDomain))"; + + Query query = entityManager.createNativeQuery(deleteEmail); + query.setParameter("emailDomain", emailDomain); + query.setParameter("orcid", orcid); + query.executeUpdate(); + } + + @Override + @Transactional + @UpdateProfileLastModifiedAndIndexingStatus + public boolean updateVisibility(String orcid, String emailDomain, String visibility) { + Query query = entityManager.createNativeQuery("UPDATE profile_email_domain SET visibility=:visibility, last_modified = now() WHERE orcid = :orcid and email_domain = :emailDomain"); + query.setParameter("orcid", orcid); + query.setParameter("emailDomain", emailDomain); + query.setParameter("visibility", visibility); + return query.executeUpdate() > 0; + } + + @Override + public List findByOrcid(String orcid) { + TypedQuery query = entityManager.createQuery("from ProfileEmailDomainEntity where orcid = :orcid", ProfileEmailDomainEntity.class); + query.setParameter("orcid", orcid); + List results = query.getResultList(); + return results.isEmpty() ? null : results; + } + + @Override + public List findPublicEmailDomains(String orcid) { + TypedQuery query = entityManager.createQuery("from ProfileEmailDomainEntity where orcid = :orcid and visibility = 'PUBLIC'", ProfileEmailDomainEntity.class); + query.setParameter("orcid", orcid); + List results = query.getResultList(); + return results.isEmpty() ? null : results; + } + + @Override + public ProfileEmailDomainEntity findByEmailDomain(String orcid, String emailDomain) { + TypedQuery query = entityManager.createQuery("from ProfileEmailDomainEntity where orcid = :orcid and emailDomain = :emailDomain", ProfileEmailDomainEntity.class); + query.setParameter("orcid", orcid); + query.setParameter("emailDomain", emailDomain); + try { + return query.getSingleResult(); + } catch(NoResultException nre) { + // Ignore this exception + } catch(Exception e) { + // Propagate any other exception + throw e; + } + return null; + } +} diff --git a/orcid-persistence/src/main/java/org/orcid/persistence/jpa/entities/ProfileEmailDomainEntity.java b/orcid-persistence/src/main/java/org/orcid/persistence/jpa/entities/ProfileEmailDomainEntity.java new file mode 100644 index 00000000000..00d53d26cba --- /dev/null +++ b/orcid-persistence/src/main/java/org/orcid/persistence/jpa/entities/ProfileEmailDomainEntity.java @@ -0,0 +1,73 @@ +package org.orcid.persistence.jpa.entities; + +import javax.persistence.*; +import java.util.Objects; + +/** + * + * @author Andrej Romanov + * + */ +@Entity +@Table(name = "profile_email_domain") +public class ProfileEmailDomainEntity extends BaseEntity { + private static final long serialVersionUID = 1L; + private Long id; + private String orcid; + private String emailDomain; + private String visibility; + + @Id + @Column(name = "id") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "event_seq") + @SequenceGenerator(name = "profile_email_domain_seq", sequenceName = "profile_email_domain_seq", allocationSize = 1) + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + @Column(name = "orcid") + public String getOrcid() { + return orcid; + } + + public void setOrcid(String orcid) { + this.orcid = orcid; + } + + @Column(name = "email_domain") + public String getEmailDomain() { + return emailDomain; + } + + public void setEmailDomain(String emailDomain) { + this.emailDomain = emailDomain; + } + + @Column(name = "visibility") + public String getVisibility() { + return visibility; + } + + public void setVisibility(String visibility) { + this.visibility = visibility; + } + + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ProfileEmailDomainEntity other = (ProfileEmailDomainEntity) obj; + return Objects.equals(emailDomain, other.emailDomain) && Objects.equals(orcid, other.orcid) + && Objects.equals(id, other.id) && Objects.equals(visibility, other.visibility); + } + +} diff --git a/orcid-persistence/src/main/resources/META-INF/persistence.xml b/orcid-persistence/src/main/resources/META-INF/persistence.xml index 418d0cfa39d..e92cdc61d71 100644 --- a/orcid-persistence/src/main/resources/META-INF/persistence.xml +++ b/orcid-persistence/src/main/resources/META-INF/persistence.xml @@ -63,6 +63,7 @@ org.orcid.persistence.jpa.entities.EventEntity org.orcid.persistence.jpa.entities.EventStatsEntity org.orcid.persistence.jpa.entities.EmailDomainEntity + org.orcid.persistence.jpa.entities.ProfileEmailDomainEntity org.orcid.persistence.jpa.entities.ClientDetailsEntity diff --git a/orcid-persistence/src/main/resources/db-master.xml b/orcid-persistence/src/main/resources/db-master.xml index d0865c4510a..c2e1fa5b644 100644 --- a/orcid-persistence/src/main/resources/db-master.xml +++ b/orcid-persistence/src/main/resources/db-master.xml @@ -1,324 +1,332 @@ + xmlns="http://www.liquibase.org/xml/ns/dbchangelog" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd"> - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -345,22 +353,22 @@ - - + + - - + + - - - - - + + + + + - - + + @@ -375,14 +383,14 @@ - + - + @@ -392,5 +400,6 @@ + - + \ No newline at end of file diff --git a/orcid-persistence/src/main/resources/db/updates/create_profile_email_domain_table.xml b/orcid-persistence/src/main/resources/db/updates/create_profile_email_domain_table.xml new file mode 100644 index 00000000000..9c403245e97 --- /dev/null +++ b/orcid-persistence/src/main/resources/db/updates/create_profile_email_domain_table.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + create index profile_email_domain_orcid_index on profile_email_domain(orcid); + + + + + + + + + create index profile_email_domain_index on profile_email_domain(email_domain); + + + + + SELECT 1 FROM pg_roles WHERE rolname='orcidro' + + GRANT SELECT ON profile_email_domain to orcidro; + + + diff --git a/orcid-persistence/src/main/resources/orcid-persistence-context.xml b/orcid-persistence/src/main/resources/orcid-persistence-context.xml index cedd58617ac..d57dde50df1 100644 --- a/orcid-persistence/src/main/resources/orcid-persistence-context.xml +++ b/orcid-persistence/src/main/resources/orcid-persistence-context.xml @@ -81,8 +81,14 @@ - - + + + + + + + + diff --git a/orcid-scheduler-web/src/main/java/org/orcid/scheduler/loader/cli/EmailDomainLoader.java b/orcid-scheduler-web/src/main/java/org/orcid/scheduler/loader/cli/EmailDomainLoader.java index f7517c6a436..d01ee877f4f 100644 --- a/orcid-scheduler-web/src/main/java/org/orcid/scheduler/loader/cli/EmailDomainLoader.java +++ b/orcid-scheduler-web/src/main/java/org/orcid/scheduler/loader/cli/EmailDomainLoader.java @@ -76,7 +76,7 @@ private void process() { for (List row : emailDomainData) { String elementDomain = row.get(0); String elementCategory = row.get(1); - EmailDomainEntity ede = emailDomainManager.findByEmailDoman(elementDomain); + EmailDomainEntity ede = emailDomainManager.findByEmailDomain(elementDomain); EmailDomainEntity.DomainCategory category = EmailDomainEntity.DomainCategory.valueOf(elementCategory.toUpperCase()); if(ede == null) { try { diff --git a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/EmailDomainController.java b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/EmailDomainController.java index e1ca2aabad4..fe252420836 100644 --- a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/EmailDomainController.java +++ b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/EmailDomainController.java @@ -36,7 +36,7 @@ public class EmailDomainController { return response; } domain = OrcidStringUtils.stripHtml(domain); - EmailDomainEntity ede = emailDomainManager.findByEmailDoman(domain); + EmailDomainEntity ede = emailDomainManager.findByEmailDomain(domain); if(ede == null) { ObjectNode response = mapper.createObjectNode(); response.put("category", EmailDomainEntity.DomainCategory.UNDEFINED.name()); @@ -60,7 +60,7 @@ public class EmailDomainController { } domain = OrcidStringUtils.stripHtml(domain); - EmailDomainEntity ede = emailDomainManager.findByEmailDoman(domain); + EmailDomainEntity ede = emailDomainManager.findByEmailDomain(domain); if(ede != null) { String rorId = ede.getRorId(); if(rorId != null && !rorId.isBlank()) { diff --git a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/ManageProfileController.java b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/ManageProfileController.java index 09b7c3618da..bf7696cb5db 100644 --- a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/ManageProfileController.java +++ b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/ManageProfileController.java @@ -19,6 +19,7 @@ import org.codehaus.jettison.json.JSONException; import org.codehaus.jettison.json.JSONObject; import org.jasypt.exceptions.EncryptionOperationNotPossibleException; +import org.orcid.core.adapter.impl.MapperFacadeFactory; import org.orcid.core.constants.EmailConstants; import org.orcid.core.manager.AdminManager; import org.orcid.core.manager.EncryptionManager; @@ -26,14 +27,13 @@ import org.orcid.core.manager.ProfileEntityCacheManager; import org.orcid.core.manager.TwoFactorAuthenticationManager; import org.orcid.core.manager.UserConnectionManager; -import org.orcid.core.manager.v3.AddressManager; -import org.orcid.core.manager.v3.BiographyManager; -import org.orcid.core.manager.v3.GivenPermissionToManager; -import org.orcid.core.manager.v3.RecordNameManager; +import org.orcid.core.manager.v3.*; +import org.orcid.core.manager.v3.read_only.ProfileEmailDomainManagerReadOnly; import org.orcid.core.manager.v3.read_only.EmailManagerReadOnly; import org.orcid.core.manager.v3.read_only.GivenPermissionToManagerReadOnly; import org.orcid.core.manager.v3.read_only.ProfileEntityManagerReadOnly; import org.orcid.core.manager.v3.read_only.RecordNameManagerReadOnly; +import org.orcid.core.togglz.Features; import org.orcid.core.utils.JsonUtils; import org.orcid.core.utils.OrcidStringUtils; import org.orcid.core.utils.v3.OrcidIdentifierUtils; @@ -45,6 +45,7 @@ import org.orcid.jaxb.model.v3.release.record.Emails; import org.orcid.jaxb.model.v3.release.record.Name; import org.orcid.persistence.jpa.entities.EmailEntity; +import org.orcid.persistence.jpa.entities.ProfileEmailDomainEntity; import org.orcid.persistence.jpa.entities.ProfileEntity; import org.orcid.persistence.jpa.entities.UserconnectionEntity; import org.orcid.pojo.AddEmail; @@ -55,17 +56,10 @@ import org.orcid.pojo.EmailFrequencyOptions; import org.orcid.pojo.ManageDelegate; import org.orcid.pojo.ManageSocialAccount; -import org.orcid.pojo.ajaxForm.AddressForm; -import org.orcid.pojo.ajaxForm.AddressesForm; -import org.orcid.pojo.ajaxForm.BiographyForm; -import org.orcid.pojo.ajaxForm.EditEmail; -import org.orcid.pojo.ajaxForm.Email; -import org.orcid.pojo.ajaxForm.Errors; -import org.orcid.pojo.ajaxForm.NamesForm; -import org.orcid.pojo.ajaxForm.PojoUtil; -import org.orcid.pojo.ajaxForm.Text; -import org.orcid.pojo.ajaxForm.Visibility; +import org.orcid.pojo.ajaxForm.*; import org.orcid.utils.alerting.SlackManager; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Controller; import org.springframework.validation.MapBindingResult; import org.springframework.validation.ObjectError; @@ -100,8 +94,14 @@ public class ManageProfileController extends BaseWorkspaceController { @Resource private GivenPermissionToManager givenPermissionToManager; - @Resource(name = "emailManagerReadOnlyV3") + @Resource(name = "emailManagerReadOnlyV3") private EmailManagerReadOnly emailManagerReadOnly; + + @Resource(name = "profileEmailDomainManagerReadOnly") + private ProfileEmailDomainManagerReadOnly profileEmailDomainManagerReadOnly; + + @Resource(name = "profileEmailDomainManager") + private ProfileEmailDomainManager profileEmailDomainManager; @Resource private UserConnectionManager userConnectionManager; @@ -138,7 +138,7 @@ public class ManageProfileController extends BaseWorkspaceController { @Resource private SlackManager slackManager; - + @RequestMapping public ModelAndView manageProfile() { return new ModelAndView("manage"); @@ -530,17 +530,23 @@ public ModelAndView confirmDeactivateOrcidAccount(HttpServletRequest request, Ht @RequestMapping(value = "/emails.json", method = RequestMethod.GET) public @ResponseBody org.orcid.pojo.ajaxForm.Emails getEmails(HttpServletRequest request) { - Emails v2Emails = emailManager.getEmails(getCurrentUserOrcid()); - return org.orcid.pojo.ajaxForm.Emails.valueOf(v2Emails); + Emails v2Emails = emailManager.getEmails(getCurrentUserOrcid()); + + List emailDomains = null; + if (Features.EMAIL_DOMAINS.isActive()) { + emailDomains = profileEmailDomainManagerReadOnly.getEmailDomains(getCurrentUserOrcid()); + } + return org.orcid.pojo.ajaxForm.Emails.valueOf(v2Emails, emailDomains); } @RequestMapping(value = "/emails.json", method = RequestMethod.POST) - public @ResponseBody org.orcid.pojo.ajaxForm.Emails setEmails(HttpServletRequest request, @RequestBody org.orcid.pojo.ajaxForm.Emails newEmailSet) { - Emails oldEmailSet = emailManager.getEmails(getCurrentUserOrcid()); + public @ResponseBody org.orcid.pojo.ajaxForm.Emails setEmails(HttpServletRequest request, @RequestBody org.orcid.pojo.ajaxForm.Emails newEmailSet) { + Emails oldEmailSet = emailManager.getEmails(getCurrentUserOrcid()); List deletedEmails = new ArrayList(); List newEmails = new ArrayList(); String orcid = getCurrentUserOrcid(); List errors = new ArrayList(); + for (org.orcid.pojo.ajaxForm.Email newJsonEmail : newEmailSet.getEmails()) { boolean isNewEmail = true; for (org.orcid.jaxb.model.v3.release.record.Email oldJsonEmail: oldEmailSet.getEmails()) { @@ -597,7 +603,12 @@ public ModelAndView confirmDeactivateOrcidAccount(HttpServletRequest request, Ht } Emails updatedSet = emailManager.getEmails(getCurrentUserOrcid()); - org.orcid.pojo.ajaxForm.Emails emailsResponse = org.orcid.pojo.ajaxForm.Emails.valueOf(updatedSet); + List updatedDomains = null; + if (Features.EMAIL_DOMAINS.isActive()) { + profileEmailDomainManager.updateEmailDomains(orcid, newEmailSet); + updatedDomains = profileEmailDomainManagerReadOnly.getEmailDomains(getCurrentUserOrcid()); + } + org.orcid.pojo.ajaxForm.Emails emailsResponse = org.orcid.pojo.ajaxForm.Emails.valueOf(updatedSet, updatedDomains); emailsResponse.setErrors(errors); return emailsResponse; } @@ -978,7 +989,7 @@ public ModelAndView authorizeDelegatesRequest(@RequestParam("key") String key) { if (params.containsKey(AdminManager.MANAGED_USER_PARAM) && params.containsKey(AdminManager.TRUSTED_USER_PARAM)) { String managedOrcid = params.get(AdminManager.MANAGED_USER_PARAM); String trustedOrcid = params.get(AdminManager.TRUSTED_USER_PARAM); - // Check if managed user is the same than the logged user + // Check if managed user is the same as the logged user if (managedOrcid.equals(getEffectiveUserOrcid())) { // Check if the managed user email is verified, if not, // verify it diff --git a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/PublicRecordController.java b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/PublicRecordController.java index 04945c894a5..733c6f3dfcc 100644 --- a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/PublicRecordController.java +++ b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/PublicRecordController.java @@ -1,6 +1,7 @@ package org.orcid.frontend.web.controllers; import java.util.ArrayList; +import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -14,11 +15,7 @@ import org.orcid.core.exception.OrcidNoResultException; import org.orcid.core.exception.OrcidNotClaimedException; import org.orcid.core.manager.ProfileEntityCacheManager; -import org.orcid.core.manager.v3.read_only.AddressManagerReadOnly; -import org.orcid.core.manager.v3.read_only.ExternalIdentifierManagerReadOnly; -import org.orcid.core.manager.v3.read_only.PersonalDetailsManagerReadOnly; -import org.orcid.core.manager.v3.read_only.ProfileKeywordManagerReadOnly; -import org.orcid.core.manager.v3.read_only.ResearcherUrlManagerReadOnly; +import org.orcid.core.manager.v3.read_only.*; import org.orcid.core.togglz.Features; import org.orcid.jaxb.model.message.OrcidType; import org.orcid.jaxb.model.v3.release.record.Addresses; @@ -32,6 +29,7 @@ import org.orcid.jaxb.model.v3.release.record.PersonalDetails; import org.orcid.jaxb.model.v3.release.record.ResearcherUrls; import org.orcid.persistence.jpa.entities.EventType; +import org.orcid.persistence.jpa.entities.ProfileEmailDomainEntity; import org.orcid.persistence.jpa.entities.ProfileEntity; import org.orcid.pojo.PublicRecord; import org.orcid.pojo.ajaxForm.AddressForm; @@ -71,6 +69,9 @@ public class PublicRecordController extends BaseWorkspaceController { @Resource(name = "externalIdentifierManagerReadOnlyV3") private ExternalIdentifierManagerReadOnly externalIdentifierManagerReadOnly; + @Resource(name = "profileEmailDomainManagerReadOnly") + private ProfileEmailDomainManagerReadOnly profileEmailDomainManagerReadOnly; + @Resource private EventManager eventManager; @@ -195,8 +196,14 @@ PublicRecord getRecord(String orcid) { Emails filteredEmails = new Emails(); filteredEmails.setEmails(new ArrayList<>(publicEmails.getEmails().stream().filter(Email::isVerified).collect(Collectors.toList()))); + + // Fill email domains + List emailDomains = null; + if (Features.EMAIL_DOMAINS.isActive()) { + emailDomains = profileEmailDomainManagerReadOnly.getPublicEmailDomains(getCurrentUserOrcid()); + } - publicRecord.setEmails(org.orcid.pojo.ajaxForm.Emails.valueOf(filteredEmails)); + publicRecord.setEmails(org.orcid.pojo.ajaxForm.Emails.valueOf(filteredEmails, emailDomains)); // Fill external identifiers PersonExternalIdentifiers publicPersonExternalIdentifiers; From 405e84e8b4dabb1501b037f97f2cca13ac284296 Mon Sep 17 00:00:00 2001 From: github actions Date: Sat, 10 Aug 2024 15:57:46 +0000 Subject: [PATCH 02/21] v2.63.4 changelog update --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b8328dee49..fa7bf58f88d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## v2.63.4 - 2024-08-10 + +[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.63.3...v2.63.4) + ## v2.63.3 - 2024-08-06 [Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.63.2...v2.63.3) From f5cbdd2940ecf15c62b88ba1939c5304cdedcb1f Mon Sep 17 00:00:00 2001 From: Angel Montenegro Date: Mon, 12 Aug 2024 13:52:02 -0600 Subject: [PATCH 03/21] Increase sequence start (#7065) * Deactivated records should get 409 on GET requests * Sequence should start at 100000 --- .../db/updates/create_profile_email_domain_table.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/orcid-persistence/src/main/resources/db/updates/create_profile_email_domain_table.xml b/orcid-persistence/src/main/resources/db/updates/create_profile_email_domain_table.xml index 9c403245e97..7e741ee3bd7 100644 --- a/orcid-persistence/src/main/resources/db/updates/create_profile_email_domain_table.xml +++ b/orcid-persistence/src/main/resources/db/updates/create_profile_email_domain_table.xml @@ -29,11 +29,11 @@ - + - + From f5cf6113de6021bbdce46019072463303114efea Mon Sep 17 00:00:00 2001 From: github actions Date: Mon, 12 Aug 2024 20:06:28 +0000 Subject: [PATCH 04/21] v2.63.5 changelog update --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fa7bf58f88d..7b623e46a50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## v2.63.5 - 2024-08-12 + +[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.63.4...v2.63.5) + ## v2.63.4 - 2024-08-10 [Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.63.3...v2.63.4) From 559e9e11bf9058909743ca751334897a016b2fa3 Mon Sep 17 00:00:00 2001 From: Angel Montenegro Date: Mon, 12 Aug 2024 17:19:08 -0600 Subject: [PATCH 05/21] Fix sequence for profile email domains (#7066) * Deactivated records should get 409 on GET requests * Sequence should start at 100000 * Fix sequence name in the profile email domain entity id --- .../persistence/jpa/entities/ProfileEmailDomainEntity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/orcid-persistence/src/main/java/org/orcid/persistence/jpa/entities/ProfileEmailDomainEntity.java b/orcid-persistence/src/main/java/org/orcid/persistence/jpa/entities/ProfileEmailDomainEntity.java index 00d53d26cba..c1c9853e6a7 100644 --- a/orcid-persistence/src/main/java/org/orcid/persistence/jpa/entities/ProfileEmailDomainEntity.java +++ b/orcid-persistence/src/main/java/org/orcid/persistence/jpa/entities/ProfileEmailDomainEntity.java @@ -19,7 +19,7 @@ public class ProfileEmailDomainEntity extends BaseEntity { @Id @Column(name = "id") - @GeneratedValue(strategy = GenerationType.AUTO, generator = "event_seq") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "profile_email_domain_seq") @SequenceGenerator(name = "profile_email_domain_seq", sequenceName = "profile_email_domain_seq", allocationSize = 1) public Long getId() { return id; From 350a2212ceb19f02b5755e16c34ae256ab72681c Mon Sep 17 00:00:00 2001 From: github actions Date: Mon, 12 Aug 2024 23:33:18 +0000 Subject: [PATCH 06/21] v2.63.6 changelog update --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b623e46a50..8d0bf03cc2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## v2.63.6 - 2024-08-12 + +[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.63.5...v2.63.6) + ## v2.63.5 - 2024-08-12 [Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.63.4...v2.63.5) From 6da16a7ca47be94dea2d5baff2350e7959a0ecda Mon Sep 17 00:00:00 2001 From: Ken Lui <116421546+kenlhlui@users.noreply.github.com> Date: Tue, 13 Aug 2024 15:30:44 -0400 Subject: [PATCH 07/21] 1. Fixed the correct query string first 10 resutls. The original `start=1` skips the actual first reocrd, making the result showing the first 2 - 11 records. --- orcid-api-web/tutorial/search.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/orcid-api-web/tutorial/search.md b/orcid-api-web/tutorial/search.md index e552157b641..76c67671eda 100644 --- a/orcid-api-web/tutorial/search.md +++ b/orcid-api-web/tutorial/search.md @@ -402,7 +402,7 @@ Description: Search for records modified between January 1, 2018 and today Paging: First 10 results -URL: ```https://pub.sandbox.orcid.org/v3.0/search/?q=profile-last-modified-date:%5B2018-01-01T00:00:00Z%20TO%20NOW%5D&start=1&rows=10``` +URL: ```https://pub.sandbox.orcid.org/v3.0/search/?q=profile-last-modified-date:%5B2018-01-01T00:00:00Z%20TO%20NOW%5D&start=0&rows=10``` ### Example 14 From a9ed2fd7af2df56203cdc1ebc412172ee182fc22 Mon Sep 17 00:00:00 2001 From: Angel Montenegro Date: Tue, 13 Aug 2024 14:49:20 -0600 Subject: [PATCH 08/21] Set default visibility when more than one email have same domain (#7068) * Deactivated records should get 409 on GET requests * Sequence should start at 100000 * When more than one emails with the same domain are verified, the default visibility should match the less restrictive from the verified emails --- .../impl/ProfileEmailDomainManagerImpl.java | 45 +++++++++++++++++-- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/orcid-core/src/main/java/org/orcid/core/manager/v3/impl/ProfileEmailDomainManagerImpl.java b/orcid-core/src/main/java/org/orcid/core/manager/v3/impl/ProfileEmailDomainManagerImpl.java index dbb8db060e3..c2eb6ae2eb9 100644 --- a/orcid-core/src/main/java/org/orcid/core/manager/v3/impl/ProfileEmailDomainManagerImpl.java +++ b/orcid-core/src/main/java/org/orcid/core/manager/v3/impl/ProfileEmailDomainManagerImpl.java @@ -8,7 +8,10 @@ import org.orcid.persistence.dao.EmailDomainDao; import org.orcid.persistence.dao.ProfileEmailDomainDao; import org.orcid.persistence.jpa.entities.EmailDomainEntity; +import org.orcid.persistence.jpa.entities.EmailEntity; import org.orcid.persistence.jpa.entities.ProfileEmailDomainEntity; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; @@ -20,14 +23,16 @@ * */ public class ProfileEmailDomainManagerImpl extends ProfileEmailDomainManagerReadOnlyImpl implements ProfileEmailDomainManager { + private static final Logger LOGGER = LoggerFactory.getLogger(ProfileEmailDomainManagerImpl.class); + @Resource protected ProfileEmailDomainDao profileEmailDomainDao; @Resource protected EmailDomainDao emailDomainDao; - @Resource - protected EmailDao emailDao; + @Resource(name = "emailDaoReadOnly") + protected EmailDao emailDaoReadOnly; private static final String DEFAULT_DOMAIN_VISIBILITY = Visibility.PRIVATE.toString().toUpperCase(); @@ -66,13 +71,47 @@ public void updateEmailDomains(String orcid, org.orcid.pojo.ajaxForm.Emails newE public void processDomain(String orcid, String email) { String domain = email.split("@")[1]; EmailDomainEntity domainInfo = emailDomainDao.findByEmailDomain(domain); + String domainVisibility = DEFAULT_DOMAIN_VISIBILITY; // Check if email is professional if (domainInfo != null && domainInfo.getCategory().equals(EmailDomainEntity.DomainCategory.PROFESSIONAL)) { ProfileEmailDomainEntity existingDomain = profileEmailDomainDao.findByEmailDomain(orcid, domain); // ADD NEW DOMAIN IF ONE DOESN'T EXIST if (existingDomain == null) { - profileEmailDomainDao.addEmailDomain(orcid, domain, DEFAULT_DOMAIN_VISIBILITY); + // Verify the user doesn't have more emails with that domain + List existingEmails = emailDaoReadOnly.findByOrcid(orcid, System.currentTimeMillis()); + if(existingEmails != null && existingEmails.size() > 1) { + for(EmailEntity emailEntity : existingEmails) { + //If it is not the same emails that is being verified and it is verified + if(!email.equals(emailEntity.getEmail()) && emailEntity.getVerified()) { + try { + String emailEntityDomain = (emailEntity.getEmail() == null) ? null : (email.split("@")[1]); + // If one of the existing emails have the same domain as the email being verified check the visibility and select the less restrictive + if(domain.equals(emailEntityDomain)){ + String entityVisibility = emailEntity.getVisibility(); + domainVisibility = getLessRestrictiveVisibility(domainVisibility, entityVisibility); + } + } catch (Exception e) { + LOGGER.warn("Could not get email domain from email entity " + emailEntity.getEmail(), e); + } + } + } + } + profileEmailDomainDao.addEmailDomain(orcid, domain, domainVisibility); } } } + + private String getLessRestrictiveVisibility(String a, String b) { + String visibility = DEFAULT_DOMAIN_VISIBILITY; + if(Visibility.PUBLIC.name().equals(a) || Visibility.PUBLIC.name().equals(b)) { + visibility = Visibility.PUBLIC.name(); + } else if(a.equals(b)) { + visibility = a; + } else if(Visibility.PRIVATE.name().equals(a)) { + visibility = b; + } else if(Visibility.PRIVATE.name().equals(b)) { + visibility = a; + } + return visibility; + } } From a56131f42c3bdca70646d9743dcc5896ce789f99 Mon Sep 17 00:00:00 2001 From: github actions Date: Tue, 13 Aug 2024 21:03:36 +0000 Subject: [PATCH 09/21] v2.63.7 changelog update --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d0bf03cc2e..c369c7284ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## v2.63.7 - 2024-08-13 + +[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.63.6...v2.63.7) + ## v2.63.6 - 2024-08-12 [Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.63.5...v2.63.6) From 48a69e0f5d2f16ffc97a60ab9f634958a19e5625 Mon Sep 17 00:00:00 2001 From: github actions Date: Wed, 14 Aug 2024 17:28:33 +0000 Subject: [PATCH 10/21] v2.63.8 changelog update --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c369c7284ca..b517af81b7d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## v2.63.8 - 2024-08-14 + +[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.63.7...v2.63.8) + +- [#7067](https://github.com/ORCID/ORCID-Source/pull/7067): 1. Fixed the correct query string for showing first 10 resutls. + ## v2.63.7 - 2024-08-13 [Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.63.6...v2.63.7) From 41441ee12cf023511bb4ee6404f8401589919d36 Mon Sep 17 00:00:00 2001 From: Angel Montenegro Date: Fri, 16 Aug 2024 17:20:45 -0600 Subject: [PATCH 11/21] Update README.md (#7064) --- orcid-api-web/README.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/orcid-api-web/README.md b/orcid-api-web/README.md index e8598408ce8..f6543081f97 100644 --- a/orcid-api-web/README.md +++ b/orcid-api-web/README.md @@ -135,11 +135,7 @@ See the current [XSD documentation](https://github.com/ORCID/orcid-model/blob/ma ## API Limits -**v1.2** -* Request a second - 8 -* Burst - 40 - -**v2.0 and above** +**v2.0, v2.1 and v3.0** * Request a second - 24 * Burst - 40 From 8cfb7d81e75f337f9d8b82ac3b71432f74c08bfa Mon Sep 17 00:00:00 2001 From: github actions Date: Fri, 16 Aug 2024 23:34:59 +0000 Subject: [PATCH 12/21] v2.63.9 changelog update --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b517af81b7d..c9b45e4a38b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## v2.63.9 - 2024-08-16 + +[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.63.8...v2.63.9) + ## v2.63.8 - 2024-08-14 [Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.63.7...v2.63.8) From 9a645498d4536239e55fea93c7d0b735687ab4c2 Mon Sep 17 00:00:00 2001 From: Angel Montenegro Date: Thu, 22 Aug 2024 13:13:53 -0600 Subject: [PATCH 13/21] Email domain fix bug on public page (#7069) * Deactivated records should get 409 on GET requests * Sequence should start at 100000 * On the public page, we should use the orcid and not the getCurrentUserOrcid function --- .../orcid/frontend/web/controllers/PublicRecordController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/PublicRecordController.java b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/PublicRecordController.java index 733c6f3dfcc..feb81265199 100644 --- a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/PublicRecordController.java +++ b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/PublicRecordController.java @@ -200,7 +200,7 @@ PublicRecord getRecord(String orcid) { // Fill email domains List emailDomains = null; if (Features.EMAIL_DOMAINS.isActive()) { - emailDomains = profileEmailDomainManagerReadOnly.getPublicEmailDomains(getCurrentUserOrcid()); + emailDomains = profileEmailDomainManagerReadOnly.getPublicEmailDomains(orcid); } publicRecord.setEmails(org.orcid.pojo.ajaxForm.Emails.valueOf(filteredEmails, emailDomains)); From c77e19fdd25ae7f2ee10b89c1dce3ada43703093 Mon Sep 17 00:00:00 2001 From: github actions Date: Thu, 22 Aug 2024 19:28:11 +0000 Subject: [PATCH 14/21] v2.63.10 changelog update --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c9b45e4a38b..40946c2f0ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## v2.63.10 - 2024-08-22 + +[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.63.9...v2.63.10) + ## v2.63.9 - 2024-08-16 [Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.63.8...v2.63.9) From c9d9f39aadb6ed87b0b51c320c89c89122235742 Mon Sep 17 00:00:00 2001 From: github actions Date: Thu, 22 Aug 2024 20:22:27 +0000 Subject: [PATCH 15/21] v2.64.0 changelog update --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 40946c2f0ed..f077f5503b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## v2.64.0 - 2024-08-22 + +[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.63.10...v2.64.0) + ## v2.63.10 - 2024-08-22 [Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.63.9...v2.63.10) From a56f64962b84201bd586114ae597013a16f495bf Mon Sep 17 00:00:00 2001 From: Camelia Dumitru <62257307+Camelia-Orcid@users.noreply.github.com> Date: Mon, 26 Aug 2024 17:03:43 +0100 Subject: [PATCH 16/21] Added the profile email domain view, as well as fixed the notification view include (#7073) --- .../src/main/resources/db-master.xml | 3 ++- .../db/updates/create_dw_notification.xml | 2 +- .../create_dw_profile_email_domain.xml | 19 +++++++++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 orcid-persistence/src/main/resources/db/updates/create_dw_profile_email_domain.xml diff --git a/orcid-persistence/src/main/resources/db-master.xml b/orcid-persistence/src/main/resources/db-master.xml index c2e1fa5b644..3f0df9ca962 100644 --- a/orcid-persistence/src/main/resources/db-master.xml +++ b/orcid-persistence/src/main/resources/db-master.xml @@ -401,5 +401,6 @@ - + + \ No newline at end of file diff --git a/orcid-persistence/src/main/resources/db/updates/create_dw_notification.xml b/orcid-persistence/src/main/resources/db/updates/create_dw_notification.xml index 0af7616159d..d24ebb42a5e 100644 --- a/orcid-persistence/src/main/resources/db/updates/create_dw_notification.xml +++ b/orcid-persistence/src/main/resources/db/updates/create_dw_notification.xml @@ -5,7 +5,7 @@ - select notification_type, orcid, client_source_id, date_created, sent_date, read_date, actioned_date, archived_date, last_modified + select id as db_id, notification_type, orcid, client_source_id, date_created, sent_date, read_date, actioned_date, archived_date, last_modified from notification where notification_type='PERMISSION' and client_source_id is not null and last_modified > date_trunc('day',(now() - interval '12 months')) diff --git a/orcid-persistence/src/main/resources/db/updates/create_dw_profile_email_domain.xml b/orcid-persistence/src/main/resources/db/updates/create_dw_profile_email_domain.xml new file mode 100644 index 00000000000..00dcb15d2d5 --- /dev/null +++ b/orcid-persistence/src/main/resources/db/updates/create_dw_profile_email_domain.xml @@ -0,0 +1,19 @@ + + + + + + select id as db_id, orcid, email_domain, visibility,date_created, last_modified from profile_email_domain where last_modified > date_trunc('day',(now() - interval '4 months')) + + + + + + SELECT 1 FROM pg_roles WHERE rolname='dw_user' + + GRANT SELECT ON TABLE dw_profile_email_domain to dw_user; + + + \ No newline at end of file From 50850de4c443e22fbfb91f7d73466a8d6c2f6b7e Mon Sep 17 00:00:00 2001 From: github actions Date: Mon, 26 Aug 2024 16:19:57 +0000 Subject: [PATCH 17/21] v2.64.1 changelog update --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f077f5503b9..de8081169df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## v2.64.1 - 2024-08-26 + +[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.64.0...v2.64.1) + ## v2.64.0 - 2024-08-22 [Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.63.10...v2.64.0) From a290129ba0318b4956023632abacd2027dc65f14 Mon Sep 17 00:00:00 2001 From: Camelia Dumitru <62257307+Camelia-Orcid@users.noreply.github.com> Date: Wed, 28 Aug 2024 01:07:25 +0100 Subject: [PATCH 18/21] Refactor the code to include the DateUtils under orcid-utils package (#7071) * Refactor the code to include the DateUtils under orcid-utils package * Refactored StringUtils from core and persistence packages under utils --------- Co-authored-by: Angel Montenegro --- .../common/filter/ApiVersionCheckFilter.java | 2 +- .../filter/DefaultApiVersionFilter.java | 2 +- .../api/common/filter/TokenTargetFilter.java | 2 +- .../api/common/jaxb/OrcidExceptionMapper.java | 4 +- .../oauth/RevokeTokenEndpointFilter.java | 2 +- .../NotificationsApiServiceDelegatorImpl.java | 2 +- ...erviceDelegator_ActivitiesSummaryTest.java | 2 +- ...mberV2ApiServiceDelegator_GroupIdTest.java | 2 +- ...MemberV2ApiServiceDelegator_WorksTest.java | 2 +- ...erviceDelegator_ActivitiesSummaryTest.java | 2 +- ...mberV3ApiServiceDelegator_GroupIdTest.java | 2 +- ...MemberV3ApiServiceDelegator_WorksTest.java | 2 +- orcid-core/pom.xml | 7 +- .../adapter/impl/MapperFacadeFactory.java | 2 +- .../core/aop/ProfileLastModifiedAspect.java | 2 +- .../core/cli/CreateNewClientSecrets.java | 4 +- .../core/cli/DeleteWorkByIdentifier.java | 2 +- .../cli/FindGroupsWithMixedVisibility.java | 2 +- .../org/orcid/core/cli/ReindexProfiles.java | 2 +- .../core/cli/anonymize/AnonymizeText.java | 2 +- .../core/cli/anonymize/WorkPojoFromCsv.java | 2 +- .../orcid/core/locale/LocaleManagerImpl.java | 2 +- .../manager/impl/EncryptionManagerImpl.java | 2 +- .../impl/GroupIdRecordManagerImpl.java | 2 +- .../impl/OrcidSecurityManagerImpl.java | 2 +- .../core/manager/impl/OrgManagerImpl.java | 2 +- .../impl/BiographyManagerReadOnlyImpl.java | 2 +- .../PersonalDetailsManagerReadOnlyImpl.java | 2 +- .../impl/RecordManagerReadOnlyImpl.java | 2 +- .../v3/impl/GroupIdRecordManagerImpl.java | 2 +- .../manager/v3/impl/MembersManagerImpl.java | 2 +- .../v3/impl/OrcidSecurityManagerImpl.java | 2 +- .../impl/BiographyManagerReadOnlyImpl.java | 2 +- .../impl/EmailManagerReadOnlyImpl.java | 2 +- .../GivenPermissionToManagerReadOnlyImpl.java | 2 +- .../PersonalDetailsManagerReadOnlyImpl.java | 2 +- .../impl/RecordManagerReadOnlyImpl.java | 2 +- .../v3/validator/ActivityValidator.java | 2 +- .../manager/validator/ActivityValidator.java | 2 +- .../orcid/core/orgs/grouping/OrgGrouping.java | 2 +- .../security/DefaultPermissionChecker.java | 2 +- .../security/OrcidUserDetailsServiceImpl.java | 2 +- .../java/org/orcid/core/utils/DateUtils.java | 162 ------------------ .../orcid/core/utils/PasswordResetToken.java | 3 + .../orcid/core/utils/ReleaseNameUtils.java | 2 + .../orcid/core/utils/VerifyEmailUtils.java | 2 + .../core/utils/VerifyRegistrationToken.java | 2 +- .../v3/identifiers/resolvers/DOIResolver.java | 2 +- .../orcid/pojo/ajaxForm/AffiliationForm.java | 2 +- .../java/org/orcid/pojo/ajaxForm/Date.java | 2 +- .../org/orcid/pojo/ajaxForm/KeywordForm.java | 2 +- .../java/org/orcid/pojo/ajaxForm/Text.java | 2 +- .../org/orcid/pojo/ajaxForm/WorkForm.java | 4 +- ...orkExternalIdentifiersConverterV2Test.java | 2 +- ...orkExternalIdentifiersConverterV3Test.java | 2 +- .../v2/latest/JpaJaxbAddressAdapterTest.java | 2 +- .../latest/JpaJaxbEducationAdapterTest.java | 2 +- .../v2/latest/JpaJaxbEmailAdapterTest.java | 2 +- .../latest/JpaJaxbEmploymentAdapterTest.java | 2 +- .../JpaJaxbExternalIdentifierAdapterTest.java | 2 +- .../v2/latest/JpaJaxbFundingAdapterTest.java | 2 +- .../v2/latest/JpaJaxbKeywordAdapterTest.java | 2 +- .../v2/latest/JpaJaxbNameAdapterTest.java | 2 +- .../JpaJaxbNotificationAdapterTest.java | 2 +- .../latest/JpaJaxbOtherNameAdapterTest.java | 2 +- .../latest/JpaJaxbPeerReviewAdapterTest.java | 2 +- .../JpaJaxbResearcherUrlAdapterTest.java | 2 +- .../v2/latest/JpaJaxbWorkAdapterTest.java | 2 +- .../adapter/v3/JpaJaxbAddressAdapterTest.java | 2 +- .../adapter/v3/JpaJaxbClientAdapterTest.java | 2 +- .../v3/JpaJaxbDistinctionAdapterTest.java | 2 +- .../v3/JpaJaxbEducationAdapterTest.java | 2 +- .../adapter/v3/JpaJaxbEmailAdapterTest.java | 2 +- .../v3/JpaJaxbEmploymentAdapterTest.java | 2 +- .../JpaJaxbExternalIdentifierAdapterTest.java | 2 +- .../adapter/v3/JpaJaxbFundingAdapterTest.java | 2 +- .../v3/JpaJaxbInvitedPositionAdapterTest.java | 2 +- .../adapter/v3/JpaJaxbKeywordAdapterTest.java | 2 +- .../v3/JpaJaxbMembershipAdapterTest.java | 2 +- .../adapter/v3/JpaJaxbNameAdapterTest.java | 2 +- .../v3/JpaJaxbNotificationAdapterTest.java | 2 +- .../v3/JpaJaxbOtherNameAdapterTest.java | 2 +- .../v3/JpaJaxbPeerReviewAdapterTest.java | 2 +- .../v3/JpaJaxbQualificationAdapterTest.java | 2 +- .../JpaJaxbResearchResourceAdapterTest.java | 2 +- .../v3/JpaJaxbResearcherUrlAdapterTest.java | 2 +- .../adapter/v3/JpaJaxbServiceAdapterTest.java | 2 +- .../adapter/v3/JpaJaxbWorkAdapterTest.java | 2 +- .../impl/RegistrationManagerImplTest.java | 2 +- .../core/manager/v3/EmailManagerTest.java | 2 +- .../core/manager/v3/MembersManagerTest.java | 2 +- .../org/orcid/core/utils/DateUtilsTest.java | 2 +- .../core/utils/OrcidStringUtilsTest.java | 2 +- .../ajaxForm/AffiliationFormTestBase.java | 2 +- .../org/orcid/pojo/ajaxForm/PojoUtilTest.java | 2 +- orcid-persistence/pom.xml | 7 +- .../jpa/entities/BaseContributorEntity.java | 10 +- .../jpa/entities/ClientSecretEntity.java | 4 +- .../OrgAffiliationRelationEntity.java | 26 +-- .../jpa/entities/PeerReviewEntity.java | 11 +- .../jpa/entities/ProfileFundingEntity.java | 21 +-- .../persistence/util/OrcidStringUtils.java | 53 ------ .../autospam/cli/AutoLockSpamRecords.java | 3 +- .../scheduler/email/cli/SendBadOrgsEmail.java | 2 +- .../cli/manager/EmailMessageSenderTest.java | 2 +- orcid-utils/pom.xml | 8 + .../main/java/org/orcid}/utils/NullUtils.java | 2 +- .../org/orcid}/utils/OrcidStringUtils.java | 6 +- .../frontend/cli/AutoLockSpamRecords.java | 2 +- .../spring/OrcidAuthenticationProvider.java | 2 +- .../web/controllers/AdminController.java | 2 +- .../web/controllers/BaseController.java | 2 +- .../web/controllers/ClaimController.java | 2 +- .../web/controllers/ClientsController.java | 2 +- .../controllers/DeveloperToolsController.java | 2 +- .../controllers/EmailDomainController.java | 2 +- .../web/controllers/HomeController.java | 2 +- .../controllers/ManageProfileController.java | 2 +- .../OauthRegistrationController.java | 2 +- .../controllers/PasswordResetController.java | 2 +- .../controllers/RegistrationController.java | 2 +- .../web/controllers/SpamController.java | 2 +- .../web/controllers/helper/OauthHelper.java | 2 +- .../orcid/pojo/ajaxForm/WorkFormTest.java | 2 +- .../ManageProfileControllerTest.java | 2 +- 125 files changed, 174 insertions(+), 377 deletions(-) delete mode 100644 orcid-core/src/main/java/org/orcid/core/utils/DateUtils.java delete mode 100644 orcid-persistence/src/main/java/org/orcid/persistence/util/OrcidStringUtils.java rename {orcid-core/src/main/java/org/orcid/core => orcid-utils/src/main/java/org/orcid}/utils/NullUtils.java (97%) rename {orcid-core/src/main/java/org/orcid/core => orcid-utils/src/main/java/org/orcid}/utils/OrcidStringUtils.java (96%) diff --git a/orcid-api-common/src/main/java/org/orcid/api/common/filter/ApiVersionCheckFilter.java b/orcid-api-common/src/main/java/org/orcid/api/common/filter/ApiVersionCheckFilter.java index c3716a70a82..dd04afa2a40 100644 --- a/orcid-api-common/src/main/java/org/orcid/api/common/filter/ApiVersionCheckFilter.java +++ b/orcid-api-common/src/main/java/org/orcid/api/common/filter/ApiVersionCheckFilter.java @@ -12,8 +12,8 @@ import org.orcid.core.exception.OrcidBadRequestException; import org.orcid.core.locale.LocaleManager; import org.orcid.core.manager.impl.OrcidUrlManager; -import org.orcid.core.utils.OrcidStringUtils; import org.orcid.pojo.ajaxForm.PojoUtil; +import org.orcid.utils.OrcidStringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMethod; diff --git a/orcid-api-common/src/main/java/org/orcid/api/common/filter/DefaultApiVersionFilter.java b/orcid-api-common/src/main/java/org/orcid/api/common/filter/DefaultApiVersionFilter.java index 1850c50e5d4..bd7538716d8 100644 --- a/orcid-api-common/src/main/java/org/orcid/api/common/filter/DefaultApiVersionFilter.java +++ b/orcid-api-common/src/main/java/org/orcid/api/common/filter/DefaultApiVersionFilter.java @@ -22,9 +22,9 @@ import org.orcid.core.manager.impl.OrcidUrlManager; import org.orcid.core.togglz.Features; import org.orcid.core.utils.JsonUtils; -import org.orcid.core.utils.OrcidStringUtils; import org.orcid.jaxb.model.v3.release.error.OrcidError; import org.orcid.pojo.ajaxForm.PojoUtil; +import org.orcid.utils.OrcidStringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.filter.OncePerRequestFilter; diff --git a/orcid-api-common/src/main/java/org/orcid/api/common/filter/TokenTargetFilter.java b/orcid-api-common/src/main/java/org/orcid/api/common/filter/TokenTargetFilter.java index 43a523d48c5..dd367992c82 100644 --- a/orcid-api-common/src/main/java/org/orcid/api/common/filter/TokenTargetFilter.java +++ b/orcid-api-common/src/main/java/org/orcid/api/common/filter/TokenTargetFilter.java @@ -11,7 +11,7 @@ import org.orcid.core.exception.OrcidUnauthorizedException; import org.orcid.core.oauth.OrcidOauth2TokenDetailService; import org.orcid.persistence.jpa.entities.ProfileEntity; -import org.orcid.core.utils.OrcidStringUtils; +import org.orcid.utils.OrcidStringUtils; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContext; import org.springframework.security.core.context.SecurityContextHolder; diff --git a/orcid-api-common/src/main/java/org/orcid/api/common/jaxb/OrcidExceptionMapper.java b/orcid-api-common/src/main/java/org/orcid/api/common/jaxb/OrcidExceptionMapper.java index 8819b3422f5..0c0621161b0 100644 --- a/orcid-api-common/src/main/java/org/orcid/api/common/jaxb/OrcidExceptionMapper.java +++ b/orcid-api-common/src/main/java/org/orcid/api/common/jaxb/OrcidExceptionMapper.java @@ -27,8 +27,8 @@ import org.orcid.core.manager.impl.OrcidUrlManager; import org.orcid.core.oauth.OAuthError; import org.orcid.core.oauth.OAuthErrorUtils; -import org.orcid.core.utils.DateUtils; -import org.orcid.core.utils.OrcidStringUtils; +import org.orcid.utils.DateUtils; +import org.orcid.utils.OrcidStringUtils; import org.orcid.core.version.ApiSection; import org.orcid.jaxb.model.message.DeprecatedDate; import org.orcid.jaxb.model.message.ErrorDesc; diff --git a/orcid-api-common/src/main/java/org/orcid/api/common/security/oauth/RevokeTokenEndpointFilter.java b/orcid-api-common/src/main/java/org/orcid/api/common/security/oauth/RevokeTokenEndpointFilter.java index af5bfb02083..be3f6fae8a4 100644 --- a/orcid-api-common/src/main/java/org/orcid/api/common/security/oauth/RevokeTokenEndpointFilter.java +++ b/orcid-api-common/src/main/java/org/orcid/api/common/security/oauth/RevokeTokenEndpointFilter.java @@ -11,7 +11,7 @@ import javax.servlet.http.HttpServletResponse; import org.orcid.core.locale.LocaleManager; -import org.orcid.core.utils.OrcidStringUtils; +import org.orcid.utils.OrcidStringUtils; import org.springframework.security.authentication.AuthenticationProvider; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; diff --git a/orcid-api-web/src/main/java/org/orcid/api/notificationsV2/server/delegator/impl/NotificationsApiServiceDelegatorImpl.java b/orcid-api-web/src/main/java/org/orcid/api/notificationsV2/server/delegator/impl/NotificationsApiServiceDelegatorImpl.java index 7afee08a401..0e80bada0a4 100644 --- a/orcid-api-web/src/main/java/org/orcid/api/notificationsV2/server/delegator/impl/NotificationsApiServiceDelegatorImpl.java +++ b/orcid-api-web/src/main/java/org/orcid/api/notificationsV2/server/delegator/impl/NotificationsApiServiceDelegatorImpl.java @@ -31,7 +31,7 @@ import org.orcid.jaxb.model.notification.permission_v2.NotificationPermission; import org.orcid.jaxb.model.notification_v2.Notification; import org.orcid.persistence.jpa.entities.ProfileEntity; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.springframework.beans.factory.annotation.Value; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; diff --git a/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_ActivitiesSummaryTest.java b/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_ActivitiesSummaryTest.java index d596268390f..9143d0ea9a8 100644 --- a/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_ActivitiesSummaryTest.java +++ b/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_ActivitiesSummaryTest.java @@ -51,7 +51,7 @@ import org.orcid.test.DBUnitTest; import org.orcid.test.OrcidJUnit4ClassRunner; import org.orcid.test.helper.Utils; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.springframework.test.context.ContextConfiguration; @RunWith(OrcidJUnit4ClassRunner.class) diff --git a/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_GroupIdTest.java b/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_GroupIdTest.java index f2e4f0d25e3..7287af89772 100644 --- a/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_GroupIdTest.java +++ b/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_GroupIdTest.java @@ -49,7 +49,7 @@ import org.orcid.test.DBUnitTest; import org.orcid.test.OrcidJUnit4ClassRunner; import org.orcid.test.helper.Utils; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.util.ReflectionTestUtils; diff --git a/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_WorksTest.java b/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_WorksTest.java index 4b07fa959f3..ee0ab2c8a08 100644 --- a/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_WorksTest.java +++ b/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_WorksTest.java @@ -75,7 +75,7 @@ import org.orcid.test.OrcidJUnit4ClassRunner; import org.orcid.test.TargetProxyHelper; import org.orcid.test.helper.Utils; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.springframework.beans.factory.annotation.Value; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.test.context.ContextConfiguration; diff --git a/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_ActivitiesSummaryTest.java b/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_ActivitiesSummaryTest.java index be20e8d4250..f21cdb6c516 100644 --- a/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_ActivitiesSummaryTest.java +++ b/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_ActivitiesSummaryTest.java @@ -19,7 +19,7 @@ import org.junit.runner.RunWith; import org.orcid.api.common.util.v3.ActivityUtils; import org.orcid.core.exception.OrcidUnauthorizedException; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.orcid.core.utils.SecurityContextTestUtils; import org.orcid.jaxb.model.groupid_v2.GroupIdRecord; import org.orcid.jaxb.model.message.ScopePathType; diff --git a/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_GroupIdTest.java b/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_GroupIdTest.java index c30dfd7eb4e..bdeb4db805f 100644 --- a/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_GroupIdTest.java +++ b/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_GroupIdTest.java @@ -55,7 +55,7 @@ import org.orcid.test.DBUnitTest; import org.orcid.test.OrcidJUnit4ClassRunner; import org.orcid.test.helper.v3.Utils; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.util.ReflectionTestUtils; diff --git a/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_WorksTest.java b/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_WorksTest.java index 9bc2e126f35..66bfe400818 100644 --- a/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_WorksTest.java +++ b/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_WorksTest.java @@ -81,7 +81,7 @@ import org.orcid.test.OrcidJUnit4ClassRunner; import org.orcid.test.TargetProxyHelper; import org.orcid.test.helper.v3.Utils; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.springframework.beans.factory.annotation.Value; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.test.context.ContextConfiguration; diff --git a/orcid-core/pom.xml b/orcid-core/pom.xml index ba336b43cd6..ece6526400d 100644 --- a/orcid-core/pom.xml +++ b/orcid-core/pom.xml @@ -316,12 +316,7 @@ 2.0.1 - - - org.jsoup - jsoup - 1.15.4 - + javax.ws.rs diff --git a/orcid-core/src/main/java/org/orcid/core/adapter/impl/MapperFacadeFactory.java b/orcid-core/src/main/java/org/orcid/core/adapter/impl/MapperFacadeFactory.java index a68bf4f3b55..734a95b7d2c 100644 --- a/orcid-core/src/main/java/org/orcid/core/adapter/impl/MapperFacadeFactory.java +++ b/orcid-core/src/main/java/org/orcid/core/adapter/impl/MapperFacadeFactory.java @@ -110,7 +110,7 @@ import org.orcid.persistence.jpa.entities.StartDateEntity; import org.orcid.persistence.jpa.entities.WorkEntity; import org.orcid.pojo.ajaxForm.PojoUtil; -import org.orcid.core.utils.OrcidStringUtils; +import org.orcid.utils.OrcidStringUtils; import org.springframework.beans.factory.FactoryBean; import ma.glasnost.orika.CustomMapper; diff --git a/orcid-core/src/main/java/org/orcid/core/aop/ProfileLastModifiedAspect.java b/orcid-core/src/main/java/org/orcid/core/aop/ProfileLastModifiedAspect.java index d7d43cd04a3..dfa98e251f1 100644 --- a/orcid-core/src/main/java/org/orcid/core/aop/ProfileLastModifiedAspect.java +++ b/orcid-core/src/main/java/org/orcid/core/aop/ProfileLastModifiedAspect.java @@ -12,7 +12,7 @@ import org.orcid.persistence.dao.ProfileLastModifiedDao; import org.orcid.persistence.jpa.entities.IndexingStatus; import org.orcid.persistence.jpa.entities.OrcidAware; -import org.orcid.persistence.util.OrcidStringUtils; +import org.orcid.utils.OrcidStringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; diff --git a/orcid-core/src/main/java/org/orcid/core/cli/CreateNewClientSecrets.java b/orcid-core/src/main/java/org/orcid/core/cli/CreateNewClientSecrets.java index 81982a58ef1..21b69a3b35e 100644 --- a/orcid-core/src/main/java/org/orcid/core/cli/CreateNewClientSecrets.java +++ b/orcid-core/src/main/java/org/orcid/core/cli/CreateNewClientSecrets.java @@ -18,8 +18,8 @@ import org.orcid.core.manager.EncryptionManager; import org.orcid.persistence.jpa.entities.ClientDetailsEntity; import org.orcid.persistence.jpa.entities.ClientSecretEntity; -import org.orcid.core.utils.DateUtils; -import org.orcid.core.utils.NullUtils; +import org.orcid.utils.DateUtils; +import org.orcid.utils.NullUtils; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.transaction.TransactionStatus; diff --git a/orcid-core/src/main/java/org/orcid/core/cli/DeleteWorkByIdentifier.java b/orcid-core/src/main/java/org/orcid/core/cli/DeleteWorkByIdentifier.java index b99428f5223..8d9a137942e 100644 --- a/orcid-core/src/main/java/org/orcid/core/cli/DeleteWorkByIdentifier.java +++ b/orcid-core/src/main/java/org/orcid/core/cli/DeleteWorkByIdentifier.java @@ -13,7 +13,7 @@ import org.kohsuke.args4j.Option; import org.orcid.persistence.dao.GenericDao; import org.orcid.persistence.jpa.entities.WorkEntity; -import org.orcid.core.utils.NullUtils; +import org.orcid.utils.NullUtils; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; diff --git a/orcid-core/src/main/java/org/orcid/core/cli/FindGroupsWithMixedVisibility.java b/orcid-core/src/main/java/org/orcid/core/cli/FindGroupsWithMixedVisibility.java index f18bd3c52c2..1af2280d9fc 100644 --- a/orcid-core/src/main/java/org/orcid/core/cli/FindGroupsWithMixedVisibility.java +++ b/orcid-core/src/main/java/org/orcid/core/cli/FindGroupsWithMixedVisibility.java @@ -17,7 +17,7 @@ import org.orcid.jaxb.model.v3.release.record.summary.WorkGroup; import org.orcid.jaxb.model.v3.release.record.summary.WorkSummary; import org.orcid.jaxb.model.v3.release.record.summary.Works; -import org.orcid.core.utils.NullUtils; +import org.orcid.utils.NullUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.ApplicationContext; diff --git a/orcid-core/src/main/java/org/orcid/core/cli/ReindexProfiles.java b/orcid-core/src/main/java/org/orcid/core/cli/ReindexProfiles.java index e16b76be217..0aff903a704 100644 --- a/orcid-core/src/main/java/org/orcid/core/cli/ReindexProfiles.java +++ b/orcid-core/src/main/java/org/orcid/core/cli/ReindexProfiles.java @@ -12,7 +12,7 @@ import org.kohsuke.args4j.Option; import org.orcid.persistence.dao.ProfileDao; import org.orcid.persistence.jpa.entities.IndexingStatus; -import org.orcid.core.utils.NullUtils; +import org.orcid.utils.NullUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.ApplicationContext; diff --git a/orcid-core/src/main/java/org/orcid/core/cli/anonymize/AnonymizeText.java b/orcid-core/src/main/java/org/orcid/core/cli/anonymize/AnonymizeText.java index ea28eb8ed9f..339640ce691 100644 --- a/orcid-core/src/main/java/org/orcid/core/cli/anonymize/AnonymizeText.java +++ b/orcid-core/src/main/java/org/orcid/core/cli/anonymize/AnonymizeText.java @@ -18,8 +18,8 @@ import org.orcid.jaxb.model.v3.release.record.WorkContributors; import org.orcid.pojo.ajaxForm.ActivityExternalIdentifier; import org.orcid.pojo.ajaxForm.PojoUtil; +import org.orcid.utils.OrcidStringUtils; import org.orcid.core.contributors.roles.works.WorkContributorRoleConverter; -import org.orcid.core.utils.OrcidStringUtils; public class AnonymizeText { diff --git a/orcid-core/src/main/java/org/orcid/core/cli/anonymize/WorkPojoFromCsv.java b/orcid-core/src/main/java/org/orcid/core/cli/anonymize/WorkPojoFromCsv.java index fda52399b77..02a1ef512f1 100644 --- a/orcid-core/src/main/java/org/orcid/core/cli/anonymize/WorkPojoFromCsv.java +++ b/orcid-core/src/main/java/org/orcid/core/cli/anonymize/WorkPojoFromCsv.java @@ -12,7 +12,7 @@ import org.orcid.jaxb.model.v3.release.record.ExternalIDs; import org.orcid.jaxb.model.v3.release.record.Work; import org.orcid.pojo.ajaxForm.PojoUtil; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/orcid-core/src/main/java/org/orcid/core/locale/LocaleManagerImpl.java b/orcid-core/src/main/java/org/orcid/core/locale/LocaleManagerImpl.java index 3a1b714962f..57d34c40fc2 100644 --- a/orcid-core/src/main/java/org/orcid/core/locale/LocaleManagerImpl.java +++ b/orcid-core/src/main/java/org/orcid/core/locale/LocaleManagerImpl.java @@ -11,8 +11,8 @@ import org.orcid.core.manager.CountryManager; import org.orcid.jaxb.model.message.OrcidProfile; import org.orcid.persistence.jpa.entities.CountryIsoEntity; +import org.orcid.utils.OrcidStringUtils; import org.orcid.core.utils.FunctionsOverCollections; -import org.orcid.core.utils.OrcidStringUtils; import org.orcid.core.utils.UTF8Control; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.annotation.Cacheable; diff --git a/orcid-core/src/main/java/org/orcid/core/manager/impl/EncryptionManagerImpl.java b/orcid-core/src/main/java/org/orcid/core/manager/impl/EncryptionManagerImpl.java index a7d01787b36..5288c614584 100644 --- a/orcid-core/src/main/java/org/orcid/core/manager/impl/EncryptionManagerImpl.java +++ b/orcid-core/src/main/java/org/orcid/core/manager/impl/EncryptionManagerImpl.java @@ -11,7 +11,7 @@ import org.orcid.core.crypto.DesEncrypter; import org.orcid.core.manager.EncryptionManager; import org.orcid.pojo.ajaxForm.PojoUtil; -import org.orcid.core.utils.OrcidStringUtils; +import org.orcid.utils.OrcidStringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; diff --git a/orcid-core/src/main/java/org/orcid/core/manager/impl/GroupIdRecordManagerImpl.java b/orcid-core/src/main/java/org/orcid/core/manager/impl/GroupIdRecordManagerImpl.java index 7eb87b7ad89..62ede48ca9c 100644 --- a/orcid-core/src/main/java/org/orcid/core/manager/impl/GroupIdRecordManagerImpl.java +++ b/orcid-core/src/main/java/org/orcid/core/manager/impl/GroupIdRecordManagerImpl.java @@ -22,7 +22,7 @@ import org.orcid.jaxb.model.groupid_v2.GroupIdRecord; import org.orcid.persistence.jpa.entities.GroupIdRecordEntity; import org.orcid.persistence.jpa.entities.SourceEntity; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; diff --git a/orcid-core/src/main/java/org/orcid/core/manager/impl/OrcidSecurityManagerImpl.java b/orcid-core/src/main/java/org/orcid/core/manager/impl/OrcidSecurityManagerImpl.java index 039defb9604..2011545cc1d 100644 --- a/orcid-core/src/main/java/org/orcid/core/manager/impl/OrcidSecurityManagerImpl.java +++ b/orcid-core/src/main/java/org/orcid/core/manager/impl/OrcidSecurityManagerImpl.java @@ -56,7 +56,7 @@ import org.orcid.persistence.jpa.entities.ProfileEntity; import org.orcid.persistence.jpa.entities.SourceAwareEntity; import org.orcid.persistence.jpa.entities.SourceEntity; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.springframework.beans.factory.annotation.Value; import org.springframework.security.core.Authentication; import org.springframework.security.core.GrantedAuthority; diff --git a/orcid-core/src/main/java/org/orcid/core/manager/impl/OrgManagerImpl.java b/orcid-core/src/main/java/org/orcid/core/manager/impl/OrgManagerImpl.java index 5380f32da8c..4ba3bbc03ba 100644 --- a/orcid-core/src/main/java/org/orcid/core/manager/impl/OrgManagerImpl.java +++ b/orcid-core/src/main/java/org/orcid/core/manager/impl/OrgManagerImpl.java @@ -9,7 +9,6 @@ import org.orcid.core.manager.OrgManager; import org.orcid.core.manager.SourceManager; import org.orcid.core.manager.read_only.ClientDetailsManagerReadOnly; -import org.orcid.core.utils.OrcidStringUtils; import org.orcid.jaxb.model.common_v2.OrganizationHolder; import org.orcid.jaxb.model.message.Iso3166Country; import org.orcid.jaxb.model.message.Organization; @@ -21,6 +20,7 @@ import org.orcid.persistence.jpa.entities.OrgEntity; import org.orcid.persistence.jpa.entities.ProfileEntity; import org.orcid.persistence.jpa.entities.SourceEntity; +import org.orcid.utils.OrcidStringUtils; import au.com.bytecode.opencsv.CSVWriter; diff --git a/orcid-core/src/main/java/org/orcid/core/manager/read_only/impl/BiographyManagerReadOnlyImpl.java b/orcid-core/src/main/java/org/orcid/core/manager/read_only/impl/BiographyManagerReadOnlyImpl.java index f6867309ef5..1092c82abc7 100644 --- a/orcid-core/src/main/java/org/orcid/core/manager/read_only/impl/BiographyManagerReadOnlyImpl.java +++ b/orcid-core/src/main/java/org/orcid/core/manager/read_only/impl/BiographyManagerReadOnlyImpl.java @@ -7,7 +7,7 @@ import org.orcid.jaxb.model.record_v2.Biography; import org.orcid.persistence.dao.BiographyDao; import org.orcid.persistence.jpa.entities.BiographyEntity; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/orcid-core/src/main/java/org/orcid/core/manager/read_only/impl/PersonalDetailsManagerReadOnlyImpl.java b/orcid-core/src/main/java/org/orcid/core/manager/read_only/impl/PersonalDetailsManagerReadOnlyImpl.java index 1d6f5f7881a..502ac65d179 100644 --- a/orcid-core/src/main/java/org/orcid/core/manager/read_only/impl/PersonalDetailsManagerReadOnlyImpl.java +++ b/orcid-core/src/main/java/org/orcid/core/manager/read_only/impl/PersonalDetailsManagerReadOnlyImpl.java @@ -15,7 +15,7 @@ import org.orcid.jaxb.model.record_v2.OtherName; import org.orcid.jaxb.model.record_v2.OtherNames; import org.orcid.jaxb.model.record_v2.PersonalDetails; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; /** * diff --git a/orcid-core/src/main/java/org/orcid/core/manager/read_only/impl/RecordManagerReadOnlyImpl.java b/orcid-core/src/main/java/org/orcid/core/manager/read_only/impl/RecordManagerReadOnlyImpl.java index 2bef77bf706..d797f3f5fb0 100644 --- a/orcid-core/src/main/java/org/orcid/core/manager/read_only/impl/RecordManagerReadOnlyImpl.java +++ b/orcid-core/src/main/java/org/orcid/core/manager/read_only/impl/RecordManagerReadOnlyImpl.java @@ -28,7 +28,7 @@ import org.orcid.jaxb.model.record_v2.SubmissionDate; import org.orcid.persistence.jpa.entities.ProfileEntity; import org.orcid.pojo.ajaxForm.PojoUtil; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/orcid-core/src/main/java/org/orcid/core/manager/v3/impl/GroupIdRecordManagerImpl.java b/orcid-core/src/main/java/org/orcid/core/manager/v3/impl/GroupIdRecordManagerImpl.java index 82f7435983a..9e75ee8e5dc 100644 --- a/orcid-core/src/main/java/org/orcid/core/manager/v3/impl/GroupIdRecordManagerImpl.java +++ b/orcid-core/src/main/java/org/orcid/core/manager/v3/impl/GroupIdRecordManagerImpl.java @@ -22,7 +22,7 @@ import org.orcid.jaxb.model.v3.release.groupid.GroupIdRecord; import org.orcid.persistence.jpa.entities.GroupIdRecordEntity; import org.orcid.persistence.jpa.entities.SourceEntity; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; diff --git a/orcid-core/src/main/java/org/orcid/core/manager/v3/impl/MembersManagerImpl.java b/orcid-core/src/main/java/org/orcid/core/manager/v3/impl/MembersManagerImpl.java index 93ecee8648c..57d0cc675cb 100644 --- a/orcid-core/src/main/java/org/orcid/core/manager/v3/impl/MembersManagerImpl.java +++ b/orcid-core/src/main/java/org/orcid/core/manager/v3/impl/MembersManagerImpl.java @@ -24,7 +24,6 @@ import org.orcid.core.manager.v3.SourceManager; import org.orcid.core.manager.v3.read_only.ClientManagerReadOnly; import org.orcid.core.security.OrcidWebRole; -import org.orcid.core.utils.OrcidStringUtils; import org.orcid.jaxb.model.clientgroup.ClientType; import org.orcid.jaxb.model.clientgroup.MemberType; import org.orcid.jaxb.model.message.CreationMethod; @@ -47,6 +46,7 @@ import org.orcid.pojo.ajaxForm.Member; import org.orcid.pojo.ajaxForm.PojoUtil; import org.orcid.pojo.ajaxForm.Text; +import org.orcid.utils.OrcidStringUtils; import org.springframework.transaction.TransactionStatus; import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.support.TransactionCallbackWithoutResult; diff --git a/orcid-core/src/main/java/org/orcid/core/manager/v3/impl/OrcidSecurityManagerImpl.java b/orcid-core/src/main/java/org/orcid/core/manager/v3/impl/OrcidSecurityManagerImpl.java index 5067b4195e3..49d2a35ec90 100644 --- a/orcid-core/src/main/java/org/orcid/core/manager/v3/impl/OrcidSecurityManagerImpl.java +++ b/orcid-core/src/main/java/org/orcid/core/manager/v3/impl/OrcidSecurityManagerImpl.java @@ -63,7 +63,7 @@ import org.orcid.persistence.jpa.entities.ProfileEntity; import org.orcid.persistence.jpa.entities.SourceAwareEntity; import org.orcid.persistence.jpa.entities.SourceEntity; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.springframework.beans.factory.annotation.Value; import org.springframework.security.core.Authentication; import org.springframework.security.core.GrantedAuthority; diff --git a/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/impl/BiographyManagerReadOnlyImpl.java b/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/impl/BiographyManagerReadOnlyImpl.java index b6424478255..d5b593fa2bc 100644 --- a/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/impl/BiographyManagerReadOnlyImpl.java +++ b/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/impl/BiographyManagerReadOnlyImpl.java @@ -7,7 +7,7 @@ import org.orcid.jaxb.model.v3.release.record.Biography; import org.orcid.persistence.dao.BiographyDao; import org.orcid.persistence.jpa.entities.BiographyEntity; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/impl/EmailManagerReadOnlyImpl.java b/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/impl/EmailManagerReadOnlyImpl.java index d564337e081..6dbf3888dd9 100644 --- a/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/impl/EmailManagerReadOnlyImpl.java +++ b/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/impl/EmailManagerReadOnlyImpl.java @@ -24,7 +24,7 @@ import org.orcid.persistence.jpa.entities.EmailEntity; import org.orcid.pojo.EmailFrequencyOptions; import org.orcid.pojo.ajaxForm.PojoUtil; -import org.orcid.core.utils.OrcidStringUtils; +import org.orcid.utils.OrcidStringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/impl/GivenPermissionToManagerReadOnlyImpl.java b/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/impl/GivenPermissionToManagerReadOnlyImpl.java index 9407f53275d..bff0477f981 100644 --- a/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/impl/GivenPermissionToManagerReadOnlyImpl.java +++ b/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/impl/GivenPermissionToManagerReadOnlyImpl.java @@ -13,7 +13,7 @@ import org.orcid.persistence.jpa.entities.GivenPermissionToEntity; import org.orcid.pojo.DelegateForm; import org.orcid.pojo.ajaxForm.Text; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.springframework.cache.annotation.Cacheable; public class GivenPermissionToManagerReadOnlyImpl extends ManagerReadOnlyBaseImpl implements GivenPermissionToManagerReadOnly { diff --git a/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/impl/PersonalDetailsManagerReadOnlyImpl.java b/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/impl/PersonalDetailsManagerReadOnlyImpl.java index ac425f95c8f..fec622b2869 100644 --- a/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/impl/PersonalDetailsManagerReadOnlyImpl.java +++ b/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/impl/PersonalDetailsManagerReadOnlyImpl.java @@ -15,7 +15,7 @@ import org.orcid.jaxb.model.v3.release.record.OtherName; import org.orcid.jaxb.model.v3.release.record.OtherNames; import org.orcid.jaxb.model.v3.release.record.PersonalDetails; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; /** * diff --git a/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/impl/RecordManagerReadOnlyImpl.java b/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/impl/RecordManagerReadOnlyImpl.java index c10ca1e3ad0..efb9a5bcba7 100644 --- a/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/impl/RecordManagerReadOnlyImpl.java +++ b/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/impl/RecordManagerReadOnlyImpl.java @@ -9,7 +9,7 @@ import org.orcid.core.manager.v3.read_only.EmailManagerReadOnly; import org.orcid.core.manager.v3.read_only.PersonDetailsManagerReadOnly; import org.orcid.core.manager.v3.read_only.RecordManagerReadOnly; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.orcid.core.utils.SourceEntityUtils; import org.orcid.jaxb.model.common.AvailableLocales; import org.orcid.jaxb.model.common.OrcidType; diff --git a/orcid-core/src/main/java/org/orcid/core/manager/v3/validator/ActivityValidator.java b/orcid-core/src/main/java/org/orcid/core/manager/v3/validator/ActivityValidator.java index b0d4fdbbe66..2740e0e3cbe 100644 --- a/orcid-core/src/main/java/org/orcid/core/manager/v3/validator/ActivityValidator.java +++ b/orcid-core/src/main/java/org/orcid/core/manager/v3/validator/ActivityValidator.java @@ -68,7 +68,7 @@ import org.orcid.jaxb.model.v3.release.record.WorkTitle; import org.orcid.persistence.jpa.entities.SourceEntity; import org.orcid.pojo.ajaxForm.PojoUtil; -import org.orcid.core.utils.OrcidStringUtils; +import org.orcid.utils.OrcidStringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/orcid-core/src/main/java/org/orcid/core/manager/validator/ActivityValidator.java b/orcid-core/src/main/java/org/orcid/core/manager/validator/ActivityValidator.java index a4c50219c31..f4e86b931f0 100644 --- a/orcid-core/src/main/java/org/orcid/core/manager/validator/ActivityValidator.java +++ b/orcid-core/src/main/java/org/orcid/core/manager/validator/ActivityValidator.java @@ -58,7 +58,7 @@ import org.orcid.jaxb.model.record_v2.WorkType; import org.orcid.persistence.jpa.entities.SourceEntity; import org.orcid.pojo.ajaxForm.PojoUtil; -import org.orcid.core.utils.OrcidStringUtils; +import org.orcid.utils.OrcidStringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/orcid-core/src/main/java/org/orcid/core/orgs/grouping/OrgGrouping.java b/orcid-core/src/main/java/org/orcid/core/orgs/grouping/OrgGrouping.java index f656fc5296e..103cb43feb1 100644 --- a/orcid-core/src/main/java/org/orcid/core/orgs/grouping/OrgGrouping.java +++ b/orcid-core/src/main/java/org/orcid/core/orgs/grouping/OrgGrouping.java @@ -21,8 +21,8 @@ import org.orcid.pojo.OrgDisambiguated; import org.orcid.pojo.OrgDisambiguatedExternalIdentifiers; import org.orcid.pojo.grouping.OrgGroup; +import org.orcid.utils.OrcidStringUtils; import org.orcid.core.utils.FunderIdentifierType; -import org.orcid.core.utils.OrcidStringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; diff --git a/orcid-core/src/main/java/org/orcid/core/security/DefaultPermissionChecker.java b/orcid-core/src/main/java/org/orcid/core/security/DefaultPermissionChecker.java index b8abd132e20..a338652ad67 100644 --- a/orcid-core/src/main/java/org/orcid/core/security/DefaultPermissionChecker.java +++ b/orcid-core/src/main/java/org/orcid/core/security/DefaultPermissionChecker.java @@ -20,7 +20,7 @@ import org.orcid.core.manager.ProfileEntityManager; import org.orcid.core.oauth.OrcidOAuth2Authentication; import org.orcid.core.oauth.OrcidOauth2TokenDetailService; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.orcid.jaxb.model.message.OrcidIdentifier; import org.orcid.jaxb.model.message.OrcidMessage; import org.orcid.jaxb.model.message.ScopePathType; diff --git a/orcid-core/src/main/java/org/orcid/core/security/OrcidUserDetailsServiceImpl.java b/orcid-core/src/main/java/org/orcid/core/security/OrcidUserDetailsServiceImpl.java index 814b8d7fb7c..9841f2c7c03 100644 --- a/orcid-core/src/main/java/org/orcid/core/security/OrcidUserDetailsServiceImpl.java +++ b/orcid-core/src/main/java/org/orcid/core/security/OrcidUserDetailsServiceImpl.java @@ -33,7 +33,7 @@ import org.orcid.persistence.dao.ProfileDao; import org.orcid.persistence.jpa.entities.ProfileEntity; import org.orcid.pojo.ajaxForm.PojoUtil; -import org.orcid.core.utils.OrcidStringUtils; +import org.orcid.utils.OrcidStringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; diff --git a/orcid-core/src/main/java/org/orcid/core/utils/DateUtils.java b/orcid-core/src/main/java/org/orcid/core/utils/DateUtils.java deleted file mode 100644 index 41669580d6f..00000000000 --- a/orcid-core/src/main/java/org/orcid/core/utils/DateUtils.java +++ /dev/null @@ -1,162 +0,0 @@ -package org.orcid.core.utils; - -import java.util.Date; -import java.util.GregorianCalendar; -import java.util.HashMap; -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import javax.xml.datatype.DatatypeConfigurationException; -import javax.xml.datatype.DatatypeConstants; -import javax.xml.datatype.DatatypeFactory; -import javax.xml.datatype.XMLGregorianCalendar; - -import org.apache.commons.lang.StringUtils; - -/** - * TODO: Once the jersey migration is over, this should go back to the orcid-utils package so it could be reused form the orcid-persistence package - * Use this instead: https://github.com/ORCID/ORCID-Source/blob/main/orcid-utils/src/main/java/org/orcid/utils/DateUtils.java - */ -@Deprecated -public class DateUtils { - - private static final Pattern DATE_PATTERN = Pattern.compile("(\\d+)(?:-(\\d+))?(?:-(\\d+))?(T\\d\\d:\\d\\d:\\d\\d)?"); - - //Thread safe: see source http://www.docjar.com/html/api/com/sun/org/apache/xerces/internal/jaxp/datatype/DatatypeFactoryImpl.java.html - //see also analysis: http://www.javajirawat.com/2015/09/xmlgregoriancalendar-datatypefactory.html - private static DatatypeFactory dataTypeFactory; - - /** - * @see http - * ://www.crossref.org/schema/info/CrossRefSchemaDocumentation4.1.0.pdf - */ - private static Map seasonsAndQuartersToMonth = new HashMap(); - static { - seasonsAndQuartersToMonth.put("21", "03"); - seasonsAndQuartersToMonth.put("22", "06"); - seasonsAndQuartersToMonth.put("23", "09"); - seasonsAndQuartersToMonth.put("24", "12"); - seasonsAndQuartersToMonth.put("31", "01"); - seasonsAndQuartersToMonth.put("32", "04"); - seasonsAndQuartersToMonth.put("33", "07"); - seasonsAndQuartersToMonth.put("34", "10"); - } - - public static XMLGregorianCalendar convertToXMLGregorianCalendar(String dateString) { - return convertToXMLGregorianCalendar(dateString, true); - } - - public static XMLGregorianCalendar convertToXMLGregorianCalendar(String dateString, boolean tidy) { - String tidyDateString = dateString; - if(tidy) { - tidyDateString = tidy(dateString); - } - if (tidyDateString == null) { - return null; - } - DatatypeFactory dataTypeFactory = createDataTypeFactory(); - try { - return dataTypeFactory.newXMLGregorianCalendar(tidyDateString); - } catch (IllegalArgumentException e) { - return null; - } - } - - public static XMLGregorianCalendar convertToXMLGregorianCalendar(long time) { - GregorianCalendar gregorianCalendar = new GregorianCalendar(); - gregorianCalendar.setTimeInMillis(time); - return convertToXMLGregorianCalendar(gregorianCalendar); - } - - public static XMLGregorianCalendar convertToXMLGregorianCalendar(GregorianCalendar gregorianCalendar) { - return createDataTypeFactory().newXMLGregorianCalendar(gregorianCalendar); - } - - public static XMLGregorianCalendar convertToXMLGregorianCalendar(Date date) { - if (date == null) { - return null; - } - return convertToXMLGregorianCalendar(date.getTime()); - } - - public static XMLGregorianCalendar convertToXMLGregorianCalendarNoTimeZoneNoMillis(Date date) { - XMLGregorianCalendar basicCalender = convertToXMLGregorianCalendar(date); - basicCalender.setTimezone(DatatypeConstants.FIELD_UNDEFINED); - basicCalender.setMillisecond(DatatypeConstants.FIELD_UNDEFINED); - return basicCalender; - } - - public static Date convertToDate(String dateString) { - String tidyDateString = tidy(dateString); - if (tidyDateString == null) { - return null; - } - return convertToXMLGregorianCalendar(tidyDateString).toGregorianCalendar().getTime(); - } - - public static Date convertToDate(XMLGregorianCalendar xmlGregorianCalendar) { - if (xmlGregorianCalendar == null) { - return null; - } - return xmlGregorianCalendar.toGregorianCalendar().getTime(); - } - - private static String tidy(String dateString) { - if (dateString == null) { - return null; - } - Matcher matcher = DATE_PATTERN.matcher(dateString); - if (!matcher.matches()) { - return null; - } - String year = matcher.group(1); - String month = matcher.group(2); - String day = matcher.group(3); - String time = matcher.group(4); - - StringBuilder builder = new StringBuilder(); - builder.append(StringUtils.leftPad(year, 4, '0')); - if (month != null) { - builder.append('-'); - month = mapSeasonsAndQuartersToMonth(month); - builder.append(StringUtils.leftPad(month, 2, '0')); - - } - if (day != null) { - builder.append('-'); - builder.append(StringUtils.leftPad(day, 2, '0')); - } - if (time != null) { - builder.append(time); - } - return builder.toString(); - } - - public static boolean olderThan(Date date, int days) { - return date.getTime() < new Date().getTime() - days * 24 * 60 * 60 * 1000; - } - - private static String mapSeasonsAndQuartersToMonth(String month) { - if (seasonsAndQuartersToMonth.containsKey(month)) { - return seasonsAndQuartersToMonth.get(month); - } else { - return month; - } - } - - private static DatatypeFactory createDataTypeFactory() { - if (dataTypeFactory == null){ - synchronized (DateUtils.class){ - if (dataTypeFactory == null) - try { - dataTypeFactory = DatatypeFactory.newInstance(); - } catch (DatatypeConfigurationException e) { - throw new RuntimeException("Couldn't create org.orcid.test.data type factory", e); - } - } - } - return dataTypeFactory; - } - -} diff --git a/orcid-core/src/main/java/org/orcid/core/utils/PasswordResetToken.java b/orcid-core/src/main/java/org/orcid/core/utils/PasswordResetToken.java index 0aea0978de2..a9efaa96eac 100644 --- a/orcid-core/src/main/java/org/orcid/core/utils/PasswordResetToken.java +++ b/orcid-core/src/main/java/org/orcid/core/utils/PasswordResetToken.java @@ -12,6 +12,9 @@ import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; +import org.orcid.utils.DateUtils; +import org.orcid.utils.NullUtils; + public class PasswordResetToken { // public static final String RESET_TOKEN_DATE_FORMAT = "dd/MM/yyyy HH:mm:ss"; diff --git a/orcid-core/src/main/java/org/orcid/core/utils/ReleaseNameUtils.java b/orcid-core/src/main/java/org/orcid/core/utils/ReleaseNameUtils.java index badf9dbf24b..57b0ff096dd 100644 --- a/orcid-core/src/main/java/org/orcid/core/utils/ReleaseNameUtils.java +++ b/orcid-core/src/main/java/org/orcid/core/utils/ReleaseNameUtils.java @@ -7,6 +7,8 @@ import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; +import org.orcid.utils.DateUtils; + /** * * @author Will Simpson diff --git a/orcid-core/src/main/java/org/orcid/core/utils/VerifyEmailUtils.java b/orcid-core/src/main/java/org/orcid/core/utils/VerifyEmailUtils.java index d1abc34709c..22368423d76 100644 --- a/orcid-core/src/main/java/org/orcid/core/utils/VerifyEmailUtils.java +++ b/orcid-core/src/main/java/org/orcid/core/utils/VerifyEmailUtils.java @@ -17,6 +17,8 @@ import org.springframework.context.MessageSource; import org.springframework.stereotype.Component; +import org.orcid.utils.DateUtils; + @Component public class VerifyEmailUtils { diff --git a/orcid-core/src/main/java/org/orcid/core/utils/VerifyRegistrationToken.java b/orcid-core/src/main/java/org/orcid/core/utils/VerifyRegistrationToken.java index 9744b5f93b3..205727eafb4 100644 --- a/orcid-core/src/main/java/org/orcid/core/utils/VerifyRegistrationToken.java +++ b/orcid-core/src/main/java/org/orcid/core/utils/VerifyRegistrationToken.java @@ -8,7 +8,7 @@ import org.apache.commons.lang.StringUtils; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; -import org.orcid.core.utils.NullUtils; +import org.orcid.utils.NullUtils; /** * diff --git a/orcid-core/src/main/java/org/orcid/core/utils/v3/identifiers/resolvers/DOIResolver.java b/orcid-core/src/main/java/org/orcid/core/utils/v3/identifiers/resolvers/DOIResolver.java index 353c283d1a8..a05868cd6e8 100644 --- a/orcid-core/src/main/java/org/orcid/core/utils/v3/identifiers/resolvers/DOIResolver.java +++ b/orcid-core/src/main/java/org/orcid/core/utils/v3/identifiers/resolvers/DOIResolver.java @@ -20,7 +20,6 @@ import org.orcid.core.exception.UnexpectedResponseCodeException; import org.orcid.core.locale.LocaleManager; import org.orcid.core.manager.IdentifierTypeManager; -import org.orcid.core.utils.OrcidStringUtils; import org.orcid.core.utils.v3.identifiers.PIDNormalizationService; import org.orcid.core.utils.v3.identifiers.PIDResolverCache; import org.orcid.core.utils.v3.identifiers.normalizers.DOINormalizer; @@ -47,6 +46,7 @@ import org.orcid.pojo.PIDResolutionResult; import org.orcid.pojo.WorkExtended; import org.orcid.pojo.ajaxForm.PojoUtil; +import org.orcid.utils.OrcidStringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; diff --git a/orcid-core/src/main/java/org/orcid/pojo/ajaxForm/AffiliationForm.java b/orcid-core/src/main/java/org/orcid/pojo/ajaxForm/AffiliationForm.java index f203c31151a..4065ff8661f 100644 --- a/orcid-core/src/main/java/org/orcid/pojo/ajaxForm/AffiliationForm.java +++ b/orcid-core/src/main/java/org/orcid/pojo/ajaxForm/AffiliationForm.java @@ -33,7 +33,7 @@ import org.orcid.jaxb.model.v3.release.record.summary.QualificationSummary; import org.orcid.jaxb.model.v3.release.record.summary.ServiceSummary; import org.orcid.pojo.OrgDisambiguatedExternalIdentifiers; -import org.orcid.core.utils.OrcidStringUtils; +import org.orcid.utils.OrcidStringUtils; public class AffiliationForm extends VisibilityForm implements ErrorsInterface, Serializable { diff --git a/orcid-core/src/main/java/org/orcid/pojo/ajaxForm/Date.java b/orcid-core/src/main/java/org/orcid/pojo/ajaxForm/Date.java index a9c4f1d4964..bff2ca60bdc 100644 --- a/orcid-core/src/main/java/org/orcid/pojo/ajaxForm/Date.java +++ b/orcid-core/src/main/java/org/orcid/pojo/ajaxForm/Date.java @@ -13,7 +13,7 @@ import org.orcid.jaxb.model.v3.release.common.LastModifiedDate; import org.orcid.jaxb.model.v3.release.common.Month; import org.orcid.jaxb.model.v3.release.common.Year; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; public class Date implements ErrorsInterface, Required, Serializable, Comparable { diff --git a/orcid-core/src/main/java/org/orcid/pojo/ajaxForm/KeywordForm.java b/orcid-core/src/main/java/org/orcid/pojo/ajaxForm/KeywordForm.java index 69cba085e2d..3e02ed87b79 100644 --- a/orcid-core/src/main/java/org/orcid/pojo/ajaxForm/KeywordForm.java +++ b/orcid-core/src/main/java/org/orcid/pojo/ajaxForm/KeywordForm.java @@ -9,7 +9,7 @@ import org.orcid.jaxb.model.v3.release.common.LastModifiedDate; import org.orcid.jaxb.model.v3.release.common.Source; import org.orcid.jaxb.model.v3.release.record.Keyword; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; /** * diff --git a/orcid-core/src/main/java/org/orcid/pojo/ajaxForm/Text.java b/orcid-core/src/main/java/org/orcid/pojo/ajaxForm/Text.java index f865ab6dc37..5ffbca7d119 100644 --- a/orcid-core/src/main/java/org/orcid/pojo/ajaxForm/Text.java +++ b/orcid-core/src/main/java/org/orcid/pojo/ajaxForm/Text.java @@ -4,7 +4,7 @@ import java.util.ArrayList; import java.util.List; -import org.orcid.core.utils.OrcidStringUtils; +import org.orcid.utils.OrcidStringUtils; public class Text implements ErrorsInterface, Required, Serializable, Comparable { diff --git a/orcid-core/src/main/java/org/orcid/pojo/ajaxForm/WorkForm.java b/orcid-core/src/main/java/org/orcid/pojo/ajaxForm/WorkForm.java index 9c6f8b87b60..19c1db1dfdf 100644 --- a/orcid-core/src/main/java/org/orcid/pojo/ajaxForm/WorkForm.java +++ b/orcid-core/src/main/java/org/orcid/pojo/ajaxForm/WorkForm.java @@ -5,8 +5,8 @@ import java.util.List; import org.apache.commons.lang.StringUtils; -import org.orcid.core.utils.DateUtils; -import org.orcid.core.utils.OrcidStringUtils; +import org.orcid.utils.DateUtils; +import org.orcid.utils.OrcidStringUtils; import org.orcid.jaxb.model.common.CitationType; import org.orcid.jaxb.model.common.Relationship; import org.orcid.jaxb.model.common.WorkType; diff --git a/orcid-core/src/test/java/org/orcid/core/adapter/jsonidentifier/converter/JSONWorkExternalIdentifiersConverterV2Test.java b/orcid-core/src/test/java/org/orcid/core/adapter/jsonidentifier/converter/JSONWorkExternalIdentifiersConverterV2Test.java index 54b50dfdf19..472e6b53aab 100644 --- a/orcid-core/src/test/java/org/orcid/core/adapter/jsonidentifier/converter/JSONWorkExternalIdentifiersConverterV2Test.java +++ b/orcid-core/src/test/java/org/orcid/core/adapter/jsonidentifier/converter/JSONWorkExternalIdentifiersConverterV2Test.java @@ -24,7 +24,7 @@ import org.orcid.persistence.jpa.entities.PublicationDateEntity; import org.orcid.persistence.jpa.entities.WorkEntity; import org.orcid.core.utils.DateFieldsOnBaseEntityUtils; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; public class JSONWorkExternalIdentifiersConverterV2Test { diff --git a/orcid-core/src/test/java/org/orcid/core/adapter/jsonidentifier/converter/JSONWorkExternalIdentifiersConverterV3Test.java b/orcid-core/src/test/java/org/orcid/core/adapter/jsonidentifier/converter/JSONWorkExternalIdentifiersConverterV3Test.java index 11ea3a78339..b657ae52b14 100644 --- a/orcid-core/src/test/java/org/orcid/core/adapter/jsonidentifier/converter/JSONWorkExternalIdentifiersConverterV3Test.java +++ b/orcid-core/src/test/java/org/orcid/core/adapter/jsonidentifier/converter/JSONWorkExternalIdentifiersConverterV3Test.java @@ -27,7 +27,7 @@ import org.orcid.persistence.jpa.entities.WorkEntity; import org.orcid.test.OrcidJUnit4ClassRunner; import org.orcid.core.utils.DateFieldsOnBaseEntityUtils; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.springframework.test.context.ContextConfiguration; @RunWith(OrcidJUnit4ClassRunner.class) diff --git a/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbAddressAdapterTest.java b/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbAddressAdapterTest.java index cab9d06abe8..f1e31f52849 100644 --- a/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbAddressAdapterTest.java +++ b/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbAddressAdapterTest.java @@ -17,7 +17,7 @@ import org.orcid.core.adapter.JpaJaxbAddressAdapter; import org.orcid.core.adapter.MockSourceNameCache; import org.orcid.core.utils.DateFieldsOnBaseEntityUtils; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.orcid.jaxb.model.common_v2.Iso3166Country; import org.orcid.jaxb.model.common_v2.Visibility; import org.orcid.jaxb.model.record_v2.Address; diff --git a/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbEducationAdapterTest.java b/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbEducationAdapterTest.java index 4ce9926ef12..439db06bab0 100644 --- a/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbEducationAdapterTest.java +++ b/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbEducationAdapterTest.java @@ -29,7 +29,7 @@ import org.orcid.persistence.jpa.entities.StartDateEntity; import org.orcid.test.OrcidJUnit4ClassRunner; import org.orcid.core.utils.DateFieldsOnBaseEntityUtils; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.springframework.test.context.ContextConfiguration; /** diff --git a/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbEmailAdapterTest.java b/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbEmailAdapterTest.java index 7cb4aa9708b..29df960ae9e 100644 --- a/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbEmailAdapterTest.java +++ b/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbEmailAdapterTest.java @@ -22,7 +22,7 @@ import org.orcid.persistence.jpa.entities.ProfileEntity; import org.orcid.test.OrcidJUnit4ClassRunner; import org.orcid.core.utils.DateFieldsOnBaseEntityUtils; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.springframework.test.context.ContextConfiguration; /** diff --git a/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbEmploymentAdapterTest.java b/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbEmploymentAdapterTest.java index 1f061d9934f..758af02ac88 100644 --- a/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbEmploymentAdapterTest.java +++ b/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbEmploymentAdapterTest.java @@ -33,7 +33,7 @@ import org.orcid.persistence.jpa.entities.StartDateEntity; import org.orcid.test.OrcidJUnit4ClassRunner; import org.orcid.core.utils.DateFieldsOnBaseEntityUtils; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.springframework.test.context.ContextConfiguration; /** diff --git a/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbExternalIdentifierAdapterTest.java b/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbExternalIdentifierAdapterTest.java index 71c6c09f813..07d4177980c 100644 --- a/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbExternalIdentifierAdapterTest.java +++ b/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbExternalIdentifierAdapterTest.java @@ -21,7 +21,7 @@ import org.orcid.persistence.jpa.entities.ExternalIdentifierEntity; import org.orcid.test.OrcidJUnit4ClassRunner; import org.orcid.core.utils.DateFieldsOnBaseEntityUtils; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.springframework.test.context.ContextConfiguration; /** diff --git a/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbFundingAdapterTest.java b/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbFundingAdapterTest.java index 72ed1b39964..2054aab2f03 100644 --- a/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbFundingAdapterTest.java +++ b/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbFundingAdapterTest.java @@ -27,7 +27,7 @@ import org.orcid.persistence.jpa.entities.StartDateEntity; import org.orcid.test.OrcidJUnit4ClassRunner; import org.orcid.core.utils.DateFieldsOnBaseEntityUtils; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.springframework.test.context.ContextConfiguration; /** diff --git a/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbKeywordAdapterTest.java b/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbKeywordAdapterTest.java index 23bb8e4a73f..874ad9c4f0a 100644 --- a/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbKeywordAdapterTest.java +++ b/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbKeywordAdapterTest.java @@ -22,7 +22,7 @@ import org.orcid.persistence.jpa.entities.ProfileKeywordEntity; import org.orcid.test.OrcidJUnit4ClassRunner; import org.orcid.core.utils.DateFieldsOnBaseEntityUtils; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.springframework.test.context.ContextConfiguration; /** diff --git a/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbNameAdapterTest.java b/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbNameAdapterTest.java index 7704ee8ed1f..18df3b7ea6e 100644 --- a/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbNameAdapterTest.java +++ b/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbNameAdapterTest.java @@ -24,7 +24,7 @@ import org.orcid.persistence.jpa.entities.RecordNameEntity; import org.orcid.test.OrcidJUnit4ClassRunner; import org.orcid.core.utils.DateFieldsOnBaseEntityUtils; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.springframework.test.context.ContextConfiguration; /** diff --git a/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbNotificationAdapterTest.java b/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbNotificationAdapterTest.java index 2ed1c7d1580..f33b67f6cc5 100644 --- a/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbNotificationAdapterTest.java +++ b/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbNotificationAdapterTest.java @@ -32,7 +32,7 @@ import org.orcid.persistence.jpa.entities.NotificationItemEntity; import org.orcid.test.OrcidJUnit4ClassRunner; import org.orcid.core.utils.DateFieldsOnBaseEntityUtils; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.springframework.test.context.ContextConfiguration; /** diff --git a/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbOtherNameAdapterTest.java b/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbOtherNameAdapterTest.java index ada78133f32..073650c59e9 100644 --- a/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbOtherNameAdapterTest.java +++ b/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbOtherNameAdapterTest.java @@ -22,7 +22,7 @@ import org.orcid.persistence.jpa.entities.ProfileEntity; import org.orcid.test.OrcidJUnit4ClassRunner; import org.orcid.core.utils.DateFieldsOnBaseEntityUtils; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.springframework.test.context.ContextConfiguration; /** diff --git a/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbPeerReviewAdapterTest.java b/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbPeerReviewAdapterTest.java index a337e3fa662..74408ebfeb2 100644 --- a/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbPeerReviewAdapterTest.java +++ b/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbPeerReviewAdapterTest.java @@ -32,7 +32,7 @@ import org.orcid.persistence.jpa.entities.SourceEntity; import org.orcid.test.OrcidJUnit4ClassRunner; import org.orcid.core.utils.DateFieldsOnBaseEntityUtils; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.springframework.test.context.ContextConfiguration; /** diff --git a/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbResearcherUrlAdapterTest.java b/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbResearcherUrlAdapterTest.java index 88fbbdac01f..bab56f6e8bf 100644 --- a/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbResearcherUrlAdapterTest.java +++ b/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbResearcherUrlAdapterTest.java @@ -22,7 +22,7 @@ import org.orcid.persistence.jpa.entities.ResearcherUrlEntity; import org.orcid.test.OrcidJUnit4ClassRunner; import org.orcid.core.utils.DateFieldsOnBaseEntityUtils; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.springframework.test.context.ContextConfiguration; /** diff --git a/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbWorkAdapterTest.java b/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbWorkAdapterTest.java index fd35dc68f64..044797b73b4 100644 --- a/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbWorkAdapterTest.java +++ b/orcid-core/src/test/java/org/orcid/core/adapter/v2/latest/JpaJaxbWorkAdapterTest.java @@ -36,7 +36,7 @@ import org.orcid.pojo.ajaxForm.PojoUtil; import org.orcid.test.OrcidJUnit4ClassRunner; import org.orcid.core.utils.DateFieldsOnBaseEntityUtils; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.springframework.test.context.ContextConfiguration; /** diff --git a/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbAddressAdapterTest.java b/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbAddressAdapterTest.java index e5cbf7ebafe..fddcd90466b 100644 --- a/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbAddressAdapterTest.java +++ b/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbAddressAdapterTest.java @@ -33,7 +33,7 @@ import org.orcid.persistence.jpa.entities.ProfileEntity; import org.orcid.test.OrcidJUnit4ClassRunner; import org.orcid.core.utils.DateFieldsOnBaseEntityUtils; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.util.ReflectionTestUtils; diff --git a/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbClientAdapterTest.java b/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbClientAdapterTest.java index cd801421bc6..9049e32e55a 100644 --- a/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbClientAdapterTest.java +++ b/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbClientAdapterTest.java @@ -33,7 +33,7 @@ import org.orcid.persistence.jpa.entities.EmailType; import org.orcid.test.OrcidJUnit4ClassRunner; import org.orcid.core.utils.DateFieldsOnBaseEntityUtils; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.springframework.test.context.ContextConfiguration; @RunWith(OrcidJUnit4ClassRunner.class) diff --git a/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbDistinctionAdapterTest.java b/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbDistinctionAdapterTest.java index ddf386597a5..3492d642abb 100644 --- a/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbDistinctionAdapterTest.java +++ b/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbDistinctionAdapterTest.java @@ -38,7 +38,7 @@ import org.orcid.persistence.jpa.entities.StartDateEntity; import org.orcid.test.OrcidJUnit4ClassRunner; import org.orcid.core.utils.DateFieldsOnBaseEntityUtils; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.util.ReflectionTestUtils; diff --git a/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbEducationAdapterTest.java b/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbEducationAdapterTest.java index e7a7027d351..01e6e44044d 100644 --- a/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbEducationAdapterTest.java +++ b/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbEducationAdapterTest.java @@ -38,7 +38,7 @@ import org.orcid.persistence.jpa.entities.StartDateEntity; import org.orcid.test.OrcidJUnit4ClassRunner; import org.orcid.core.utils.DateFieldsOnBaseEntityUtils; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.util.ReflectionTestUtils; diff --git a/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbEmailAdapterTest.java b/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbEmailAdapterTest.java index 653759f242e..6fb86a0a529 100644 --- a/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbEmailAdapterTest.java +++ b/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbEmailAdapterTest.java @@ -32,7 +32,7 @@ import org.orcid.persistence.jpa.entities.ProfileEntity; import org.orcid.test.OrcidJUnit4ClassRunner; import org.orcid.core.utils.DateFieldsOnBaseEntityUtils; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.util.ReflectionTestUtils; diff --git a/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbEmploymentAdapterTest.java b/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbEmploymentAdapterTest.java index 06575e3bf24..c7e365bb90d 100644 --- a/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbEmploymentAdapterTest.java +++ b/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbEmploymentAdapterTest.java @@ -41,7 +41,7 @@ import org.orcid.persistence.jpa.entities.StartDateEntity; import org.orcid.test.OrcidJUnit4ClassRunner; import org.orcid.core.utils.DateFieldsOnBaseEntityUtils; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.util.ReflectionTestUtils; diff --git a/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbExternalIdentifierAdapterTest.java b/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbExternalIdentifierAdapterTest.java index f1a3989c82b..2c8c8bacbe6 100644 --- a/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbExternalIdentifierAdapterTest.java +++ b/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbExternalIdentifierAdapterTest.java @@ -33,7 +33,7 @@ import org.orcid.persistence.jpa.entities.ProfileEntity; import org.orcid.test.OrcidJUnit4ClassRunner; import org.orcid.core.utils.DateFieldsOnBaseEntityUtils; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.util.ReflectionTestUtils; diff --git a/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbFundingAdapterTest.java b/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbFundingAdapterTest.java index f79e73acc67..f2fd299c648 100644 --- a/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbFundingAdapterTest.java +++ b/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbFundingAdapterTest.java @@ -25,7 +25,7 @@ import org.orcid.core.manager.SourceNameCacheManager; import org.orcid.core.manager.v3.read_only.RecordNameManagerReadOnly; import org.orcid.core.utils.DateFieldsOnBaseEntityUtils; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.orcid.jaxb.model.common.FundingType; import org.orcid.jaxb.model.v3.release.common.FuzzyDate; import org.orcid.jaxb.model.v3.release.common.Visibility; diff --git a/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbInvitedPositionAdapterTest.java b/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbInvitedPositionAdapterTest.java index 632445894f7..ea2e1890243 100644 --- a/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbInvitedPositionAdapterTest.java +++ b/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbInvitedPositionAdapterTest.java @@ -37,7 +37,7 @@ import org.orcid.persistence.jpa.entities.StartDateEntity; import org.orcid.test.OrcidJUnit4ClassRunner; import org.orcid.core.utils.DateFieldsOnBaseEntityUtils; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.util.ReflectionTestUtils; diff --git a/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbKeywordAdapterTest.java b/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbKeywordAdapterTest.java index 344831a9bdc..abcb6e9288e 100644 --- a/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbKeywordAdapterTest.java +++ b/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbKeywordAdapterTest.java @@ -32,7 +32,7 @@ import org.orcid.persistence.jpa.entities.ProfileKeywordEntity; import org.orcid.test.OrcidJUnit4ClassRunner; import org.orcid.core.utils.DateFieldsOnBaseEntityUtils; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.util.ReflectionTestUtils; diff --git a/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbMembershipAdapterTest.java b/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbMembershipAdapterTest.java index 11e16f3c9b7..243c3f7bed1 100644 --- a/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbMembershipAdapterTest.java +++ b/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbMembershipAdapterTest.java @@ -37,7 +37,7 @@ import org.orcid.persistence.jpa.entities.StartDateEntity; import org.orcid.test.OrcidJUnit4ClassRunner; import org.orcid.core.utils.DateFieldsOnBaseEntityUtils; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.util.ReflectionTestUtils; diff --git a/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbNameAdapterTest.java b/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbNameAdapterTest.java index 9754922a234..991845e61b8 100644 --- a/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbNameAdapterTest.java +++ b/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbNameAdapterTest.java @@ -23,7 +23,7 @@ import org.orcid.persistence.jpa.entities.RecordNameEntity; import org.orcid.test.OrcidJUnit4ClassRunner; import org.orcid.core.utils.DateFieldsOnBaseEntityUtils; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.springframework.test.context.ContextConfiguration; /** diff --git a/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbNotificationAdapterTest.java b/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbNotificationAdapterTest.java index 31057a5c3d5..4a3806568ae 100644 --- a/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbNotificationAdapterTest.java +++ b/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbNotificationAdapterTest.java @@ -33,7 +33,7 @@ import org.orcid.persistence.jpa.entities.NotificationItemEntity; import org.orcid.test.OrcidJUnit4ClassRunner; import org.orcid.core.utils.DateFieldsOnBaseEntityUtils; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.springframework.test.context.ContextConfiguration; /** diff --git a/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbOtherNameAdapterTest.java b/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbOtherNameAdapterTest.java index a42fd32ab92..0eb14db708f 100644 --- a/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbOtherNameAdapterTest.java +++ b/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbOtherNameAdapterTest.java @@ -31,7 +31,7 @@ import org.orcid.persistence.jpa.entities.ProfileEntity; import org.orcid.test.OrcidJUnit4ClassRunner; import org.orcid.core.utils.DateFieldsOnBaseEntityUtils; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.util.ReflectionTestUtils; diff --git a/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbPeerReviewAdapterTest.java b/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbPeerReviewAdapterTest.java index e18c0443b83..498cd9de9c0 100644 --- a/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbPeerReviewAdapterTest.java +++ b/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbPeerReviewAdapterTest.java @@ -41,7 +41,7 @@ import org.orcid.persistence.jpa.entities.SourceEntity; import org.orcid.test.OrcidJUnit4ClassRunner; import org.orcid.core.utils.DateFieldsOnBaseEntityUtils; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.util.ReflectionTestUtils; diff --git a/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbQualificationAdapterTest.java b/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbQualificationAdapterTest.java index b7deccc5ab1..110ba66a1f7 100644 --- a/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbQualificationAdapterTest.java +++ b/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbQualificationAdapterTest.java @@ -37,7 +37,7 @@ import org.orcid.persistence.jpa.entities.StartDateEntity; import org.orcid.test.OrcidJUnit4ClassRunner; import org.orcid.core.utils.DateFieldsOnBaseEntityUtils; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.util.ReflectionTestUtils; diff --git a/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbResearchResourceAdapterTest.java b/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbResearchResourceAdapterTest.java index 7df0a2677e8..34b288fc03e 100644 --- a/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbResearchResourceAdapterTest.java +++ b/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbResearchResourceAdapterTest.java @@ -25,7 +25,7 @@ import org.orcid.core.manager.SourceNameCacheManager; import org.orcid.core.manager.v3.read_only.RecordNameManagerReadOnly; import org.orcid.core.utils.DateFieldsOnBaseEntityUtils; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.orcid.jaxb.model.v3.release.common.Visibility; import org.orcid.jaxb.model.v3.release.record.ResearchResource; import org.orcid.jaxb.model.v3.release.record.summary.ResearchResourceSummary; diff --git a/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbResearcherUrlAdapterTest.java b/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbResearcherUrlAdapterTest.java index bd2eb276071..4d052d85369 100644 --- a/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbResearcherUrlAdapterTest.java +++ b/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbResearcherUrlAdapterTest.java @@ -24,7 +24,7 @@ import org.orcid.core.manager.SourceNameCacheManager; import org.orcid.core.manager.v3.read_only.RecordNameManagerReadOnly; import org.orcid.core.utils.DateFieldsOnBaseEntityUtils; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.orcid.jaxb.model.v3.release.common.Visibility; import org.orcid.jaxb.model.v3.release.record.ResearcherUrl; import org.orcid.jaxb.model.v3.release.record.ResearcherUrls; diff --git a/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbServiceAdapterTest.java b/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbServiceAdapterTest.java index fc98cdba090..6f4de964d43 100644 --- a/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbServiceAdapterTest.java +++ b/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbServiceAdapterTest.java @@ -37,7 +37,7 @@ import org.orcid.persistence.jpa.entities.StartDateEntity; import org.orcid.test.OrcidJUnit4ClassRunner; import org.orcid.core.utils.DateFieldsOnBaseEntityUtils; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.util.ReflectionTestUtils; diff --git a/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbWorkAdapterTest.java b/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbWorkAdapterTest.java index 6a43fc45165..874b5322b1e 100644 --- a/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbWorkAdapterTest.java +++ b/orcid-core/src/test/java/org/orcid/core/adapter/v3/JpaJaxbWorkAdapterTest.java @@ -43,7 +43,7 @@ import org.orcid.pojo.ajaxForm.PojoUtil; import org.orcid.test.OrcidJUnit4ClassRunner; import org.orcid.core.utils.DateFieldsOnBaseEntityUtils; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.util.ReflectionTestUtils; diff --git a/orcid-core/src/test/java/org/orcid/core/manager/impl/RegistrationManagerImplTest.java b/orcid-core/src/test/java/org/orcid/core/manager/impl/RegistrationManagerImplTest.java index bda40388b09..89b4b6768ed 100644 --- a/orcid-core/src/test/java/org/orcid/core/manager/impl/RegistrationManagerImplTest.java +++ b/orcid-core/src/test/java/org/orcid/core/manager/impl/RegistrationManagerImplTest.java @@ -52,7 +52,7 @@ import org.orcid.test.DBUnitTest; import org.orcid.test.OrcidJUnit4ClassRunner; import org.orcid.test.TargetProxyHelper; -import org.orcid.core.utils.OrcidStringUtils; +import org.orcid.utils.OrcidStringUtils; import org.springframework.security.oauth2.common.exceptions.InvalidRequestException; import org.springframework.test.context.ContextConfiguration; diff --git a/orcid-core/src/test/java/org/orcid/core/manager/v3/EmailManagerTest.java b/orcid-core/src/test/java/org/orcid/core/manager/v3/EmailManagerTest.java index c128609d290..9e5ded2bbaa 100644 --- a/orcid-core/src/test/java/org/orcid/core/manager/v3/EmailManagerTest.java +++ b/orcid-core/src/test/java/org/orcid/core/manager/v3/EmailManagerTest.java @@ -35,7 +35,6 @@ import org.mockito.MockitoAnnotations; import org.orcid.core.BaseTest; import org.orcid.core.manager.EncryptionManager; -import org.orcid.core.utils.OrcidStringUtils; import org.orcid.jaxb.model.v3.release.common.Visibility; import org.orcid.jaxb.model.v3.release.record.Email; import org.orcid.jaxb.model.v3.release.record.Emails; @@ -45,6 +44,7 @@ import org.orcid.persistence.jpa.entities.ProfileEntity; import org.orcid.persistence.jpa.entities.SourceEntity; import org.orcid.test.TargetProxyHelper; +import org.orcid.utils.OrcidStringUtils; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.test.util.ReflectionTestUtils; diff --git a/orcid-core/src/test/java/org/orcid/core/manager/v3/MembersManagerTest.java b/orcid-core/src/test/java/org/orcid/core/manager/v3/MembersManagerTest.java index 5d6b420806b..43db8f97854 100644 --- a/orcid-core/src/test/java/org/orcid/core/manager/v3/MembersManagerTest.java +++ b/orcid-core/src/test/java/org/orcid/core/manager/v3/MembersManagerTest.java @@ -33,7 +33,7 @@ import org.orcid.test.DBUnitTest; import org.orcid.test.OrcidJUnit4ClassRunner; import org.orcid.test.TargetProxyHelper; -import org.orcid.core.utils.OrcidStringUtils; +import org.orcid.utils.OrcidStringUtils; import org.springframework.test.context.ContextConfiguration; @RunWith(OrcidJUnit4ClassRunner.class) diff --git a/orcid-core/src/test/java/org/orcid/core/utils/DateUtilsTest.java b/orcid-core/src/test/java/org/orcid/core/utils/DateUtilsTest.java index 610e672c2bd..e723598f512 100644 --- a/orcid-core/src/test/java/org/orcid/core/utils/DateUtilsTest.java +++ b/orcid-core/src/test/java/org/orcid/core/utils/DateUtilsTest.java @@ -6,7 +6,7 @@ import javax.xml.datatype.XMLGregorianCalendar; import org.junit.Test; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; /** * diff --git a/orcid-core/src/test/java/org/orcid/core/utils/OrcidStringUtilsTest.java b/orcid-core/src/test/java/org/orcid/core/utils/OrcidStringUtilsTest.java index 27e4402369b..8a5c71fdde2 100644 --- a/orcid-core/src/test/java/org/orcid/core/utils/OrcidStringUtilsTest.java +++ b/orcid-core/src/test/java/org/orcid/core/utils/OrcidStringUtilsTest.java @@ -1,7 +1,7 @@ package org.orcid.core.utils; import org.junit.Test; -import org.orcid.core.utils.OrcidStringUtils; +import org.orcid.utils.OrcidStringUtils; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; diff --git a/orcid-core/src/test/java/org/orcid/pojo/ajaxForm/AffiliationFormTestBase.java b/orcid-core/src/test/java/org/orcid/pojo/ajaxForm/AffiliationFormTestBase.java index 516eedb3c7b..43e7ddd3d06 100644 --- a/orcid-core/src/test/java/org/orcid/pojo/ajaxForm/AffiliationFormTestBase.java +++ b/orcid-core/src/test/java/org/orcid/pojo/ajaxForm/AffiliationFormTestBase.java @@ -25,7 +25,7 @@ import org.orcid.jaxb.model.v3.release.record.ExternalIDs; import org.orcid.jaxb.model.v3.release.record.summary.AffiliationSummary; import org.orcid.jaxb.model.v3.release.record.summary.DistinctionSummary; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; public abstract class AffiliationFormTestBase { XMLGregorianCalendar created; diff --git a/orcid-core/src/test/java/org/orcid/pojo/ajaxForm/PojoUtilTest.java b/orcid-core/src/test/java/org/orcid/pojo/ajaxForm/PojoUtilTest.java index 8f6a9b7c542..fbb864a707a 100644 --- a/orcid-core/src/test/java/org/orcid/pojo/ajaxForm/PojoUtilTest.java +++ b/orcid-core/src/test/java/org/orcid/pojo/ajaxForm/PojoUtilTest.java @@ -14,7 +14,7 @@ import org.orcid.jaxb.model.v3.release.common.Year; import org.orcid.jaxb.model.v3.release.record.Affiliation; import org.orcid.jaxb.model.v3.release.record.Employment; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; public class PojoUtilTest { diff --git a/orcid-persistence/pom.xml b/orcid-persistence/pom.xml index d3e6e2bef73..b071541a8d2 100644 --- a/orcid-persistence/pom.xml +++ b/orcid-persistence/pom.xml @@ -53,7 +53,12 @@ - + + + ${project.parent.groupId} + orcid-utils + ${project.parent.version} + org.orcid orcid-test diff --git a/orcid-persistence/src/main/java/org/orcid/persistence/jpa/entities/BaseContributorEntity.java b/orcid-persistence/src/main/java/org/orcid/persistence/jpa/entities/BaseContributorEntity.java index 4dbc0d5e6e7..4edaf75d8cd 100644 --- a/orcid-persistence/src/main/java/org/orcid/persistence/jpa/entities/BaseContributorEntity.java +++ b/orcid-persistence/src/main/java/org/orcid/persistence/jpa/entities/BaseContributorEntity.java @@ -7,7 +7,7 @@ import javax.persistence.ManyToOne; import javax.persistence.MappedSuperclass; -import org.orcid.persistence.util.OrcidStringUtils; +import org.orcid.utils.NullUtils; /** * @author Declan Newman (declan) Date: 08/08/2012 @@ -72,19 +72,19 @@ public int compareTo(BaseContributorEntity other) { if (other == null) { return -1; } - int compareSequenceTypes = OrcidStringUtils.compareObjectsNullSafe(sequence, other.getSequence()); + int compareSequenceTypes = NullUtils.compareObjectsNullSafe(sequence, other.getSequence()); if (compareSequenceTypes != 0) { return compareSequenceTypes; } - int compareRoles = OrcidStringUtils.compareObjectsNullSafe(contributorRole, other.getContributorRole()); + int compareRoles = NullUtils.compareObjectsNullSafe(contributorRole, other.getContributorRole()); if (compareRoles != 0) { return compareRoles; } - int compareCreditNames = OrcidStringUtils.compareObjectsNullSafe(creditName, other.getCreditName()); + int compareCreditNames = NullUtils.compareObjectsNullSafe(creditName, other.getCreditName()); if (compareCreditNames != 0) { return compareCreditNames; } - int compareEmails = OrcidStringUtils.compareObjectsNullSafe(contributorEmail, other.getContributorEmail()); + int compareEmails = NullUtils.compareObjectsNullSafe(contributorEmail, other.getContributorEmail()); if (compareEmails != 0) { return compareEmails; } diff --git a/orcid-persistence/src/main/java/org/orcid/persistence/jpa/entities/ClientSecretEntity.java b/orcid-persistence/src/main/java/org/orcid/persistence/jpa/entities/ClientSecretEntity.java index c8ec186ccc7..2d9bdaa5bb5 100644 --- a/orcid-persistence/src/main/java/org/orcid/persistence/jpa/entities/ClientSecretEntity.java +++ b/orcid-persistence/src/main/java/org/orcid/persistence/jpa/entities/ClientSecretEntity.java @@ -14,7 +14,7 @@ import javax.persistence.Transient; import org.orcid.persistence.jpa.entities.keys.ClientSecretPk; -import org.orcid.persistence.util.OrcidStringUtils; +import org.orcid.utils.NullUtils; /** * @@ -101,7 +101,7 @@ public void setDecryptedClientSecret(String decryptedClientSecret) { public int compareTo(ClientSecretEntity other) { Date otherLastModified = other.getLastModified(); Date thisLastModified = getLastModified(); - int dateComparison = OrcidStringUtils.compareObjectsNullSafe(thisLastModified, otherLastModified); + int dateComparison = NullUtils.compareObjectsNullSafe(thisLastModified, otherLastModified); if (dateComparison != 0) { return -dateComparison; } diff --git a/orcid-persistence/src/main/java/org/orcid/persistence/jpa/entities/OrgAffiliationRelationEntity.java b/orcid-persistence/src/main/java/org/orcid/persistence/jpa/entities/OrgAffiliationRelationEntity.java index 45790874c3f..cb1bc3c95a6 100644 --- a/orcid-persistence/src/main/java/org/orcid/persistence/jpa/entities/OrgAffiliationRelationEntity.java +++ b/orcid-persistence/src/main/java/org/orcid/persistence/jpa/entities/OrgAffiliationRelationEntity.java @@ -12,7 +12,7 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; -import org.orcid.persistence.util.OrcidStringUtils; +import org.orcid.utils.NullUtils; /** * @@ -176,43 +176,43 @@ public int compareTo(OrgAffiliationRelationEntity other) { } private int compareEnds(FuzzyDateEntity endDate, FuzzyDateEntity otherEndDate) { - if (OrcidStringUtils.anyNull(endDate, otherEndDate)) { - return -OrcidStringUtils.compareNulls(endDate, otherEndDate); + if (NullUtils.anyNull(endDate, otherEndDate)) { + return -NullUtils.compareNulls(endDate, otherEndDate); } return -endDate.compareTo(otherEndDate); } private int compareStarts(FuzzyDateEntity startDate, FuzzyDateEntity otherStartDate) { - if (OrcidStringUtils.anyNull(startDate, otherStartDate)) { - return OrcidStringUtils.compareNulls(startDate, otherStartDate); + if (NullUtils.anyNull(startDate, otherStartDate)) { + return NullUtils.compareNulls(startDate, otherStartDate); } return -startDate.compareTo(otherStartDate); } private int compareTypes(String affiliationType, String otherAffiliationType) { - if (OrcidStringUtils.anyNull(affiliationType, otherAffiliationType)) { - return OrcidStringUtils.compareNulls(affiliationType, otherAffiliationType); + if (NullUtils.anyNull(affiliationType, otherAffiliationType)) { + return NullUtils.compareNulls(affiliationType, otherAffiliationType); } return affiliationType.compareTo(otherAffiliationType); } private int compareNames(String name, String otherName) { - if (OrcidStringUtils.anyNull(name, otherName)) { - return OrcidStringUtils.compareNulls(name, otherName); + if (NullUtils.anyNull(name, otherName)) { + return NullUtils.compareNulls(name, otherName); } return name.compareTo(otherName); } private int compareDepartments(String department, String otherDepartment) { - if (OrcidStringUtils.anyNull(department, otherDepartment)) { - return OrcidStringUtils.compareNulls(department, otherDepartment); + if (NullUtils.anyNull(department, otherDepartment)) { + return NullUtils.compareNulls(department, otherDepartment); } return department.compareTo(otherDepartment); } private int compareTitles(String title, String otherTitle) { - if (OrcidStringUtils.anyNull(title, otherTitle)) { - return OrcidStringUtils.compareNulls(title, otherTitle); + if (NullUtils.anyNull(title, otherTitle)) { + return NullUtils.compareNulls(title, otherTitle); } return title.compareTo(otherTitle); } diff --git a/orcid-persistence/src/main/java/org/orcid/persistence/jpa/entities/PeerReviewEntity.java b/orcid-persistence/src/main/java/org/orcid/persistence/jpa/entities/PeerReviewEntity.java index f2fc4425fac..6326a794194 100644 --- a/orcid-persistence/src/main/java/org/orcid/persistence/jpa/entities/PeerReviewEntity.java +++ b/orcid-persistence/src/main/java/org/orcid/persistence/jpa/entities/PeerReviewEntity.java @@ -13,7 +13,8 @@ import javax.persistence.Table; import org.apache.commons.lang3.StringUtils; -import org.orcid.persistence.util.OrcidStringUtils; +import org.orcid.utils.OrcidStringUtils; +import org.orcid.utils.NullUtils; @Entity @@ -218,17 +219,17 @@ public int compareTo(PeerReviewEntity other) { throw new NullPointerException("Can't compare with null"); } - int typeCompare = OrcidStringUtils.compareObjectsNullSafe(type, other.getType()); + int typeCompare = NullUtils.compareObjectsNullSafe(type, other.getType()); if(typeCompare != 0) { return typeCompare; } - int roleCompare = OrcidStringUtils.compareObjectsNullSafe(role, other.getRole()); + int roleCompare = NullUtils.compareObjectsNullSafe(role, other.getRole()); if(roleCompare != 0) { return roleCompare; } - int completionDateCompare = OrcidStringUtils.compareObjectsNullSafe((FuzzyDateEntity)completionDate, (FuzzyDateEntity)other.getCompletionDate()); + int completionDateCompare = NullUtils.compareObjectsNullSafe((FuzzyDateEntity)completionDate, (FuzzyDateEntity)other.getCompletionDate()); if(completionDateCompare != 0) { return completionDateCompare; } @@ -264,7 +265,7 @@ public int compareTo(PeerReviewEntity other) { return subjectExtIdCompare; } - int subjectTypeCompare = OrcidStringUtils.compareObjectsNullSafe(subjectType, other.getSubjectType()); + int subjectTypeCompare = NullUtils.compareObjectsNullSafe(subjectType, other.getSubjectType()); if(subjectTypeCompare != 0) { return subjectTypeCompare; } diff --git a/orcid-persistence/src/main/java/org/orcid/persistence/jpa/entities/ProfileFundingEntity.java b/orcid-persistence/src/main/java/org/orcid/persistence/jpa/entities/ProfileFundingEntity.java index 85a052d9c18..30c9eb46906 100644 --- a/orcid-persistence/src/main/java/org/orcid/persistence/jpa/entities/ProfileFundingEntity.java +++ b/orcid-persistence/src/main/java/org/orcid/persistence/jpa/entities/ProfileFundingEntity.java @@ -15,7 +15,8 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; -import org.orcid.persistence.util.OrcidStringUtils; +import org.orcid.utils.OrcidStringUtils; +import org.orcid.utils.NullUtils; /** * orcid-entities - Dec 6, 2011 - ProfileInstitutionEntity @@ -251,7 +252,7 @@ public int compareTo(ProfileFundingEntity other) { return compareStarts; } - int compareNumericAmounts = OrcidStringUtils.compareObjectsNullSafe(numericAmount, other.getNumericAmount()); + int compareNumericAmounts = NullUtils.compareObjectsNullSafe(numericAmount, other.getNumericAmount()); if (compareNumericAmounts != 0) { return compareNumericAmounts; } @@ -290,29 +291,29 @@ public int compareTo(ProfileFundingEntity other) { } private int compareTypes(String type, String otherType) { - if (OrcidStringUtils.anyNull(type, otherType)) { - return -OrcidStringUtils.compareNulls(type, otherType); + if (NullUtils.anyNull(type, otherType)) { + return -NullUtils.compareNulls(type, otherType); } return -type.compareTo(otherType); } private int compareEnds(FuzzyDateEntity endDate, FuzzyDateEntity otherEndDate) { - if (OrcidStringUtils.anyNull(endDate, otherEndDate)) { - return -OrcidStringUtils.compareNulls(endDate, otherEndDate); + if (NullUtils.anyNull(endDate, otherEndDate)) { + return -NullUtils.compareNulls(endDate, otherEndDate); } return -endDate.compareTo(otherEndDate); } private int compareStarts(FuzzyDateEntity startDate, FuzzyDateEntity otherStartDate) { - if (OrcidStringUtils.anyNull(startDate, otherStartDate)) { - return OrcidStringUtils.compareNulls(startDate, otherStartDate); + if (NullUtils.anyNull(startDate, otherStartDate)) { + return NullUtils.compareNulls(startDate, otherStartDate); } return -startDate.compareTo(otherStartDate); } private int compareLongs(Long l1, Long l2 ) { - if (OrcidStringUtils.anyNull(l1, l2)) { - return OrcidStringUtils.compareNulls(l1, l2); + if (NullUtils.anyNull(l1, l2)) { + return NullUtils.compareNulls(l1, l2); } return l1.compareTo(l2); } diff --git a/orcid-persistence/src/main/java/org/orcid/persistence/util/OrcidStringUtils.java b/orcid-persistence/src/main/java/org/orcid/persistence/util/OrcidStringUtils.java deleted file mode 100644 index 99d47606f89..00000000000 --- a/orcid-persistence/src/main/java/org/orcid/persistence/util/OrcidStringUtils.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.orcid.persistence.util; - -import java.util.regex.Pattern; - -import org.apache.commons.lang.StringUtils; - -/** - * TODO: Once the jersey migration is over, this should go back to the orcid-utils package so it could be reused form the orcid-persistence package - */ -@Deprecated -public class OrcidStringUtils { - public static String ORCID_STRING = "(\\d{4}-){3}\\d{3}[\\dX]"; - public static final Pattern orcidPattern = Pattern.compile(ORCID_STRING); - - public static int compareStrings(String string, String otherString) { - if (anyNull(string, otherString)) { - return compareNulls(string, otherString); - } - return string.compareTo(otherString); - } - - public static boolean anyNull(Object... objects) { - for (Object object : objects) { - if (object == null) { - return true; - } - } - return false; - } - - public static int compareNulls(Object thisObject, Object otherObject) { - if (thisObject == null) { - return otherObject == null ? 0 : 1; - } else { - return otherObject == null ? -1 : 0; - } - } - - public static > int compareObjectsNullSafe(T thisObject, T otherObject) { - if (anyNull(thisObject, otherObject)) { - return compareNulls(thisObject, otherObject); - } - return thisObject.compareTo(otherObject); - } - - public static boolean isValidOrcid(String orcid) { - if (StringUtils.isNotBlank(orcid)) { - return orcidPattern.matcher(orcid).matches(); - } else { - return false; - } - } -} diff --git a/orcid-scheduler-web/src/main/java/org/orcid/scheduler/autospam/cli/AutoLockSpamRecords.java b/orcid-scheduler-web/src/main/java/org/orcid/scheduler/autospam/cli/AutoLockSpamRecords.java index c3bc2534485..0648d3678ff 100644 --- a/orcid-scheduler-web/src/main/java/org/orcid/scheduler/autospam/cli/AutoLockSpamRecords.java +++ b/orcid-scheduler-web/src/main/java/org/orcid/scheduler/autospam/cli/AutoLockSpamRecords.java @@ -21,13 +21,12 @@ import org.orcid.core.manager.v3.ProfileEntityManager; import org.orcid.core.manager.v3.ResearcherUrlManager; import org.orcid.core.togglz.OrcidTogglzConfiguration; -import org.orcid.core.utils.OrcidStringUtils; - import org.orcid.jaxb.model.v3.release.record.Biography; import org.orcid.jaxb.model.v3.release.record.ResearcherUrls; import org.orcid.persistence.dao.OrcidOauth2TokenDetailDao; import org.orcid.persistence.jpa.entities.ProfileEntity; import org.orcid.scheduler.autospam.AutospamEmailSender; +import org.orcid.utils.OrcidStringUtils; import org.orcid.utils.alerting.SlackManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/orcid-scheduler-web/src/main/java/org/orcid/scheduler/email/cli/SendBadOrgsEmail.java b/orcid-scheduler-web/src/main/java/org/orcid/scheduler/email/cli/SendBadOrgsEmail.java index 5a7bab1fd16..08c5034d970 100644 --- a/orcid-scheduler-web/src/main/java/org/orcid/scheduler/email/cli/SendBadOrgsEmail.java +++ b/orcid-scheduler-web/src/main/java/org/orcid/scheduler/email/cli/SendBadOrgsEmail.java @@ -38,7 +38,7 @@ import org.orcid.persistence.jpa.entities.OrgEntity; import org.orcid.persistence.jpa.entities.ProfileEntity; import org.orcid.persistence.jpa.entities.ProfileFundingEntity; -import org.orcid.core.utils.NullUtils; +import org.orcid.utils.NullUtils; import org.orcid.utils.email.MailGunManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/orcid-scheduler-web/src/test/java/org/orcid/scheduler/email/cli/manager/EmailMessageSenderTest.java b/orcid-scheduler-web/src/test/java/org/orcid/scheduler/email/cli/manager/EmailMessageSenderTest.java index 80f7eeaef37..a0351048890 100644 --- a/orcid-scheduler-web/src/test/java/org/orcid/scheduler/email/cli/manager/EmailMessageSenderTest.java +++ b/orcid-scheduler-web/src/test/java/org/orcid/scheduler/email/cli/manager/EmailMessageSenderTest.java @@ -28,7 +28,7 @@ import org.orcid.core.manager.ProfileEntityCacheManager; import org.orcid.core.manager.v3.RecordNameManager; import org.orcid.core.togglz.Features; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.orcid.jaxb.model.common.ActionType; import org.orcid.jaxb.model.common.AvailableLocales; import org.orcid.jaxb.model.common.Relationship; diff --git a/orcid-utils/pom.xml b/orcid-utils/pom.xml index 7402e8621ad..d7b361ba22d 100644 --- a/orcid-utils/pom.xml +++ b/orcid-utils/pom.xml @@ -105,6 +105,14 @@ 2.3.6 runtime + + + + + org.jsoup + jsoup + 1.15.4 + diff --git a/orcid-core/src/main/java/org/orcid/core/utils/NullUtils.java b/orcid-utils/src/main/java/org/orcid/utils/NullUtils.java similarity index 97% rename from orcid-core/src/main/java/org/orcid/core/utils/NullUtils.java rename to orcid-utils/src/main/java/org/orcid/utils/NullUtils.java index f44b4073c00..1f6542f9690 100644 --- a/orcid-core/src/main/java/org/orcid/core/utils/NullUtils.java +++ b/orcid-utils/src/main/java/org/orcid/utils/NullUtils.java @@ -1,4 +1,4 @@ -package org.orcid.core.utils; +package org.orcid.utils; /** * @author Will Simpson diff --git a/orcid-core/src/main/java/org/orcid/core/utils/OrcidStringUtils.java b/orcid-utils/src/main/java/org/orcid/utils/OrcidStringUtils.java similarity index 96% rename from orcid-core/src/main/java/org/orcid/core/utils/OrcidStringUtils.java rename to orcid-utils/src/main/java/org/orcid/utils/OrcidStringUtils.java index 78b1feb018e..64fae323f02 100644 --- a/orcid-core/src/main/java/org/orcid/core/utils/OrcidStringUtils.java +++ b/orcid-utils/src/main/java/org/orcid/utils/OrcidStringUtils.java @@ -1,4 +1,4 @@ -package org.orcid.core.utils; +package org.orcid.utils; import java.util.Enumeration; import java.util.HashMap; @@ -13,10 +13,6 @@ import org.jsoup.nodes.Entities.EscapeMode; import org.jsoup.safety.Safelist; -/** - * TODO: Once the jersey migration is over, this should go back to the orcid-utils package so it could be reused form the orcid-persistence package - * */ -@Deprecated public class OrcidStringUtils { public static String ORCID_STRING = "(\\d{4}-){3}\\d{3}[\\dX]"; diff --git a/orcid-web/src/main/java/org/orcid/frontend/cli/AutoLockSpamRecords.java b/orcid-web/src/main/java/org/orcid/frontend/cli/AutoLockSpamRecords.java index d8fa32cd5b9..45edfe6e6d4 100644 --- a/orcid-web/src/main/java/org/orcid/frontend/cli/AutoLockSpamRecords.java +++ b/orcid-web/src/main/java/org/orcid/frontend/cli/AutoLockSpamRecords.java @@ -18,12 +18,12 @@ import org.orcid.core.manager.v3.NotificationManager; import org.orcid.core.manager.v3.ProfileEntityManager; import org.orcid.core.togglz.OrcidTogglzConfiguration; -import org.orcid.core.utils.OrcidStringUtils; import org.orcid.frontend.email.RecordEmailSender; import org.orcid.jaxb.model.record_v2.Affiliation; import org.orcid.persistence.dao.OrcidOauth2TokenDetailDao; import org.orcid.persistence.jpa.entities.ProfileEntity; import org.orcid.pojo.ajaxForm.PojoUtil; +import org.orcid.utils.OrcidStringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.ApplicationContext; diff --git a/orcid-web/src/main/java/org/orcid/frontend/spring/OrcidAuthenticationProvider.java b/orcid-web/src/main/java/org/orcid/frontend/spring/OrcidAuthenticationProvider.java index a354c3e0a0e..580af789385 100644 --- a/orcid-web/src/main/java/org/orcid/frontend/spring/OrcidAuthenticationProvider.java +++ b/orcid-web/src/main/java/org/orcid/frontend/spring/OrcidAuthenticationProvider.java @@ -14,11 +14,11 @@ import org.orcid.core.manager.v3.read_only.EmailManagerReadOnly; import org.orcid.core.security.OrcidUserDetailsService; import org.orcid.core.togglz.Features; -import org.orcid.core.utils.OrcidStringUtils; import org.orcid.frontend.web.exception.Bad2FARecoveryCodeException; import org.orcid.frontend.web.exception.Bad2FAVerificationCodeException; import org.orcid.frontend.web.exception.VerificationCodeFor2FARequiredException; import org.orcid.persistence.jpa.entities.ProfileEntity; +import org.orcid.utils.OrcidStringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; diff --git a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/AdminController.java b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/AdminController.java index 37c59ee65f9..3d031f763e5 100644 --- a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/AdminController.java +++ b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/AdminController.java @@ -24,7 +24,6 @@ import org.orcid.core.manager.v3.ProfileEntityManager; import org.orcid.core.manager.v3.SpamManager; import org.orcid.core.manager.v3.read_only.RecordNameManagerReadOnly; -import org.orcid.core.utils.OrcidStringUtils; import org.orcid.frontend.email.RecordEmailSender; import org.orcid.frontend.web.util.PasswordConstants; import org.orcid.jaxb.model.clientgroup.ClientType; @@ -43,6 +42,7 @@ import org.orcid.pojo.ProfileDeprecationRequest; import org.orcid.pojo.ProfileDetails; import org.orcid.pojo.ajaxForm.PojoUtil; +import org.orcid.utils.OrcidStringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; diff --git a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/BaseController.java b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/BaseController.java index bd090eed4c8..91184fd0603 100644 --- a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/BaseController.java +++ b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/BaseController.java @@ -41,7 +41,6 @@ import org.orcid.core.manager.v3.read_only.ResearcherUrlManagerReadOnly; import org.orcid.core.oauth.OrcidProfileUserDetails; import org.orcid.core.togglz.Features; -import org.orcid.core.utils.OrcidStringUtils; import org.orcid.core.utils.ReleaseNameUtils; import org.orcid.frontend.web.forms.validate.OrcidUrlValidator; import org.orcid.frontend.web.forms.validate.RedirectUriValidator; @@ -74,6 +73,7 @@ import org.orcid.pojo.ajaxForm.Text; import org.orcid.pojo.ajaxForm.Visibility; import org.orcid.pojo.ajaxForm.VisibilityForm; +import org.orcid.utils.OrcidStringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; diff --git a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/ClaimController.java b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/ClaimController.java index 2714fd2e775..1180b606489 100644 --- a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/ClaimController.java +++ b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/ClaimController.java @@ -18,7 +18,6 @@ import org.orcid.core.manager.ProfileEntityCacheManager; import org.orcid.core.manager.v3.NotificationManager; import org.orcid.core.manager.v3.ProfileEntityManager; -import org.orcid.core.utils.OrcidStringUtils; import org.orcid.frontend.email.RecordEmailSender; import org.orcid.jaxb.model.common.AvailableLocales; import org.orcid.jaxb.model.v3.release.notification.amended.AmendedSection; @@ -26,6 +25,7 @@ import org.orcid.pojo.EmailRequest; import org.orcid.pojo.ajaxForm.Claim; import org.orcid.pojo.ajaxForm.PojoUtil; +import org.orcid.utils.OrcidStringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; diff --git a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/ClientsController.java b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/ClientsController.java index 23086054036..7124d36958d 100644 --- a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/ClientsController.java +++ b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/ClientsController.java @@ -17,7 +17,6 @@ import org.orcid.core.manager.v3.ClientDetailsManager; import org.orcid.core.manager.v3.ClientManager; import org.orcid.core.manager.v3.read_only.ClientManagerReadOnly; -import org.orcid.core.utils.OrcidStringUtils; import org.orcid.jaxb.model.clientgroup.ClientType; import org.orcid.jaxb.model.clientgroup.RedirectUriType; import org.orcid.jaxb.model.message.ScopePathType; @@ -26,6 +25,7 @@ import org.orcid.pojo.ajaxForm.PojoUtil; import org.orcid.pojo.ajaxForm.RedirectUri; import org.orcid.pojo.ajaxForm.Text; +import org.orcid.utils.OrcidStringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.access.prepost.PreAuthorize; diff --git a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/DeveloperToolsController.java b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/DeveloperToolsController.java index 174a368d21e..3334936b164 100644 --- a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/DeveloperToolsController.java +++ b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/DeveloperToolsController.java @@ -15,12 +15,12 @@ import org.orcid.core.manager.v3.read_only.ClientManagerReadOnly; import org.orcid.core.manager.v3.read_only.EmailManagerReadOnly; import org.orcid.core.profile.history.ProfileHistoryEventType; -import org.orcid.core.utils.OrcidStringUtils; import org.orcid.jaxb.model.clientgroup.RedirectUriType; import org.orcid.pojo.ajaxForm.Client; import org.orcid.pojo.ajaxForm.PojoUtil; import org.orcid.pojo.ajaxForm.RedirectUri; import org.orcid.pojo.ajaxForm.Text; +import org.orcid.utils.OrcidStringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; diff --git a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/EmailDomainController.java b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/EmailDomainController.java index fe252420836..823824d0b5b 100644 --- a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/EmailDomainController.java +++ b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/EmailDomainController.java @@ -5,8 +5,8 @@ import org.orcid.core.common.manager.EmailDomainManager; import org.orcid.core.solr.OrcidSolrOrgsClient; -import org.orcid.core.utils.OrcidStringUtils; import org.orcid.persistence.jpa.entities.EmailDomainEntity; +import org.orcid.utils.OrcidStringUtils; import org.orcid.utils.solr.entities.OrgDisambiguatedSolrDocument; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/HomeController.java b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/HomeController.java index 9ecb15454cb..e4831dafb13 100644 --- a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/HomeController.java +++ b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/HomeController.java @@ -23,13 +23,13 @@ import org.orcid.core.security.OrcidWebRole; import org.orcid.core.stats.StatisticsManager; import org.orcid.core.togglz.Features; -import org.orcid.core.utils.OrcidStringUtils; import org.orcid.core.utils.UTF8Control; import org.orcid.jaxb.model.common.AvailableLocales; import org.orcid.persistence.jpa.entities.ProfileEntity; import org.orcid.pojo.PublicRecordPersonDetails; import org.orcid.pojo.UserStatus; import org.orcid.pojo.ajaxForm.PojoUtil; +import org.orcid.utils.OrcidStringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; diff --git a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/ManageProfileController.java b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/ManageProfileController.java index bf7696cb5db..e3e99fb1b3f 100644 --- a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/ManageProfileController.java +++ b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/ManageProfileController.java @@ -35,7 +35,6 @@ import org.orcid.core.manager.v3.read_only.RecordNameManagerReadOnly; import org.orcid.core.togglz.Features; import org.orcid.core.utils.JsonUtils; -import org.orcid.core.utils.OrcidStringUtils; import org.orcid.core.utils.v3.OrcidIdentifierUtils; import org.orcid.frontend.email.RecordEmailSender; import org.orcid.frontend.web.util.CommonPasswords; @@ -57,6 +56,7 @@ import org.orcid.pojo.ManageDelegate; import org.orcid.pojo.ManageSocialAccount; import org.orcid.pojo.ajaxForm.*; +import org.orcid.utils.OrcidStringUtils; import org.orcid.utils.alerting.SlackManager; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; diff --git a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/OauthRegistrationController.java b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/OauthRegistrationController.java index 7470af33e84..8a203209136 100644 --- a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/OauthRegistrationController.java +++ b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/OauthRegistrationController.java @@ -12,13 +12,13 @@ import org.apache.commons.lang.StringUtils; import org.orcid.core.constants.OrcidOauth2Constants; import org.orcid.core.utils.OrcidRequestUtil; -import org.orcid.core.utils.OrcidStringUtils; import org.orcid.frontend.web.controllers.helper.OauthHelper; import org.orcid.jaxb.model.message.CreationMethod; import org.orcid.pojo.ajaxForm.OauthRegistrationForm; import org.orcid.pojo.ajaxForm.PojoUtil; import org.orcid.pojo.ajaxForm.RequestInfoForm; import org.orcid.pojo.ajaxForm.Text; +import org.orcid.utils.OrcidStringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.core.Authentication; diff --git a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/PasswordResetController.java b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/PasswordResetController.java index e2f5e4bcd8b..75ecfad1edf 100644 --- a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/PasswordResetController.java +++ b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/PasswordResetController.java @@ -24,7 +24,6 @@ import org.orcid.core.manager.RegistrationManager; import org.orcid.core.manager.v3.ProfileEntityManager; import org.orcid.core.manager.v3.read_only.EmailManagerReadOnly; -import org.orcid.core.utils.OrcidStringUtils; import org.orcid.core.utils.PasswordResetToken; import org.orcid.frontend.email.RecordEmailSender; import org.orcid.frontend.spring.ShibbolethAjaxAuthenticationSuccessHandler; @@ -42,6 +41,7 @@ import org.orcid.pojo.ajaxForm.Reactivation; import org.orcid.pojo.ajaxForm.Registration; import org.orcid.pojo.ajaxForm.Text; +import org.orcid.utils.OrcidStringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpStatus; diff --git a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/RegistrationController.java b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/RegistrationController.java index 2e51f201868..d74d99c4ec8 100644 --- a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/RegistrationController.java +++ b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/RegistrationController.java @@ -36,7 +36,6 @@ import org.orcid.core.security.OrcidUserDetailsService; import org.orcid.core.togglz.Features; import org.orcid.core.utils.OrcidRequestUtil; -import org.orcid.core.utils.OrcidStringUtils; import org.orcid.frontend.email.RecordEmailSender; import org.orcid.frontend.spring.ShibbolethAjaxAuthenticationSuccessHandler; import org.orcid.frontend.spring.SocialAjaxAuthenticationSuccessHandler; @@ -56,6 +55,7 @@ import org.orcid.pojo.ajaxForm.Registration; import org.orcid.pojo.ajaxForm.RequestInfoForm; import org.orcid.pojo.ajaxForm.Text; +import org.orcid.utils.OrcidStringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.authentication.AuthenticationManager; diff --git a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/SpamController.java b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/SpamController.java index 1a5d99aef03..7625b1d5799 100644 --- a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/SpamController.java +++ b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/SpamController.java @@ -3,8 +3,8 @@ import javax.annotation.Resource; import org.orcid.core.manager.v3.SpamManager; -import org.orcid.core.utils.OrcidStringUtils; import org.orcid.pojo.Spam; +import org.orcid.utils.OrcidStringUtils; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/helper/OauthHelper.java b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/helper/OauthHelper.java index 9219c26f400..f267d285f60 100644 --- a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/helper/OauthHelper.java +++ b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/helper/OauthHelper.java @@ -15,7 +15,6 @@ import org.orcid.core.manager.v3.ProfileEntityManager; import org.orcid.core.manager.v3.read_only.RecordNameManagerReadOnly; import org.orcid.core.oauth.OrcidProfileUserDetails; -import org.orcid.core.utils.OrcidStringUtils; import org.orcid.frontend.web.controllers.BaseControllerUtil; import org.orcid.frontend.web.controllers.RegistrationController; import org.orcid.frontend.web.exception.OauthInvalidRequestException; @@ -26,6 +25,7 @@ import org.orcid.pojo.ajaxForm.PojoUtil; import org.orcid.pojo.ajaxForm.RequestInfoForm; import org.orcid.pojo.ajaxForm.ScopeInfoForm; +import org.orcid.utils.OrcidStringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.NoSuchMessageException; diff --git a/orcid-web/src/test/java/orcid/pojo/ajaxForm/WorkFormTest.java b/orcid-web/src/test/java/orcid/pojo/ajaxForm/WorkFormTest.java index e6146eedf08..73c15018658 100644 --- a/orcid-web/src/test/java/orcid/pojo/ajaxForm/WorkFormTest.java +++ b/orcid-web/src/test/java/orcid/pojo/ajaxForm/WorkFormTest.java @@ -8,7 +8,7 @@ import java.io.ObjectOutputStream; import java.util.Date; import org.junit.Test; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.orcid.jaxb.model.common.CitationType; import org.orcid.jaxb.model.common.ContributorRole; import org.orcid.jaxb.model.common.Iso3166Country; diff --git a/orcid-web/src/test/java/org/orcid/frontend/web/controllers/ManageProfileControllerTest.java b/orcid-web/src/test/java/org/orcid/frontend/web/controllers/ManageProfileControllerTest.java index 677f1278681..a89a4fa8d3a 100644 --- a/orcid-web/src/test/java/org/orcid/frontend/web/controllers/ManageProfileControllerTest.java +++ b/orcid-web/src/test/java/org/orcid/frontend/web/controllers/ManageProfileControllerTest.java @@ -45,7 +45,7 @@ import org.orcid.core.manager.v3.read_only.RecordNameManagerReadOnly; import org.orcid.core.oauth.OrcidProfileUserDetails; import org.orcid.core.security.OrcidWebRole; -import org.orcid.core.utils.DateUtils; +import org.orcid.utils.DateUtils; import org.orcid.core.utils.v3.OrcidIdentifierUtils; import org.orcid.frontend.email.RecordEmailSender; import org.orcid.jaxb.model.v3.release.common.CreditName; From dbe14230997c9c9ce7065c33b22bec3d5890abd0 Mon Sep 17 00:00:00 2001 From: github actions Date: Wed, 28 Aug 2024 00:27:14 +0000 Subject: [PATCH 19/21] v2.64.2 changelog update --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index de8081169df..9d888754cba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## v2.64.2 - 2024-08-28 + +[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.64.1...v2.64.2) + ## v2.64.1 - 2024-08-26 [Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.64.0...v2.64.1) From 22d2bd31ed91d611aefe669f261dd56731a6f28d Mon Sep 17 00:00:00 2001 From: Camelia Dumitru <62257307+Camelia-Orcid@users.noreply.github.com> Date: Mon, 2 Sep 2024 16:19:38 +0100 Subject: [PATCH 20/21] Added unique constraint for external id identifier for disambiguated org (#7074) Co-authored-by: Angel Montenegro --- orcid-persistence/src/main/resources/db-master.xml | 1 + ...que_constraint_external_id_disambiguated_org.xml | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 orcid-persistence/src/main/resources/db/updates/add_unique_constraint_external_id_disambiguated_org.xml diff --git a/orcid-persistence/src/main/resources/db-master.xml b/orcid-persistence/src/main/resources/db-master.xml index 3f0df9ca962..c1a531b9bb3 100644 --- a/orcid-persistence/src/main/resources/db-master.xml +++ b/orcid-persistence/src/main/resources/db-master.xml @@ -403,4 +403,5 @@ + \ No newline at end of file diff --git a/orcid-persistence/src/main/resources/db/updates/add_unique_constraint_external_id_disambiguated_org.xml b/orcid-persistence/src/main/resources/db/updates/add_unique_constraint_external_id_disambiguated_org.xml new file mode 100644 index 00000000000..50781875b77 --- /dev/null +++ b/orcid-persistence/src/main/resources/db/updates/add_unique_constraint_external_id_disambiguated_org.xml @@ -0,0 +1,13 @@ + + + + + + + + \ No newline at end of file From b0d6c11401cd460c907c8ed914bfbd27395e8145 Mon Sep 17 00:00:00 2001 From: github actions Date: Mon, 2 Sep 2024 15:33:31 +0000 Subject: [PATCH 21/21] v2.64.3 changelog update --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d888754cba..50b3880afd6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## v2.64.3 - 2024-09-02 + +[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.64.2...v2.64.3) + ## v2.64.2 - 2024-08-28 [Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.64.1...v2.64.2)