Search in sources :

Example 26 with ExternalIDs

use of org.orcid.jaxb.model.record_rc3.ExternalIDs in project ORCID-Source by ORCID.

the class WorkFormTest method getWork.

private Work getWork() {
    Work work = new Work();
    work.setCountry(new Country(Iso3166Country.US));
    work.setJournalTitle(new Title("Journal title"));
    work.setLanguageCode("en");
    work.setPutCode(Long.valueOf("1"));
    work.setShortDescription("Short description");
    work.setSource(new org.orcid.jaxb.model.common_v2.Source("0000-0000-0000-0000"));
    work.setUrl(new Url("http://myurl.com"));
    work.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.PUBLIC);
    org.orcid.jaxb.model.record_v2.Citation citation = new org.orcid.jaxb.model.record_v2.Citation();
    citation.setCitation("Citation");
    citation.setWorkCitationType(CitationType.FORMATTED_UNSPECIFIED);
    work.setWorkCitation(citation);
    WorkTitle title = new WorkTitle();
    title.setTitle(new Title("Title"));
    title.setTranslatedTitle(new org.orcid.jaxb.model.common_v2.TranslatedTitle("Translated Title", "es"));
    title.setSubtitle(new Subtitle("Subtitle"));
    work.setWorkTitle(title);
    work.setWorkType(WorkType.ARTISTIC_PERFORMANCE);
    Date date = new Date();
    date.setDay("1");
    date.setMonth("1");
    date.setYear("2015");
    GregorianCalendar calendar = date.toCalendar();
    work.setCreatedDate(new CreatedDate(datatypeFactory.newXMLGregorianCalendar(calendar)));
    date = new Date();
    date.setDay("2");
    date.setMonth("2");
    date.setYear("2015");
    calendar = date.toCalendar();
    work.setLastModifiedDate(new LastModifiedDate(datatypeFactory.newXMLGregorianCalendar(calendar)));
    work.setPublicationDate(new PublicationDate(new Year(2015), new Month(3), new Day(3)));
    org.orcid.jaxb.model.record_v2.WorkContributors contributors = new org.orcid.jaxb.model.record_v2.WorkContributors();
    org.orcid.jaxb.model.common_v2.Contributor contributor = new org.orcid.jaxb.model.common_v2.Contributor();
    org.orcid.jaxb.model.common_v2.ContributorAttributes attributes = new org.orcid.jaxb.model.common_v2.ContributorAttributes();
    attributes.setContributorRole(org.orcid.jaxb.model.common_v2.ContributorRole.CO_INVENTOR);
    attributes.setContributorSequence(org.orcid.jaxb.model.record_v2.SequenceType.FIRST);
    contributor.setContributorAttributes(attributes);
    contributor.setContributorEmail(null);
    ContributorOrcid contributorOrcid = new ContributorOrcid("Contributor orcid");
    contributorOrcid.setUri("Contributor uri");
    contributor.setContributorOrcid(contributorOrcid);
    CreditName creditName = new CreditName("Contributor credit name");
    contributor.setCreditName(creditName);
    contributors.getContributor().add(contributor);
    work.setWorkContributors(contributors);
    ExternalIDs externalIdentifiers = new ExternalIDs();
    ExternalID extId = new ExternalID();
    extId.setValue("External Identifier ID");
    extId.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.ASIN.value());
    extId.setRelationship(Relationship.SELF);
    externalIdentifiers.getExternalIdentifier().add(extId);
    work.setWorkExternalIdentifiers(externalIdentifiers);
    return work;
}
Also used : LastModifiedDate(org.orcid.jaxb.model.common_v2.LastModifiedDate) ExternalIDs(org.orcid.jaxb.model.record_v2.ExternalIDs) ExternalID(org.orcid.jaxb.model.record_v2.ExternalID) Contributor(org.orcid.pojo.ajaxForm.Contributor) Url(org.orcid.jaxb.model.common_v2.Url) Month(org.orcid.jaxb.model.common_v2.Month) Work(org.orcid.jaxb.model.record_v2.Work) Citation(org.orcid.pojo.ajaxForm.Citation) PublicationDate(org.orcid.jaxb.model.common_v2.PublicationDate) GregorianCalendar(java.util.GregorianCalendar) CreditName(org.orcid.jaxb.model.common_v2.CreditName) WorkTitle(org.orcid.jaxb.model.record_v2.WorkTitle) Title(org.orcid.jaxb.model.common_v2.Title) LastModifiedDate(org.orcid.jaxb.model.common_v2.LastModifiedDate) FuzzyDate(org.orcid.jaxb.model.common_v2.FuzzyDate) CreatedDate(org.orcid.jaxb.model.common_v2.CreatedDate) PublicationDate(org.orcid.jaxb.model.common_v2.PublicationDate) Date(org.orcid.pojo.ajaxForm.Date) Subtitle(org.orcid.jaxb.model.common_v2.Subtitle) Year(org.orcid.jaxb.model.common_v2.Year) WorkTitle(org.orcid.jaxb.model.record_v2.WorkTitle) CreatedDate(org.orcid.jaxb.model.common_v2.CreatedDate) Country(org.orcid.jaxb.model.common_v2.Country) Iso3166Country(org.orcid.jaxb.model.common_v2.Iso3166Country) ContributorOrcid(org.orcid.jaxb.model.common_v2.ContributorOrcid) Day(org.orcid.jaxb.model.common_v2.Day)

Example 27 with ExternalIDs

use of org.orcid.jaxb.model.record_rc3.ExternalIDs in project ORCID-Source by ORCID.

the class SourceInActivitiesTest method getWorkWithoutTitle.

private Work getWorkWithoutTitle(String userOrcid2, boolean validate) {
    Work work = new Work();
    work.setWorkType(org.orcid.jaxb.model.record_v2.WorkType.BOOK);
    ExternalID extId = new ExternalID();
    extId.setValue("111");
    extId.setType(WorkExternalIdentifierType.DOI.value());
    ExternalIDs extIdentifiers = new ExternalIDs();
    extIdentifiers.getExternalIdentifier().add(extId);
    work.setWorkExternalIdentifiers(extIdentifiers);
    work = workManager.createWork(userOrcid, work, validate);
    return workManager.getWork(userOrcid, work.getPutCode(), 0L);
}
Also used : ExternalIDs(org.orcid.jaxb.model.record_v2.ExternalIDs) ExternalID(org.orcid.jaxb.model.record_v2.ExternalID) Work(org.orcid.jaxb.model.record_v2.Work)

Example 28 with ExternalIDs

use of org.orcid.jaxb.model.record_rc3.ExternalIDs in project ORCID-Source by ORCID.

the class SourceInActivitiesTest method getPeerReview.

private PeerReview getPeerReview(String userOrcid) {
    PeerReview peerReview = new PeerReview();
    peerReview.setOrganization(getOrganization());
    peerReview.setType(PeerReviewType.EVALUATION);
    WorkTitle workTitle = new WorkTitle();
    workTitle.setTitle(new Title("Title " + System.currentTimeMillis()));
    ExternalIDs workExtIds = new ExternalIDs();
    ExternalID workExtId = new ExternalID();
    workExtId.setValue("ID");
    workExtId.setType(WorkExternalIdentifierType.AGR.value());
    workExtIds.getExternalIdentifier().add(workExtId);
    peerReview.setSubjectName(workTitle);
    peerReview.setSubjectExternalIdentifier(workExtId);
    peerReview.setSubjectType(WorkType.ARTISTIC_PERFORMANCE);
    peerReview.setExternalIdentifiers(workExtIds);
    peerReview.setRole(Role.CHAIR);
    peerReview = peerReviewManager.createPeerReview(userOrcid, peerReview, false);
    return peerReviewManager.getPeerReview(userOrcid, peerReview.getPutCode());
}
Also used : ExternalIDs(org.orcid.jaxb.model.record_v2.ExternalIDs) WorkTitle(org.orcid.jaxb.model.record_v2.WorkTitle) ExternalID(org.orcid.jaxb.model.record_v2.ExternalID) WorkTitle(org.orcid.jaxb.model.record_v2.WorkTitle) FundingTitle(org.orcid.jaxb.model.record_v2.FundingTitle) Title(org.orcid.jaxb.model.common_v2.Title) PeerReview(org.orcid.jaxb.model.record_v2.PeerReview)

Example 29 with ExternalIDs

use of org.orcid.jaxb.model.record_rc3.ExternalIDs in project ORCID-Source by ORCID.

the class FundingExternalIdentifiersConversionsTest method recordToCoreObjectTest.

@Test
public void recordToCoreObjectTest() {
    ExternalIDs recordFei = new ExternalIDs();
    ExternalID f1 = new ExternalID();
    f1.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
    f1.setUrl(new org.orcid.jaxb.model.common_v2.Url("www.f1.com"));
    f1.setValue("f1");
    recordFei.getExternalIdentifier().add(f1);
    ExternalID f2 = new ExternalID();
    f2.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
    f2.setUrl(new org.orcid.jaxb.model.common_v2.Url("www.f2.com"));
    f2.setValue("f2");
    recordFei.getExternalIdentifier().add(f2);
    ExternalID f3 = new ExternalID();
    f3.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
    f3.setUrl(new org.orcid.jaxb.model.common_v2.Url("www.f3.com"));
    f3.setValue("f3");
    recordFei.getExternalIdentifier().add(f3);
    FundingExternalIdentifiers fei = new FundingExternalIdentifiers(recordFei);
    assertNotNull(fei);
    assertEquals(3, fei.getFundingExternalIdentifier().size());
    boolean found1 = false, found2 = false, found3 = false;
    for (FundingExternalIdentifier f : fei.getFundingExternalIdentifier()) {
        if (f.getValue().equals("f1")) {
            found1 = true;
            assertEquals("www.f1.com", f.getUrl().getValue());
            assertEquals(FundingExternalIdentifierType.GRANT_NUMBER.value().toUpperCase(), f.getType());
        } else if (f.getValue().equals("f2")) {
            found2 = true;
            assertEquals("www.f2.com", f.getUrl().getValue());
            assertEquals(FundingExternalIdentifierType.GRANT_NUMBER.value().toUpperCase(), f.getType());
        } else if (f.getValue().equals("f3")) {
            found3 = true;
            assertEquals("www.f3.com", f.getUrl().getValue());
            assertEquals(FundingExternalIdentifierType.GRANT_NUMBER.value().toUpperCase(), f.getType());
        } else {
            fail();
        }
    }
    assertTrue(found1);
    assertTrue(found2);
    assertTrue(found3);
}
Also used : ExternalIDs(org.orcid.jaxb.model.record_v2.ExternalIDs) ExternalID(org.orcid.jaxb.model.record_v2.ExternalID) FundingExternalIdentifiers(org.orcid.core.adapter.impl.jsonidentifiers.FundingExternalIdentifiers) FundingExternalIdentifier(org.orcid.core.adapter.impl.jsonidentifiers.FundingExternalIdentifier) Test(org.junit.Test)

Example 30 with ExternalIDs

use of org.orcid.jaxb.model.record_rc3.ExternalIDs in project ORCID-Source by ORCID.

the class WorkExternalIdentifiersConversionsTest method testConvertToExternalIDs.

@Test
public void testConvertToExternalIDs() {
    WorkExternalIDsConverter conv = new WorkExternalIDsConverter();
    String externalIdentifiersAsString = expectedIDs;
    ExternalIDs ids = conv.convertFrom(externalIdentifiersAsString, null);
    assertEquals(Relationship.SELF, ids.getExternalIdentifier().get(0).getRelationship());
    assertEquals(new Url("http://what.com"), ids.getExternalIdentifier().get(0).getUrl());
    assertEquals("doi", ids.getExternalIdentifier().get(0).getType());
    assertEquals("value", ids.getExternalIdentifier().get(0).getValue());
    assertEquals(Relationship.PART_OF, ids.getExternalIdentifier().get(1).getRelationship());
    assertEquals(new Url("http://whatnow.com"), ids.getExternalIdentifier().get(1).getUrl());
    assertEquals("source-work-id", ids.getExternalIdentifier().get(1).getType());
    assertEquals("value2", ids.getExternalIdentifier().get(1).getValue());
}
Also used : ExternalIDs(org.orcid.jaxb.model.record_v2.ExternalIDs) WorkExternalIDsConverter(org.orcid.core.adapter.impl.jsonidentifiers.WorkExternalIDsConverter) Url(org.orcid.jaxb.model.common_v2.Url) Test(org.junit.Test)

Aggregations

ExternalIDs (org.orcid.jaxb.model.record_v2.ExternalIDs)60 ExternalID (org.orcid.jaxb.model.record_v2.ExternalID)50 Url (org.orcid.jaxb.model.common_v2.Url)37 Test (org.junit.Test)32 Title (org.orcid.jaxb.model.common_v2.Title)24 WorkTitle (org.orcid.jaxb.model.record_v2.WorkTitle)20 Work (org.orcid.jaxb.model.record_v2.Work)15 FundingTitle (org.orcid.jaxb.model.record_v2.FundingTitle)11 MarshallingTest (org.orcid.jaxb.model.notification.custom.MarshallingTest)8 Funding (org.orcid.jaxb.model.record_v2.Funding)8 ResearcherUrl (org.orcid.jaxb.model.record_v2.ResearcherUrl)7 Organization (org.orcid.jaxb.model.common_v2.Organization)6 OrganizationAddress (org.orcid.jaxb.model.common_v2.OrganizationAddress)6 Response (javax.ws.rs.core.Response)5 PeerReview (org.orcid.jaxb.model.record_v2.PeerReview)5 FuzzyDate (org.orcid.jaxb.model.common_v2.FuzzyDate)4 TranslatedTitle (org.orcid.jaxb.model.common_v2.TranslatedTitle)4 ActivitiesSummary (org.orcid.jaxb.model.record.summary_v2.ActivitiesSummary)4 BaseTest (org.orcid.core.BaseTest)3 Day (org.orcid.jaxb.model.common_v2.Day)3