From 2bb506d8119d686d4b273114a9619cf582a485a8 Mon Sep 17 00:00:00 2001 From: Angel Montenegro Date: Mon, 9 Dec 2024 13:13:24 -0600 Subject: [PATCH] If the source is null lets add one (#7151) --- .../delegator/impl/MemberV2ApiServiceDelegatorImpl.java | 4 ++++ .../read_only/impl/PersonDetailsManagerReadOnlyImpl.java | 4 ++++ .../delegator/impl/PublicV2ApiServiceDelegatorImpl.java | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/orcid-api-web/src/main/java/org/orcid/api/memberV2/server/delegator/impl/MemberV2ApiServiceDelegatorImpl.java b/orcid-api-web/src/main/java/org/orcid/api/memberV2/server/delegator/impl/MemberV2ApiServiceDelegatorImpl.java index 48ea536fa3..0654b26666 100644 --- a/orcid-api-web/src/main/java/org/orcid/api/memberV2/server/delegator/impl/MemberV2ApiServiceDelegatorImpl.java +++ b/orcid-api-web/src/main/java/org/orcid/api/memberV2/server/delegator/impl/MemberV2ApiServiceDelegatorImpl.java @@ -62,6 +62,7 @@ import org.orcid.core.utils.SourceUtils; import org.orcid.core.version.impl.Api2_0_LastModifiedDatesHelper; import org.orcid.jaxb.model.client_v2.ClientSummary; +import org.orcid.jaxb.model.common_v2.Source; import org.orcid.jaxb.model.groupid_v2.GroupIdRecord; import org.orcid.jaxb.model.groupid_v2.GroupIdRecords; import org.orcid.jaxb.model.message.ScopePathType; @@ -1119,6 +1120,9 @@ private void processProfessionalEmails(Emails emails) { EmailDomainEntity domainInfo = emailDomainManager.findByEmailDomain(domain); // Set appropriate source name and source id for professional emails if (domainInfo != null && domainInfo.getCategory().equals(EmailDomainEntity.DomainCategory.PROFESSIONAL)) { + if(email.getSource() == null) { + email.setSource(new Source()); + } email.setSource(sourceEntityUtils.convertEmailSourceToOrcidValidator(email.getSource())); } } diff --git a/orcid-core/src/main/java/org/orcid/core/manager/read_only/impl/PersonDetailsManagerReadOnlyImpl.java b/orcid-core/src/main/java/org/orcid/core/manager/read_only/impl/PersonDetailsManagerReadOnlyImpl.java index 95142163c7..718750953c 100644 --- a/orcid-core/src/main/java/org/orcid/core/manager/read_only/impl/PersonDetailsManagerReadOnlyImpl.java +++ b/orcid-core/src/main/java/org/orcid/core/manager/read_only/impl/PersonDetailsManagerReadOnlyImpl.java @@ -14,6 +14,7 @@ import org.orcid.core.manager.read_only.RecordNameManagerReadOnly; import org.orcid.core.manager.read_only.ResearcherUrlManagerReadOnly; import org.orcid.core.utils.SourceEntityUtils; +import org.orcid.jaxb.model.common_v2.Source; import org.orcid.jaxb.model.common_v2.Visibility; import org.orcid.jaxb.model.record_v2.Address; import org.orcid.jaxb.model.record_v2.Addresses; @@ -211,6 +212,9 @@ private void processProfessionalEmails(Emails emails) { EmailDomainEntity domainInfo = emailDomainManager.findByEmailDomain(domain); // Set appropriate source name and source id for professional emails if (domainInfo != null && domainInfo.getCategory().equals(EmailDomainEntity.DomainCategory.PROFESSIONAL)) { + if(email.getSource() == null) { + email.setSource(new Source()); + } email.setSource(sourceEntityUtils.convertEmailSourceToOrcidValidator(email.getSource())); } } diff --git a/orcid-pub-web/src/main/java/org/orcid/api/publicV2/server/delegator/impl/PublicV2ApiServiceDelegatorImpl.java b/orcid-pub-web/src/main/java/org/orcid/api/publicV2/server/delegator/impl/PublicV2ApiServiceDelegatorImpl.java index d4bd980926..f4b5ac9eec 100644 --- a/orcid-pub-web/src/main/java/org/orcid/api/publicV2/server/delegator/impl/PublicV2ApiServiceDelegatorImpl.java +++ b/orcid-pub-web/src/main/java/org/orcid/api/publicV2/server/delegator/impl/PublicV2ApiServiceDelegatorImpl.java @@ -51,6 +51,7 @@ import org.orcid.core.utils.SourceUtils; import org.orcid.core.version.impl.Api2_0_LastModifiedDatesHelper; import org.orcid.jaxb.model.client_v2.ClientSummary; +import org.orcid.jaxb.model.common_v2.Source; import org.orcid.jaxb.model.common_v2.Visibility; import org.orcid.jaxb.model.groupid_v2.GroupIdRecord; import org.orcid.jaxb.model.groupid_v2.GroupIdRecords; @@ -628,6 +629,9 @@ private void processProfessionalEmails(Emails emails) { EmailDomainEntity domainInfo = emailDomainManager.findByEmailDomain(domain); // Set appropriate source name and source id for professional emails if (domainInfo != null && domainInfo.getCategory().equals(EmailDomainEntity.DomainCategory.PROFESSIONAL)) { + if(email.getSource() == null) { + email.setSource(new Source()); + } email.setSource(sourceEntityUtils.convertEmailSourceToOrcidValidator(email.getSource())); } }