Search in sources :

Example 11 with OrcidActivities

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;
}
Also used : OrcidBio(org.orcid.jaxb.model.message.OrcidBio) FamilyName(org.orcid.jaxb.model.message.FamilyName) OtherNames(org.orcid.jaxb.model.message.OtherNames) Funding(org.orcid.jaxb.model.message.Funding) CreditName(org.orcid.jaxb.model.message.CreditName) OtherName(org.orcid.jaxb.model.message.OtherName) OrcidWork(org.orcid.jaxb.model.message.OrcidWork) Title(org.orcid.jaxb.model.message.Title) FundingTitle(org.orcid.jaxb.model.message.FundingTitle) PersonalDetails(org.orcid.jaxb.model.message.PersonalDetails) OrcidActivities(org.orcid.jaxb.model.message.OrcidActivities) OrcidWorks(org.orcid.jaxb.model.message.OrcidWorks) OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) FundingList(org.orcid.jaxb.model.message.FundingList) Affiliations(org.orcid.jaxb.model.message.Affiliations) GivenNames(org.orcid.jaxb.model.message.GivenNames) FundingTitle(org.orcid.jaxb.model.message.FundingTitle)

Example 12 with OrcidActivities

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;
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) Email(org.orcid.jaxb.model.message.Email) OrcidBio(org.orcid.jaxb.model.message.OrcidBio) ContactDetails(org.orcid.jaxb.model.message.ContactDetails) FamilyName(org.orcid.jaxb.model.message.FamilyName) Affiliations(org.orcid.jaxb.model.message.Affiliations) GivenNames(org.orcid.jaxb.model.message.GivenNames) PersonalDetails(org.orcid.jaxb.model.message.PersonalDetails) OrcidActivities(org.orcid.jaxb.model.message.OrcidActivities)

Example 13 with OrcidActivities

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());
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) Organization(org.orcid.jaxb.model.message.Organization) Funding(org.orcid.jaxb.model.message.Funding) Amount(org.orcid.jaxb.model.message.Amount) OrganizationAddress(org.orcid.jaxb.model.message.OrganizationAddress) FundingContributor(org.orcid.jaxb.model.message.FundingContributor) FuzzyDate(org.orcid.jaxb.model.message.FuzzyDate) CreditName(org.orcid.jaxb.model.message.CreditName) Title(org.orcid.jaxb.model.message.Title) WorkTitle(org.orcid.jaxb.model.message.WorkTitle) FundingTitle(org.orcid.jaxb.model.message.FundingTitle) OrcidActivities(org.orcid.jaxb.model.message.OrcidActivities) FundingExternalIdentifier(org.orcid.jaxb.model.message.FundingExternalIdentifier) ContributorEmail(org.orcid.jaxb.model.message.ContributorEmail) Url(org.orcid.jaxb.model.message.Url) OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) FundingList(org.orcid.jaxb.model.message.FundingList) OrcidMessage(org.orcid.jaxb.model.message.OrcidMessage) FundingContributors(org.orcid.jaxb.model.message.FundingContributors) FundingContributorAttributes(org.orcid.jaxb.model.message.FundingContributorAttributes) FundingTitle(org.orcid.jaxb.model.message.FundingTitle) FundingExternalIdentifiers(org.orcid.jaxb.model.message.FundingExternalIdentifiers)

Example 14 with OrcidActivities

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());
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) ClientResponse(com.sun.jersey.api.client.ClientResponse) WorkExternalIdentifiers(org.orcid.jaxb.model.message.WorkExternalIdentifiers) WorkTitle(org.orcid.jaxb.model.message.WorkTitle) OrcidMessage(org.orcid.jaxb.model.message.OrcidMessage) OrcidWork(org.orcid.jaxb.model.message.OrcidWork) WorkExternalIdentifierId(org.orcid.jaxb.model.message.WorkExternalIdentifierId) Title(org.orcid.jaxb.model.message.Title) WorkTitle(org.orcid.jaxb.model.message.WorkTitle) FundingTitle(org.orcid.jaxb.model.message.FundingTitle) WorkExternalIdentifier(org.orcid.jaxb.model.message.WorkExternalIdentifier) OrcidActivities(org.orcid.jaxb.model.message.OrcidActivities) OrcidWorks(org.orcid.jaxb.model.message.OrcidWorks)

Example 15 with OrcidActivities

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);
        }
    }
}
Also used : OrcidHistory(org.orcid.jaxb.model.message.OrcidHistory) OrcidActivities(org.orcid.jaxb.model.message.OrcidActivities) OrcidWorks(org.orcid.jaxb.model.message.OrcidWorks)

Aggregations

OrcidActivities (org.orcid.jaxb.model.message.OrcidActivities)37 OrcidProfile (org.orcid.jaxb.model.message.OrcidProfile)28 OrcidMessage (org.orcid.jaxb.model.message.OrcidMessage)20 Affiliations (org.orcid.jaxb.model.message.Affiliations)18 Test (org.junit.Test)16 OrcidIdentifier (org.orcid.jaxb.model.message.OrcidIdentifier)14 OrcidWorks (org.orcid.jaxb.model.message.OrcidWorks)14 DBUnitTest (org.orcid.test.DBUnitTest)13 Affiliation (org.orcid.jaxb.model.message.Affiliation)11 FundingTitle (org.orcid.jaxb.model.message.FundingTitle)11 OrcidWork (org.orcid.jaxb.model.message.OrcidWork)11 Organization (org.orcid.jaxb.model.message.Organization)11 OrganizationAddress (org.orcid.jaxb.model.message.OrganizationAddress)11 Title (org.orcid.jaxb.model.message.Title)11 Transactional (org.springframework.transaction.annotation.Transactional)11 FundingList (org.orcid.jaxb.model.message.FundingList)9 Response (javax.ws.rs.core.Response)8 OrcidBio (org.orcid.jaxb.model.message.OrcidBio)8 WorkExternalIdentifier (org.orcid.jaxb.model.message.WorkExternalIdentifier)8 WorkTitle (org.orcid.jaxb.model.message.WorkTitle)8