use of org.orcid.jaxb.model.v3.dev1.search.Result in project ORCID-Source by ORCID.
the class AffiliationsManagerReadOnlyImpl method getAffiliations.
@Override
public List<Affiliation> getAffiliations(String orcid) {
List<OrgAffiliationRelationEntity> affiliations = orgAffiliationRelationDao.getByUser(orcid);
List<Affiliation> result = new ArrayList<Affiliation>();
if (affiliations != null) {
for (OrgAffiliationRelationEntity affiliation : affiliations) {
switch(affiliation.getAffiliationType()) {
case DISTINCTION:
result.add(jpaJaxbDistinctionAdapter.toDistinction(affiliation));
break;
case EDUCATION:
result.add(jpaJaxbEducationAdapter.toEducation(affiliation));
break;
case EMPLOYMENT:
result.add(jpaJaxbEmploymentAdapter.toEmployment(affiliation));
break;
case INVITED_POSITION:
result.add(jpaJaxbInvitedPositionAdapter.toInvitedPosition(affiliation));
break;
case MEMBERSHIP:
result.add(jpaJaxbMembershipAdapter.toMembership(affiliation));
break;
case QUALIFICATION:
result.add(jpaJaxbQualificationAdapter.toQualification(affiliation));
break;
case SERVICE:
result.add(jpaJaxbServiceAdapter.toService(affiliation));
break;
}
}
}
return result;
}
use of org.orcid.jaxb.model.v3.dev1.search.Result in project ORCID-Source by ORCID.
the class ActivitiesGroupGenerator_GroupingWorksTest method generateWorks.
/**
* work-1 -> ARG(A), ARG(B), ARG(C)
* work-2 -> ARG(C), ARG(D), ARG(E)
* work-3 -> ARG(X), ARG(Y), ARG(Z)
* work-4 -> ARG(Y), ARG(B), ARG(1)
* work-5 -> ARG(M), ARG(N), ARG(O)
* work-6 -> ARXIV(A), ARXIV(B), ARXIV(C)
* work-7 -> DOI(1), DOI(2), ARIXV(B)
* work-8 -> No external identifiers
* work-9 -> No external identifiers
* work-10 -> ISSN(1), ISSN(2), ISSN(3)
* work-11 -> ISSN(3), ISSN(4), ISSN(5)
* work-12 -> DOI(1), ISSN(1)
* work-13 -> DOI(1), ISSN(4)
*/
private Map<String, WorkSummary> generateWorks() {
Map<String, WorkSummary> result = new HashMap<String, WorkSummary>();
for (int i = 1; i < 14; i++) {
String title = "work-" + i;
WorkSummary work = new WorkSummary();
// Set title
WorkTitle workTitle = new WorkTitle();
workTitle.setTitle(new Title(title));
work.setTitle(workTitle);
ExternalIDs wei = new ExternalIDs();
switch(i) {
case 1:
ExternalID e1 = new ExternalID();
e1.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
e1.setValue("A");
ExternalID e2 = new ExternalID();
e2.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
e2.setValue("B");
ExternalID e3 = new ExternalID();
e3.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
e3.setValue("C");
wei.getExternalIdentifier().add(e1);
wei.getExternalIdentifier().add(e2);
wei.getExternalIdentifier().add(e3);
break;
case 2:
ExternalID e4 = new ExternalID();
e4.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
e4.setValue("C");
ExternalID e5 = new ExternalID();
e5.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
e5.setValue("D");
ExternalID e6 = new ExternalID();
e6.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
e6.setValue("E");
wei.getExternalIdentifier().add(e4);
wei.getExternalIdentifier().add(e5);
wei.getExternalIdentifier().add(e6);
break;
case 3:
ExternalID e7 = new ExternalID();
e7.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
e7.setValue("X");
ExternalID e8 = new ExternalID();
e8.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
e8.setValue("Y");
ExternalID e9 = new ExternalID();
e9.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
e9.setValue("Z");
wei.getExternalIdentifier().add(e7);
wei.getExternalIdentifier().add(e8);
wei.getExternalIdentifier().add(e9);
break;
case 4:
ExternalID e10 = new ExternalID();
e10.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
e10.setValue("Y");
ExternalID e11 = new ExternalID();
e11.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
e11.setValue("B");
ExternalID e12 = new ExternalID();
e12.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
e12.setValue("1");
wei.getExternalIdentifier().add(e10);
wei.getExternalIdentifier().add(e11);
wei.getExternalIdentifier().add(e12);
break;
case 5:
ExternalID e13 = new ExternalID();
e13.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
e13.setValue("M");
ExternalID e14 = new ExternalID();
e14.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
e14.setValue("N");
ExternalID e15 = new ExternalID();
e15.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
e15.setValue("O");
wei.getExternalIdentifier().add(e13);
wei.getExternalIdentifier().add(e14);
wei.getExternalIdentifier().add(e15);
break;
case 6:
ExternalID e16 = new ExternalID();
e16.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.ARXIV.value());
e16.setValue("A");
ExternalID e17 = new ExternalID();
e17.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.ARXIV.value());
e17.setValue("B");
ExternalID e18 = new ExternalID();
e18.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.ARXIV.value());
e18.setValue("C");
wei.getExternalIdentifier().add(e16);
wei.getExternalIdentifier().add(e17);
wei.getExternalIdentifier().add(e18);
break;
case 7:
ExternalID e19 = new ExternalID();
e19.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.DOI.value());
e19.setValue("1");
ExternalID e20 = new ExternalID();
e20.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.DOI.value());
e20.setValue("2");
ExternalID e21 = new ExternalID();
e21.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.ARXIV.value());
e21.setValue("B");
wei.getExternalIdentifier().add(e19);
wei.getExternalIdentifier().add(e20);
wei.getExternalIdentifier().add(e21);
break;
case 10:
ExternalID e22 = new ExternalID();
e22.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.ISSN.value());
e22.setValue("1");
ExternalID e23 = new ExternalID();
e23.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.ISSN.value());
e23.setValue("2");
ExternalID e24 = new ExternalID();
e24.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.ISSN.value());
e24.setValue("3");
wei.getExternalIdentifier().add(e22);
wei.getExternalIdentifier().add(e23);
wei.getExternalIdentifier().add(e24);
break;
case 11:
ExternalID e25 = new ExternalID();
e25.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.ISSN.value());
e25.setValue("3");
ExternalID e26 = new ExternalID();
e26.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.ISSN.value());
e26.setValue("3");
ExternalID e27 = new ExternalID();
e27.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.ISSN.value());
e27.setValue("3");
wei.getExternalIdentifier().add(e25);
wei.getExternalIdentifier().add(e26);
wei.getExternalIdentifier().add(e27);
break;
case 12:
ExternalID e28 = new ExternalID();
e28.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.DOI.value());
e28.setValue("1");
ExternalID e29 = new ExternalID();
e29.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.ISSN.value());
e29.setValue("1");
wei.getExternalIdentifier().add(e28);
wei.getExternalIdentifier().add(e29);
break;
case 13:
ExternalID e30 = new ExternalID();
e30.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.DOI.value());
e30.setValue("1");
ExternalID e31 = new ExternalID();
e31.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.ISSN.value());
e31.setValue("4");
wei.getExternalIdentifier().add(e30);
wei.getExternalIdentifier().add(e31);
break;
}
work.setExternalIdentifiers(wei);
result.put(title, work);
}
return result;
}
use of org.orcid.jaxb.model.v3.dev1.search.Result in project ORCID-Source by ORCID.
the class ExternalIdentifierForm method toPersonExternalIdentifier.
public PersonExternalIdentifier toPersonExternalIdentifier() {
PersonExternalIdentifier result = new PersonExternalIdentifier();
if (putCode != null) {
result.setPutCode(Long.valueOf(putCode));
}
result.setDisplayIndex(displayIndex);
if (visibility != null && visibility.getVisibility() != null) {
result.setVisibility(org.orcid.jaxb.model.v3.dev1.common.Visibility.fromValue(visibility.getVisibility().value()));
}
if (url != null) {
result.setUrl(new Url(url));
}
result.setType(commonName);
result.setValue(reference);
return result;
}
use of org.orcid.jaxb.model.v3.dev1.search.Result in project ORCID-Source by ORCID.
the class FundingForm method valueOf.
public static FundingForm valueOf(Funding funding) {
FundingForm result = new FundingForm();
result.setDateSortString(PojoUtil.createDateSortString(funding.getStartDate(), funding.getEndDate()));
if (funding.getPutCode() != null)
result.setPutCode(Text.valueOf(funding.getPutCode()));
if (funding.getAmount() != null) {
if (StringUtils.isNotEmpty(funding.getAmount().getContent())) {
String cleanNumber = funding.getAmount().getContent().trim();
result.setAmount(Text.valueOf(cleanNumber));
}
if (funding.getAmount().getCurrencyCode() != null)
result.setCurrencyCode(Text.valueOf(funding.getAmount().getCurrencyCode()));
else
result.setCurrencyCode(new Text());
} else {
result.setAmount(new Text());
result.setCurrencyCode(new Text());
}
if (StringUtils.isNotEmpty(funding.getDescription()))
result.setDescription(Text.valueOf(funding.getDescription()));
else
result.setDescription(new Text());
if (funding.getStartDate() != null)
result.setStartDate(Date.valueOf(funding.getStartDate()));
if (funding.getEndDate() != null)
result.setEndDate(Date.valueOf(funding.getEndDate()));
if (funding.getType() != null)
result.setFundingType(Text.valueOf(funding.getType().value()));
else
result.setFundingType(new Text());
if (funding.getOrganizationDefinedType() != null) {
OrgDefinedFundingSubType OrgDefinedFundingSubType = new OrgDefinedFundingSubType();
OrgDefinedFundingSubType.setSubtype(Text.valueOf(funding.getOrganizationDefinedType().getContent()));
OrgDefinedFundingSubType.setAlreadyIndexed(false);
result.setOrganizationDefinedFundingSubType(OrgDefinedFundingSubType);
}
Source source = funding.getSource();
if (source != null) {
result.setSource(source.retrieveSourcePath());
if (source.getSourceName() != null) {
result.setSourceName(source.getSourceName().getContent());
}
}
if (funding.getTitle() != null) {
FundingTitleForm fundingTitle = new FundingTitleForm();
if (funding.getTitle().getTitle() != null)
fundingTitle.setTitle(Text.valueOf(funding.getTitle().getTitle().getContent()));
else
fundingTitle.setTitle(new Text());
if (funding.getTitle().getTranslatedTitle() != null) {
TranslatedTitleForm translatedTitle = new TranslatedTitleForm();
translatedTitle.setContent(funding.getTitle().getTranslatedTitle().getContent());
translatedTitle.setLanguageCode(funding.getTitle().getTranslatedTitle().getLanguageCode());
fundingTitle.setTranslatedTitle(translatedTitle);
}
result.setFundingTitle(fundingTitle);
} else {
FundingTitleForm fundingTitle = new FundingTitleForm();
fundingTitle.setTitle(new Text());
result.setFundingTitle(fundingTitle);
}
if (funding.getUrl() != null)
result.setUrl(Text.valueOf(funding.getUrl().getValue()));
else
result.setUrl(new Text());
if (funding.getVisibility() != null)
result.setVisibility(Visibility.valueOf(funding.getVisibility()));
// Set the disambiguated organization
Organization organization = funding.getOrganization();
result.setFundingName(Text.valueOf(organization.getName()));
DisambiguatedOrganization disambiguatedOrganization = organization.getDisambiguatedOrganization();
if (disambiguatedOrganization != null) {
if (StringUtils.isNotEmpty(disambiguatedOrganization.getDisambiguatedOrganizationIdentifier())) {
result.setDisambiguatedFundingSourceId(Text.valueOf(disambiguatedOrganization.getDisambiguatedOrganizationIdentifier()));
result.setDisambiguationSource(Text.valueOf(disambiguatedOrganization.getDisambiguationSource()));
}
}
OrganizationAddress organizationAddress = organization.getAddress();
if (organizationAddress != null) {
if (!PojoUtil.isEmpty(organizationAddress.getCity()))
result.setCity(Text.valueOf(organizationAddress.getCity()));
else
result.setCity(new Text());
if (!PojoUtil.isEmpty(organizationAddress.getRegion()))
result.setRegion(Text.valueOf(organizationAddress.getRegion()));
else
result.setRegion(new Text());
if (organizationAddress.getCountry() != null)
result.setCountry(Text.valueOf(organizationAddress.getCountry().value()));
else
result.setCountry(new Text());
} else {
result.setCountry(new Text());
result.setCity(new Text());
result.setRegion(new Text());
}
// Set contributors
if (funding.getContributors() != null) {
List<Contributor> contributors = new ArrayList<Contributor>();
for (FundingContributor fContributor : funding.getContributors().getContributor()) {
Contributor contributor = Contributor.valueOf(fContributor);
contributors.add(contributor);
}
result.setContributors(contributors);
}
List<FundingExternalIdentifierForm> externalIdentifiersList = new ArrayList<FundingExternalIdentifierForm>();
// Set external identifiers
if (funding.getExternalIdentifiers() != null) {
for (ExternalID fExternalIdentifier : funding.getExternalIdentifiers().getExternalIdentifier()) {
FundingExternalIdentifierForm fundingExternalIdentifierForm = FundingExternalIdentifierForm.valueOf(fExternalIdentifier);
externalIdentifiersList.add(fundingExternalIdentifierForm);
}
}
result.setExternalIdentifiers(externalIdentifiersList);
result.setCreatedDate(Date.valueOf(funding.getCreatedDate()));
result.setLastModified(Date.valueOf(funding.getLastModifiedDate()));
return result;
}
use of org.orcid.jaxb.model.v3.dev1.search.Result in project ORCID-Source by ORCID.
the class TranslatedTitleForm method toTranslatedTitle.
public TranslatedTitle toTranslatedTitle() {
TranslatedTitle result = new TranslatedTitle();
result.setContent(StringUtils.isEmpty(content) ? null : content);
result.setLanguageCode(StringUtils.isEmpty(languageCode) ? null : languageCode);
return result;
}
Aggregations