use of org.orcid.core.exception.InvalidDisambiguatedOrgException in project ORCID-Source by ORCID.
the class OrgManagerImpl method getOrgEntity.
@Override
public OrgEntity getOrgEntity(OrganizationHolder holder) {
if (holder == null)
return null;
OrgEntity orgEntity = new OrgEntity();
org.orcid.jaxb.model.v3.dev1.common.Organization organization = holder.getOrganization();
orgEntity.setName(organization.getName());
org.orcid.jaxb.model.v3.dev1.common.OrganizationAddress address = organization.getAddress();
orgEntity.setCity(address.getCity());
orgEntity.setRegion(address.getRegion());
orgEntity.setCountry(Iso3166Country.fromValue(address.getCountry().value()));
if (organization.getDisambiguatedOrganization() != null && organization.getDisambiguatedOrganization().getDisambiguatedOrganizationIdentifier() != null) {
// if disambiguated org is present (must be for v3 API, but not UI) it must be valid
OrgDisambiguatedEntity disambiguatedOrg = orgDisambiguatedDao.findBySourceIdAndSourceType(organization.getDisambiguatedOrganization().getDisambiguatedOrganizationIdentifier(), organization.getDisambiguatedOrganization().getDisambiguationSource());
if (disambiguatedOrg == null) {
throw new InvalidDisambiguatedOrgException();
}
orgEntity.setOrgDisambiguated(disambiguatedOrg);
}
return matchOrCreateOrg(orgEntity);
}
Aggregations