use of org.orcid.jaxb.model.message.OrcidActivities in project ORCID-Source by ORCID.
the class OrcidSearchManagerImplTest method getOrcidProfileAllIndexFieldsPopulated.
private OrcidProfile getOrcidProfileAllIndexFieldsPopulated() {
OrcidProfile orcidProfile = new OrcidProfile();
orcidProfile.setOrcidIdentifier("5678");
OrcidBio orcidBio = new OrcidBio();
PersonalDetails personalDetails = new PersonalDetails();
personalDetails.setFamilyName(new FamilyName("Logan"));
personalDetails.setGivenNames(new GivenNames("Donald Edward"));
personalDetails.setCreditName(new CreditName("Stanley Higgins"));
OtherNames otherNames = new OtherNames();
otherNames.getOtherName().add(new OtherName("Edward Bass", null));
otherNames.getOtherName().add(new OtherName("Gareth Dove", null));
personalDetails.setOtherNames(otherNames);
orcidBio.setPersonalDetails(personalDetails);
orcidProfile.setOrcidBio(orcidBio);
OrcidActivities orcidActivities = new OrcidActivities();
orcidProfile.setOrcidActivities(orcidActivities);
Affiliations affiliations = new Affiliations();
orcidActivities.setAffiliations(affiliations);
OrcidWorks orcidWorks = new OrcidWorks();
orcidProfile.setOrcidWorks(orcidWorks);
OrcidWork orcidWork1 = new OrcidWork();
OrcidWork orcidWork2 = new OrcidWork();
assignWorkIdentifers(orcidWork1, orcidWork2);
orcidWorks.getOrcidWork().add(orcidWork1);
orcidWorks.getOrcidWork().add(orcidWork2);
orcidProfile.setOrcidWorks(orcidWorks);
FundingList orcidFundings = new FundingList();
orcidProfile.setFundings(orcidFundings);
Funding funding1 = new Funding();
funding1.setVisibility(Visibility.PUBLIC);
FundingTitle title = new FundingTitle();
title.setTitle(new Title("grant1"));
funding1.setTitle(title);
funding1.setDescription("Grant 1 - a short description");
funding1.setPutCode("grant 1 - put-code");
Funding funding2 = new Funding();
funding2.setVisibility(Visibility.PUBLIC);
FundingTitle title2 = new FundingTitle();
title2.setTitle(new Title("grant2"));
funding2.setTitle(title2);
funding2.setDescription("Grant 2 - a short description");
funding2.setPutCode("grant 2 - put-code");
orcidFundings.getFundings().add(funding1);
orcidFundings.getFundings().add(funding2);
return orcidProfile;
}
use of org.orcid.jaxb.model.message.OrcidActivities in project ORCID-Source by ORCID.
the class OrcidSearchManagerImplTest method getOrcidProfile6789MandatoryOnly.
private OrcidProfile getOrcidProfile6789MandatoryOnly() {
OrcidProfile orcidProfile = new OrcidProfile();
orcidProfile.setOrcidIdentifier("6789");
OrcidBio orcidBio = new OrcidBio();
orcidProfile.setOrcidBio(orcidBio);
ContactDetails contactDetails = new ContactDetails();
contactDetails.addOrReplacePrimaryEmail(new Email("don@semantico.com"));
orcidBio.setContactDetails(contactDetails);
PersonalDetails personalDetails = new PersonalDetails();
orcidBio.setPersonalDetails(personalDetails);
personalDetails.setFamilyName(new FamilyName("Thomson"));
personalDetails.setGivenNames(new GivenNames("Homer J"));
OrcidActivities orcidActivities = new OrcidActivities();
orcidProfile.setOrcidActivities(orcidActivities);
Affiliations affiliations = new Affiliations();
orcidActivities.setAffiliations(affiliations);
return orcidProfile;
}
use of org.orcid.jaxb.model.message.OrcidActivities in project ORCID-Source by ORCID.
the class Api12Helper method addFunding.
protected static void addFunding(String userOrcid, String token, String title, T2OAuthAPIService<ClientResponse> oauthT2Client) {
OrcidMessage orcidMessage = new OrcidMessage();
orcidMessage.setMessageVersion(OrcidMessage.DEFAULT_VERSION);
OrcidProfile orcidProfile = new OrcidProfile();
orcidMessage.setOrcidProfile(orcidProfile);
OrcidActivities orcidActivities = new OrcidActivities();
orcidProfile.setOrcidActivities(orcidActivities);
FundingList fundings = new FundingList();
Funding funding = new Funding();
funding.setVisibility(Visibility.LIMITED);
FundingTitle fundingTitle = new FundingTitle();
fundingTitle.setTitle(new Title(title));
funding.setTitle(fundingTitle);
funding.setType(FundingType.SALARY_AWARD);
Amount amount = new Amount();
amount.setCurrencyCode("CRC");
amount.setContent("1,250,000");
funding.setAmount(amount);
funding.setStartDate(new FuzzyDate(2010, 1, 1));
funding.setEndDate(new FuzzyDate(2013, 1, 1));
funding.setDescription("My Grant description");
funding.setUrl(new Url("http://url.com"));
Organization org = new Organization();
org.setName("Orcid Integration Test Org");
OrganizationAddress add = new OrganizationAddress();
add.setCity("My City");
add.setCountry(Iso3166Country.CR);
org.setAddress(add);
funding.setOrganization(org);
FundingExternalIdentifier extIdentifier = new FundingExternalIdentifier();
extIdentifier.setType(FundingExternalIdentifierType.fromValue("grant_number"));
extIdentifier.setUrl(new Url("http://url.com"));
extIdentifier.setValue("My value");
FundingExternalIdentifiers extIdentifiers = new FundingExternalIdentifiers();
extIdentifiers.getFundingExternalIdentifier().add(extIdentifier);
funding.setFundingExternalIdentifiers(extIdentifiers);
FundingContributors contributors = new FundingContributors();
FundingContributor contributor = new FundingContributor();
contributor.setCreditName(new CreditName("My Credit Name"));
contributor.setContributorEmail(new ContributorEmail("my.email@orcid-integration-test.com"));
FundingContributorAttributes attributes = new FundingContributorAttributes();
attributes.setContributorRole(FundingContributorRole.LEAD);
contributor.setContributorAttributes(attributes);
contributors.getContributor().add(contributor);
funding.setFundingContributors(contributors);
fundings.getFundings().add(funding);
orcidMessage.getOrcidProfile().getOrcidActivities().setFundings(fundings);
ClientResponse clientResponse = oauthT2Client.addFundingXml(userOrcid, orcidMessage, token);
assertEquals(201, clientResponse.getStatus());
}
use of org.orcid.jaxb.model.message.OrcidActivities 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.OrcidActivities in project ORCID-Source by ORCID.
the class OrcidProfileManagerImpl method setWorkPrivacy.
private void setWorkPrivacy(OrcidProfile updatedOrcidProfile, Visibility defaultWorkVisibility) {
OrcidHistory orcidHistory = updatedOrcidProfile.getOrcidHistory();
boolean isClaimed = orcidHistory != null ? orcidHistory.getClaimed().isValue() : false;
OrcidActivities incomingActivities = updatedOrcidProfile.getOrcidActivities();
if (incomingActivities != null) {
OrcidWorks incomingWorks = incomingActivities.getOrcidWorks();
if (incomingWorks != null) {
setWorkPrivacy(incomingWorks, defaultWorkVisibility, isClaimed);
}
}
}
Aggregations