Skip to content

Commit 90071ed

Browse files
authored
Merge pull request #6874 from ORCID/TrimOrgData
Trim org data
2 parents 72f8eb1 + 58e1d97 commit 90071ed

2 files changed

Lines changed: 7 additions & 9 deletions

File tree

orcid-core/src/main/java/org/orcid/core/manager/impl/OrgManagerImpl.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import org.orcid.core.manager.OrgManager;
1010
import org.orcid.core.manager.SourceManager;
1111
import org.orcid.core.manager.read_only.ClientDetailsManagerReadOnly;
12+
import org.orcid.core.utils.OrcidStringUtils;
1213
import org.orcid.jaxb.model.common_v2.OrganizationHolder;
1314
import org.orcid.jaxb.model.message.Iso3166Country;
1415
import org.orcid.jaxb.model.message.Organization;
@@ -20,7 +21,6 @@
2021
import org.orcid.persistence.jpa.entities.OrgEntity;
2122
import org.orcid.persistence.jpa.entities.ProfileEntity;
2223
import org.orcid.persistence.jpa.entities.SourceEntity;
23-
import org.orcid.core.utils.OrcidStringUtils;
2424

2525
import au.com.bytecode.opencsv.CSVWriter;
2626

@@ -157,10 +157,10 @@ public OrgEntity getOrgEntity(OrganizationHolder holder) {
157157

158158
OrgEntity orgEntity = new OrgEntity();
159159
org.orcid.jaxb.model.common_v2.Organization organization = holder.getOrganization();
160-
orgEntity.setName(organization.getName());
160+
orgEntity.setName(organization.getName().trim());
161161
org.orcid.jaxb.model.common_v2.OrganizationAddress address = organization.getAddress();
162-
orgEntity.setCity(address.getCity());
163-
orgEntity.setRegion(address.getRegion() != null ? address.getRegion() : "");
162+
orgEntity.setCity(address.getCity().trim());
163+
orgEntity.setRegion(address.getRegion() != null ? address.getRegion().trim() : "");
164164
orgEntity.setCountry(address.getCountry().value());
165165
if (organization.getDisambiguatedOrganization() != null && organization.getDisambiguatedOrganization().getDisambiguatedOrganizationIdentifier() != null) {
166166
OrgDisambiguatedEntity disambiguatedOrg = orgDisambiguatedDao.findBySourceIdAndSourceType(

orcid-core/src/main/java/org/orcid/core/manager/v3/impl/OrgManagerImpl.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,10 @@ public OrgEntity getOrgEntity(OrganizationHolder holder) {
154154

155155
private OrgEntity getOrgEntity(org.orcid.jaxb.model.v3.release.common.Organization organization) {
156156
OrgEntity orgEntity = new OrgEntity();
157-
orgEntity.setName(organization.getName());
157+
orgEntity.setName(organization.getName().trim());
158158
org.orcid.jaxb.model.v3.release.common.OrganizationAddress address = organization.getAddress();
159-
orgEntity.setCity(address.getCity());
160-
orgEntity.setRegion(address.getRegion() != null ? address.getRegion() : "");
159+
orgEntity.setCity(address.getCity().trim());
160+
orgEntity.setRegion(address.getRegion() != null ? address.getRegion().trim() : "");
161161
orgEntity.setCountry(address.getCountry().name());
162162

163163
if (organization.getDisambiguatedOrganization() != null && organization.getDisambiguatedOrganization().getDisambiguatedOrganizationIdentifier() != null) {
@@ -275,6 +275,4 @@ private void updatePeerReviewOrgReferences(OrgEntity orgToReference, Long previo
275275
peerReviewDao.merge(p);
276276
});
277277
}
278-
279-
280278
}

0 commit comments

Comments
 (0)