Skip to content

Commit

Permalink
If the source is null lets add one
Browse files Browse the repository at this point in the history
  • Loading branch information
amontenegro committed Dec 9, 2024
1 parent 8d7c2e5 commit 4d72057
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()));
}
}
Expand Down

0 comments on commit 4d72057

Please sign in to comment.