use of org.orcid.jaxb.model.message.WorkExternalIdentifiers in project ORCID-Source by ORCID.
the class OrcidIndexManagerImplTest method getStandardOrcid.
private OrcidProfile getStandardOrcid() {
OrcidProfile orcidProfile = new OrcidProfile();
orcidProfile.setOrcidIdentifier("1234");
OrcidBio orcidBio = new OrcidBio();
ContactDetails contactDetails = new ContactDetails();
Email email = new Email("email");
email.setVisibility(Visibility.PUBLIC);
contactDetails.addOrReplacePrimaryEmail(email);
orcidBio.setContactDetails(contactDetails);
Keywords bioKeywords = new Keywords();
bioKeywords.getKeyword().add(new Keyword("Pavement Studies", Visibility.PUBLIC));
bioKeywords.getKeyword().add(new Keyword("Advanced Tea Making", Visibility.PUBLIC));
bioKeywords.setVisibility(Visibility.PUBLIC);
orcidBio.setKeywords(bioKeywords);
PersonalDetails personalDetails = new PersonalDetails();
CreditName creditName = new CreditName("credit name");
creditName.setVisibility(Visibility.PUBLIC);
personalDetails.setCreditName(creditName);
FamilyName familyName = new FamilyName("familyName");
familyName.setVisibility(Visibility.PUBLIC);
personalDetails.setFamilyName(familyName);
OtherNames otherNames = new OtherNames();
otherNames.setVisibility(Visibility.PUBLIC);
otherNames.getOtherName().add(new OtherName("Other 1", Visibility.PUBLIC));
otherNames.getOtherName().add(new OtherName("Other 2", Visibility.PUBLIC));
personalDetails.setOtherNames(otherNames);
GivenNames givenNames = new GivenNames("givenNames");
givenNames.setVisibility(Visibility.PUBLIC);
personalDetails.setGivenNames(givenNames);
orcidBio.setPersonalDetails(personalDetails);
ExternalIdentifiers externalIdentifiers = new ExternalIdentifiers();
externalIdentifiers.setVisibility(Visibility.PUBLIC);
orcidBio.setExternalIdentifiers(externalIdentifiers);
ExternalIdentifier externalIdentifier1 = createExternalIdentifier("45678", "defghi");
externalIdentifiers.getExternalIdentifier().add(externalIdentifier1);
ExternalIdentifier externalIdentifier2 = createExternalIdentifier("54321", "abc123");
externalIdentifiers.getExternalIdentifier().add(externalIdentifier2);
OrcidActivities orcidActivities = new OrcidActivities();
orcidProfile.setOrcidActivities(orcidActivities);
Affiliations affiliations = new Affiliations();
orcidActivities.setAffiliations(affiliations);
FundingList fundings = new FundingList();
orcidActivities.setFundings(fundings);
OrcidWorks orcidWorks = new OrcidWorks();
OrcidWork orcidWork1 = new OrcidWork();
orcidWork1.setVisibility(Visibility.PUBLIC);
OrcidWork orcidWork2 = new OrcidWork();
orcidWork2.setVisibility(Visibility.PUBLIC);
OrcidWork orcidWork3 = new OrcidWork();
orcidWork3.setVisibility(Visibility.LIMITED);
WorkTitle workTitle1 = new WorkTitle();
Title title1 = new Title("Work title 1");
workTitle1.setTitle(title1);
workTitle1.setSubtitle(null);
orcidWork1.setWorkTitle(workTitle1);
WorkExternalIdentifier wei = new WorkExternalIdentifier();
wei.setWorkExternalIdentifierId(new WorkExternalIdentifierId("work1-pmid"));
wei.setWorkExternalIdentifierType(WorkExternalIdentifierType.PMID);
orcidWork1.setWorkExternalIdentifiers(new WorkExternalIdentifiers(Arrays.asList(wei)));
WorkTitle workTitle2 = new WorkTitle();
Title title2 = new Title("Work title 2");
workTitle2.setSubtitle(null);
workTitle2.setTitle(title2);
orcidWork2.setWorkTitle(workTitle2);
WorkTitle workTitle3 = new WorkTitle();
Title title3 = new Title("Work Title 3");
workTitle3.setSubtitle(null);
workTitle3.setTitle(title3);
orcidWork3.setWorkTitle(workTitle3);
orcidWorks.setOrcidWork(new ArrayList<OrcidWork>(Arrays.asList(new OrcidWork[] { orcidWork1, orcidWork2, orcidWork3 })));
orcidProfile.setOrcidWorks(orcidWorks);
orcidProfile.setOrcidBio(orcidBio);
return orcidProfile;
}
use of org.orcid.jaxb.model.message.WorkExternalIdentifiers in project ORCID-Source by ORCID.
the class OrcidProfileManagerImplTest method getOrcidWork.
private OrcidWork getOrcidWork(String workName, boolean isExistingWork) {
OrcidWork orcidWork = new OrcidWork();
if (isExistingWork) {
orcidWork.setPutCode(String.valueOf(currentWorkId));
currentWorkId += 1;
}
//Set title
WorkTitle title = new WorkTitle();
if (isExistingWork)
title.setTitle(new Title("Title for " + workName));
else
title.setTitle(new Title("Title for " + workName + "->updated"));
orcidWork.setWorkTitle(title);
//Set source
Source workSource = new Source(TEST_ORCID);
orcidWork.setSource(workSource);
//Set external identifiers
WorkExternalIdentifier extId1 = new WorkExternalIdentifier();
extId1.setWorkExternalIdentifierId(new WorkExternalIdentifierId("doi-" + workName));
extId1.setWorkExternalIdentifierType(WorkExternalIdentifierType.DOI);
WorkExternalIdentifier extId2 = new WorkExternalIdentifier();
if (isExistingWork)
extId2.setWorkExternalIdentifierId(new WorkExternalIdentifierId("issn-" + workName));
else
extId2.setWorkExternalIdentifierId(new WorkExternalIdentifierId("issn-" + workName + "->updated"));
extId2.setWorkExternalIdentifierType(WorkExternalIdentifierType.ISSN);
WorkExternalIdentifiers extIds = new WorkExternalIdentifiers();
extIds.getWorkExternalIdentifier().add(extId1);
extIds.getWorkExternalIdentifier().add(extId2);
orcidWork.setWorkExternalIdentifiers(extIds);
return orcidWork;
}
use of org.orcid.jaxb.model.message.WorkExternalIdentifiers in project ORCID-Source by ORCID.
the class Api12Helper method addWork.
protected static void addWork(String userOrcid, String token, String title, T2OAuthAPIService<ClientResponse> oauthT2Client) {
String id = String.valueOf(System.currentTimeMillis());
OrcidMessage orcidMessage = new OrcidMessage();
orcidMessage.setMessageVersion(OrcidMessage.DEFAULT_VERSION);
OrcidProfile orcidProfile = new OrcidProfile();
orcidMessage.setOrcidProfile(orcidProfile);
OrcidActivities orcidActivities = new OrcidActivities();
orcidProfile.setOrcidActivities(orcidActivities);
OrcidWorks orcidWorks = new OrcidWorks();
orcidActivities.setOrcidWorks(orcidWorks);
OrcidWork orcidWork = new OrcidWork();
orcidWorks.getOrcidWork().add(orcidWork);
orcidWork.setWorkType(WorkType.JOURNAL_ARTICLE);
orcidWork.setVisibility(Visibility.LIMITED);
WorkTitle workTitle = new WorkTitle();
orcidWork.setWorkTitle(workTitle);
WorkExternalIdentifier wei = new WorkExternalIdentifier();
wei.setWorkExternalIdentifierId(new WorkExternalIdentifierId(id));
wei.setWorkExternalIdentifierType(WorkExternalIdentifierType.DOI);
WorkExternalIdentifiers extIds = new WorkExternalIdentifiers();
extIds.getWorkExternalIdentifier().add(wei);
orcidWork.setWorkExternalIdentifiers(extIds);
workTitle.setTitle(new Title(title));
ClientResponse clientResponse = oauthT2Client.addWorksXml(userOrcid, orcidMessage, token);
assertEquals(201, clientResponse.getStatus());
}
use of org.orcid.jaxb.model.message.WorkExternalIdentifiers in project ORCID-Source by ORCID.
the class OrcidMessageVersionConverterImplV1_2_rc5ToV1_2_rc6 method downGradeActivity.
private void downGradeActivity(OrcidWork orcidWork) {
Source source = orcidWork.getSource();
if (source != null) {
SourceOrcid sourceOrcid = source.getSourceOrcid();
if (sourceOrcid != null) {
orcidWork.setSource(null);
orcidWork.setWorkSource(new WorkSource(sourceOrcid));
}
}
WorkExternalIdentifiers externalIdentifiers = orcidWork.getWorkExternalIdentifiers();
if (externalIdentifiers != null) {
for (WorkExternalIdentifier wei : externalIdentifiers.getWorkExternalIdentifier()) {
WorkExternalIdentifierType type = wei.getWorkExternalIdentifierType();
if (type != null) {
if (Arrays.binarySearch(NEW_WORK_EXT_ID_TYPES, type) >= 0) {
wei.setWorkExternalIdentifierType(OTHER_ID);
}
}
}
}
}
use of org.orcid.jaxb.model.message.WorkExternalIdentifiers in project ORCID-Source by ORCID.
the class OrcidIndexManagerImplTest method getStandardOrcidWithDoiInformation.
private OrcidProfile getStandardOrcidWithDoiInformation() {
OrcidProfile orcidProfile = getStandardOrcid();
OrcidWork orcidWork1 = orcidProfile.retrieveOrcidWorks().getOrcidWork().get(0);
OrcidWork orcidWork2 = orcidProfile.retrieveOrcidWorks().getOrcidWork().get(1);
OrcidWork orcidWork3 = orcidProfile.retrieveOrcidWorks().getOrcidWork().get(2);
WorkExternalIdentifiers work1ExternalIdentifiers = new WorkExternalIdentifiers();
WorkExternalIdentifier work1ExternalIdentifier1 = new WorkExternalIdentifier();
work1ExternalIdentifier1.setWorkExternalIdentifierType(WorkExternalIdentifierType.DOI);
work1ExternalIdentifier1.setWorkExternalIdentifierId(new WorkExternalIdentifierId("work1-doi1"));
WorkExternalIdentifier work1ExternalIdentifier2 = new WorkExternalIdentifier();
work1ExternalIdentifier2.setWorkExternalIdentifierType(WorkExternalIdentifierType.PMID);
work1ExternalIdentifier2.setWorkExternalIdentifierId(new WorkExternalIdentifierId("work1-pmid"));
work1ExternalIdentifiers.getWorkExternalIdentifier().add(work1ExternalIdentifier1);
work1ExternalIdentifiers.getWorkExternalIdentifier().add(work1ExternalIdentifier2);
orcidWork1.setWorkExternalIdentifiers(work1ExternalIdentifiers);
WorkExternalIdentifiers work2ExternalIdentifiers = new WorkExternalIdentifiers();
WorkExternalIdentifier work2ExternalIdentifier1 = new WorkExternalIdentifier();
work2ExternalIdentifier1.setWorkExternalIdentifierType(WorkExternalIdentifierType.DOI);
work2ExternalIdentifier1.setWorkExternalIdentifierId(new WorkExternalIdentifierId("work2-doi1"));
WorkExternalIdentifier work2ExternalIdentifier2 = new WorkExternalIdentifier();
work2ExternalIdentifier2.setWorkExternalIdentifierType(WorkExternalIdentifierType.DOI);
work2ExternalIdentifier2.setWorkExternalIdentifierId(new WorkExternalIdentifierId("work2-doi2"));
work2ExternalIdentifiers.getWorkExternalIdentifier().add(work2ExternalIdentifier1);
work2ExternalIdentifiers.getWorkExternalIdentifier().add(work2ExternalIdentifier2);
orcidWork2.setWorkExternalIdentifiers(work2ExternalIdentifiers);
WorkExternalIdentifiers work3ExternalIdentifiers = new WorkExternalIdentifiers();
WorkExternalIdentifier work3ExternalIdentifier1 = new WorkExternalIdentifier();
work3ExternalIdentifier1.setWorkExternalIdentifierType(WorkExternalIdentifierType.DOI);
work3ExternalIdentifier1.setWorkExternalIdentifierId(new WorkExternalIdentifierId("work3-doi1"));
WorkExternalIdentifier work3ExternalIdentifier2 = new WorkExternalIdentifier();
work3ExternalIdentifier2.setWorkExternalIdentifierType(WorkExternalIdentifierType.DOI);
work3ExternalIdentifier2.setWorkExternalIdentifierId(new WorkExternalIdentifierId("work3-doi2"));
work3ExternalIdentifiers.getWorkExternalIdentifier().add(work3ExternalIdentifier1);
work3ExternalIdentifiers.getWorkExternalIdentifier().add(work3ExternalIdentifier2);
orcidWork3.setWorkExternalIdentifiers(work3ExternalIdentifiers);
return orcidProfile;
}
Aggregations