use of org.orcid.jaxb.model.v3.dev1.common.OrganizationAddress in project ORCID-Source by ORCID.
the class Utils method getOrganization.
public static Organization getOrganization() {
Organization org = new Organization();
org.setName("Org Name");
OrganizationAddress add = new OrganizationAddress();
add.setCity("city");
add.setCountry(Iso3166Country.TT);
org.setAddress(add);
DisambiguatedOrganization disambiguatedOrg = new DisambiguatedOrganization();
disambiguatedOrg.setDisambiguatedOrganizationIdentifier("abc456");
disambiguatedOrg.setDisambiguationSource("WDB");
org.setDisambiguatedOrganization(disambiguatedOrg);
return org;
}
use of org.orcid.jaxb.model.v3.dev1.common.OrganizationAddress in project ORCID-Source by ORCID.
the class PeerReviewForm method toPeerReview.
public PeerReview toPeerReview() {
PeerReview peerReview = new PeerReview();
// Put Code
if (!PojoUtil.isEmpty(putCode)) {
peerReview.setPutCode(Long.valueOf(putCode.getValue()));
}
// Visibility
if (visibility != null && visibility.getVisibility() != null) {
peerReview.setVisibility(org.orcid.jaxb.model.v3.dev1.common.Visibility.fromValue(visibility.getVisibility().value()));
}
// Completion date
if (completionDate != null) {
peerReview.setCompletionDate(new FuzzyDate(completionDate.toFuzzyDate()));
}
// External identifiers
if (externalIdentifiers != null && !externalIdentifiers.isEmpty()) {
peerReview.setExternalIdentifiers(new ExternalIDs());
for (WorkExternalIdentifier extId : externalIdentifiers) {
peerReview.getExternalIdentifiers().getExternalIdentifier().add(extId.toRecordWorkExternalIdentifier());
}
}
// Set Organization
Organization organization = new Organization();
OrganizationAddress organizationAddress = new OrganizationAddress();
organization.setAddress(organizationAddress);
if (!PojoUtil.isEmpty(orgName)) {
organization.setName(orgName.getValue());
}
if (!PojoUtil.isEmpty(city)) {
organizationAddress.setCity(city.getValue());
}
if (!PojoUtil.isEmpty(region)) {
organizationAddress.setRegion(region.getValue());
}
if (!PojoUtil.isEmpty(country)) {
organizationAddress.setCountry(Iso3166Country.fromValue(country.getValue()));
}
if (!PojoUtil.isEmpty(disambiguatedOrganizationSourceId)) {
organization.setDisambiguatedOrganization(new DisambiguatedOrganization());
organization.getDisambiguatedOrganization().setDisambiguatedOrganizationIdentifier(disambiguatedOrganizationSourceId.getValue());
organization.getDisambiguatedOrganization().setDisambiguationSource(disambiguationSource.getValue());
}
peerReview.setOrganization(organization);
// Role
if (!PojoUtil.isEmpty(role)) {
peerReview.setRole(Role.fromValue(role.getValue()));
}
// Type
if (!PojoUtil.isEmpty(type)) {
peerReview.setType(PeerReviewType.fromValue(type.getValue()));
}
// Url
if (!PojoUtil.isEmpty(url)) {
peerReview.setUrl(new Url(url.getValue()));
}
// Group id
if (!PojoUtil.isEmpty(groupId)) {
peerReview.setGroupId(groupId.getValue());
}
// Subject external id
if (!PojoUtil.isEmpty(subjectExternalIdentifier)) {
ExternalID subjectExtId = new ExternalID();
if (!PojoUtil.isEmpty(subjectExternalIdentifier.getRelationship())) {
subjectExtId.setRelationship(Relationship.fromValue(subjectExternalIdentifier.getRelationship().getValue()));
}
if (!PojoUtil.isEmpty(subjectExternalIdentifier.getUrl())) {
subjectExtId.setUrl(new Url(subjectExternalIdentifier.getUrl().getValue()));
}
if (!PojoUtil.isEmpty(subjectExternalIdentifier.getWorkExternalIdentifierId())) {
subjectExtId.setValue(subjectExternalIdentifier.getWorkExternalIdentifierId().getValue());
}
if (!PojoUtil.isEmpty(subjectExternalIdentifier.getWorkExternalIdentifierType())) {
subjectExtId.setType(subjectExternalIdentifier.getWorkExternalIdentifierType().getValue());
}
peerReview.setSubjectExternalIdentifier(subjectExtId);
}
// Subject container name
if (!PojoUtil.isEmpty(subjectContainerName)) {
Title containerName = new Title(subjectContainerName.getValue());
peerReview.setSubjectContainerName(containerName);
}
// Subject type
if (!PojoUtil.isEmpty(subjectType)) {
peerReview.setSubjectType(WorkType.fromValue(subjectType.getValue()));
}
// Subject name and subject translated name
if (!PojoUtil.isEmpty(subjectName) || !PojoUtil.isEmpty(translatedSubjectName)) {
WorkTitle workTitle = new WorkTitle();
if (!PojoUtil.isEmpty(subjectName)) {
workTitle.setTitle(new Title(subjectName.getValue()));
}
if (translatedSubjectName != null) {
org.orcid.jaxb.model.v3.dev1.common.TranslatedTitle tTitle = new org.orcid.jaxb.model.v3.dev1.common.TranslatedTitle();
if (!PojoUtil.isEmpty(translatedSubjectName.getContent())) {
tTitle.setContent(translatedSubjectName.getContent());
}
if (!PojoUtil.isEmpty(translatedSubjectName.getLanguageCode())) {
tTitle.setLanguageCode(translatedSubjectName.getLanguageCode());
}
workTitle.setTranslatedTitle(tTitle);
}
peerReview.setSubjectName(workTitle);
}
// Subject url
if (!PojoUtil.isEmpty(subjectUrl)) {
peerReview.setSubjectUrl(new Url(subjectUrl.getValue()));
}
return peerReview;
}
use of org.orcid.jaxb.model.v3.dev1.common.OrganizationAddress in project ORCID-Source by ORCID.
the class FundingForm method toFunding.
public Funding toFunding() {
Funding result = new Funding();
Amount orcidAmount = new Amount();
if (!PojoUtil.isEmpty(amount))
orcidAmount.setContent(amount.getValue());
if (!PojoUtil.isEmpty(currencyCode))
orcidAmount.setCurrencyCode(currencyCode.getValue());
result.setAmount(orcidAmount);
if (!PojoUtil.isEmpty(description))
result.setDescription(description.getValue());
if (!PojoUtil.isEmpty(startDate))
result.setStartDate(new FuzzyDate(startDate.toFuzzyDate()));
if (!PojoUtil.isEmpty(endDate))
result.setEndDate(new FuzzyDate(endDate.toFuzzyDate()));
if (!PojoUtil.isEmpty(putCode))
result.setPutCode(Long.valueOf(putCode.getValue()));
if (fundingTitle != null) {
result.setTitle(fundingTitle.toFundingTitle());
}
if (!PojoUtil.isEmpty(fundingType))
result.setType(FundingType.fromValue(fundingType.getValue()));
if (organizationDefinedFundingSubType != null && !PojoUtil.isEmpty(organizationDefinedFundingSubType.getSubtype()))
result.setOrganizationDefinedType(new OrganizationDefinedFundingSubType(organizationDefinedFundingSubType.getSubtype().getValue()));
if (!PojoUtil.isEmpty(url))
result.setUrl(new Url(url.getValue()));
else
result.setUrl(new Url());
if (visibility != null)
result.setVisibility(org.orcid.jaxb.model.v3.dev1.common.Visibility.fromValue(visibility.getVisibility().value()));
// Set Organization
Organization organization = new Organization();
if (!PojoUtil.isEmpty(fundingName))
organization.setName(fundingName.getValue());
OrganizationAddress organizationAddress = new OrganizationAddress();
organization.setAddress(organizationAddress);
if (!PojoUtil.isEmpty(city))
organizationAddress.setCity(city.getValue());
if (!PojoUtil.isEmpty(region)) {
organizationAddress.setRegion(region.getValue());
}
if (!PojoUtil.isEmpty(country)) {
organizationAddress.setCountry(Iso3166Country.fromValue(country.getValue()));
}
if (!PojoUtil.isEmpty(disambiguatedFundingSourceId)) {
organization.setDisambiguatedOrganization(new DisambiguatedOrganization());
organization.getDisambiguatedOrganization().setDisambiguatedOrganizationIdentifier(disambiguatedFundingSourceId.getValue());
organization.getDisambiguatedOrganization().setDisambiguationSource(disambiguationSource.getValue());
}
result.setOrganization(organization);
// Set contributors
if (contributors != null && !contributors.isEmpty()) {
FundingContributors fContributors = new FundingContributors();
for (Contributor contributor : contributors) {
if (!PojoUtil.isEmtpy(contributor))
fContributors.getContributor().add(contributor.toFundingContributor());
}
result.setContributors(fContributors);
}
// Set external identifiers
if (externalIdentifiers != null && !externalIdentifiers.isEmpty()) {
ExternalIDs fExternalIdentifiers = new ExternalIDs();
for (FundingExternalIdentifierForm fExternalIdentifier : externalIdentifiers) {
if (!PojoUtil.isEmtpy(fExternalIdentifier))
fExternalIdentifiers.getExternalIdentifier().add(fExternalIdentifier.toFundingExternalIdentifier());
}
result.setExternalIdentifiers(fExternalIdentifiers);
}
return result;
}
use of org.orcid.jaxb.model.v3.dev1.common.OrganizationAddress in project ORCID-Source by ORCID.
the class AffiliationForm method toAffiliation.
public Affiliation toAffiliation() {
Affiliation affiliation = null;
if (AffiliationType.DISTINCTION.value().equals(affiliationType.getValue())) {
affiliation = new Distinction();
} else if (AffiliationType.EDUCATION.value().equals(affiliationType.getValue())) {
affiliation = new Education();
} else if (AffiliationType.EMPLOYMENT.value().equals(affiliationType.getValue())) {
affiliation = new Employment();
} else if (AffiliationType.INVITED_POSITION.value().equals(affiliationType.getValue())) {
affiliation = new InvitedPosition();
} else if (AffiliationType.MEMBERSHIP.value().equals(affiliationType.getValue())) {
affiliation = new Membership();
} else if (AffiliationType.QUALIFICATION.value().equals(affiliationType.getValue())) {
affiliation = new Qualification();
} else if (AffiliationType.SERVICE.value().equals(affiliationType.getValue())) {
affiliation = new Service();
}
if (!PojoUtil.isEmpty(putCode)) {
affiliation.setPutCode(Long.valueOf(putCode.getValue()));
}
if (visibility != null && visibility.getVisibility() != null) {
affiliation.setVisibility(org.orcid.jaxb.model.v3.dev1.common.Visibility.fromValue(visibility.getVisibility().value()));
}
Organization organization = new Organization();
affiliation.setOrganization(organization);
organization.setName(affiliationName.getValue());
OrganizationAddress organizationAddress = new OrganizationAddress();
organization.setAddress(organizationAddress);
organizationAddress.setCity(city.getValue());
if (!PojoUtil.isEmpty(region)) {
organizationAddress.setRegion(region.getValue());
}
if (!PojoUtil.isEmpty(disambiguatedAffiliationSourceId)) {
organization.setDisambiguatedOrganization(new DisambiguatedOrganization());
organization.getDisambiguatedOrganization().setDisambiguatedOrganizationIdentifier(disambiguatedAffiliationSourceId.getValue());
organization.getDisambiguatedOrganization().setDisambiguationSource(disambiguationSource.getValue());
}
organizationAddress.setCountry(Iso3166Country.fromValue(country.getValue()));
if (!PojoUtil.isEmpty(roleTitle)) {
affiliation.setRoleTitle(roleTitle.getValue());
}
if (!PojoUtil.isEmpty(departmentName)) {
affiliation.setDepartmentName(departmentName.getValue());
}
if (!PojoUtil.isEmpty(startDate)) {
affiliation.setStartDate(startDate.toV3FuzzyDate());
}
if (!PojoUtil.isEmpty(endDate)) {
affiliation.setEndDate(endDate.toV3FuzzyDate());
}
if (!PojoUtil.isEmpty(url)) {
affiliation.setUrl(new Url(url.getValue()));
}
if (affiliationExternalIdentifiers != null) {
ExternalIDs externalIDs = new ExternalIDs();
for (AffiliationExternalIdentifier affiliationExternalIdentifier : affiliationExternalIdentifiers) {
externalIDs.getExternalIdentifier().add(affiliationExternalIdentifier.toExternalID());
}
affiliation.setExternalIDs(externalIDs);
}
return affiliation;
}
use of org.orcid.jaxb.model.v3.dev1.common.OrganizationAddress in project ORCID-Source by ORCID.
the class AffiliationForm method valueOf.
public static AffiliationForm valueOf(Affiliation affiliation) {
AffiliationForm form = new AffiliationForm();
if (affiliation instanceof Distinction) {
form.setAffiliationType(Text.valueOf(AffiliationType.DISTINCTION.value()));
} else if (affiliation instanceof Education) {
form.setAffiliationType(Text.valueOf(AffiliationType.EDUCATION.value()));
} else if (affiliation instanceof Employment) {
form.setAffiliationType(Text.valueOf(AffiliationType.EMPLOYMENT.value()));
} else if (affiliation instanceof InvitedPosition) {
form.setAffiliationType(Text.valueOf(AffiliationType.INVITED_POSITION.value()));
} else if (affiliation instanceof Membership) {
form.setAffiliationType(Text.valueOf(AffiliationType.MEMBERSHIP.value()));
} else if (affiliation instanceof Qualification) {
form.setAffiliationType(Text.valueOf(AffiliationType.QUALIFICATION.value()));
} else if (affiliation instanceof Service) {
form.setAffiliationType(Text.valueOf(AffiliationType.SERVICE.value()));
}
form.setPutCode(Text.valueOf(affiliation.getPutCode()));
form.setVisibility(Visibility.valueOf(affiliation.getVisibility()));
Organization organization = affiliation.getOrganization();
form.setDateSortString(PojoUtil.createDateSortString(affiliation));
form.setAffiliationName(Text.valueOf(organization.getName()));
OrganizationAddress address = organization.getAddress();
form.setCity(Text.valueOf(address.getCity()));
if (organization.getDisambiguatedOrganization() != null) {
if (organization.getDisambiguatedOrganization().getDisambiguatedOrganizationIdentifier() != null) {
form.setDisambiguatedAffiliationSourceId(Text.valueOf(organization.getDisambiguatedOrganization().getDisambiguatedOrganizationIdentifier()));
form.setDisambiguationSource(Text.valueOf(organization.getDisambiguatedOrganization().getDisambiguationSource()));
form.setOrgDisambiguatedId(Text.valueOf(String.valueOf(organization.getDisambiguatedOrganization().getId())));
}
}
if (address.getRegion() != null) {
form.setRegion(Text.valueOf(address.getRegion()));
} else {
form.setRegion(new Text());
}
if (address.getCountry() != null) {
form.setCountry(Text.valueOf(address.getCountry().value()));
} else {
form.setCountry(new Text());
}
if (affiliation.getDepartmentName() != null) {
form.setDepartmentName(Text.valueOf(affiliation.getDepartmentName()));
} else {
form.setDepartmentName(new Text());
}
if (affiliation.getRoleTitle() != null) {
form.setRoleTitle(Text.valueOf(affiliation.getRoleTitle()));
} else {
form.setRoleTitle(new Text());
}
if (affiliation.getStartDate() != null) {
form.setStartDate(Date.valueOf(affiliation.getStartDate()));
}
if (affiliation.getEndDate() != null) {
form.setEndDate(Date.valueOf(affiliation.getEndDate()));
}
Source source = affiliation.getSource();
if (source != null) {
form.setSource(source.retrieveSourcePath());
if (source.getSourceName() != null) {
form.setSourceName(source.getSourceName().getContent());
}
}
if (affiliation.getUrl() != null) {
form.setUrl(Text.valueOf(affiliation.getUrl().getValue()));
} else {
form.setUrl(new Text());
}
if (affiliation.getExternalIDs() != null) {
List<AffiliationExternalIdentifier> affiliationExternalIdentifiers = new ArrayList<>();
for (ExternalID externalID : affiliation.getExternalIDs().getExternalIdentifier()) {
affiliationExternalIdentifiers.add(AffiliationExternalIdentifier.valueOf(externalID));
}
form.setAffiliationExternalIdentifiers(affiliationExternalIdentifiers);
}
form.setCreatedDate(Date.valueOf(affiliation.getCreatedDate()));
form.setLastModified(Date.valueOf(affiliation.getLastModifiedDate()));
return form;
}
Aggregations