Search in sources :

Example 16 with Title

use of org.orcid.jaxb.model.common_rc2.Title 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 17 with Title

use of org.orcid.jaxb.model.common_rc2.Title 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 18 with Title

use of org.orcid.jaxb.model.common_rc2.Title in project ORCID-Source by ORCID.

the class PeerReviewManagerTest method getPeerReview.

private PeerReview getPeerReview(String extIdValue) {
    PeerReview peerReview = new PeerReview();
    peerReview.setRole(Role.CHAIR);
    ExternalIDs extIds = new ExternalIDs();
    ExternalID extId = new ExternalID();
    extId.setRelationship(Relationship.SELF);
    extId.setType("doi");
    extId.setUrl(new Url("http://orcid.org"));
    if (extIdValue == null) {
        extId.setValue("ext-id-value");
    } else {
        extId.setValue("ext-id-value-" + extIdValue);
    }
    extIds.getExternalIdentifier().add(extId);
    peerReview.setExternalIdentifiers(extIds);
    if (extIdValue == null) {
        peerReview.setSubjectContainerName(new Title("Peer review title"));
    } else {
        peerReview.setSubjectContainerName(new Title("Peer review title " + extIdValue));
    }
    peerReview.setSubjectExternalIdentifier(extId);
    Organization org = new Organization();
    org.setName("org-name");
    OrganizationAddress address = new OrganizationAddress();
    address.setCity("city");
    address.setCountry(Iso3166Country.US);
    org.setAddress(address);
    peerReview.setOrganization(org);
    peerReview.setType(PeerReviewType.EVALUATION);
    peerReview.setVisibility(Visibility.PUBLIC);
    return peerReview;
}
Also used : ExternalIDs(org.orcid.jaxb.model.record_v2.ExternalIDs) Organization(org.orcid.jaxb.model.common_v2.Organization) ExternalID(org.orcid.jaxb.model.record_v2.ExternalID) OrganizationAddress(org.orcid.jaxb.model.common_v2.OrganizationAddress) Title(org.orcid.jaxb.model.common_v2.Title) PeerReview(org.orcid.jaxb.model.record_v2.PeerReview) Url(org.orcid.jaxb.model.common_v2.Url)

Example 19 with Title

use of org.orcid.jaxb.model.common_rc2.Title in project ORCID-Source by ORCID.

the class WorkManagerTest method testCreateWorksWithBulkAllOK.

@Test
public void testCreateWorksWithBulkAllOK() {
    String orcid = "0000-0000-0000-0003";
    Long time = System.currentTimeMillis();
    when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
    WorkBulk bulk = new WorkBulk();
    for (int i = 0; i < 5; i++) {
        Work work = new Work();
        WorkTitle title = new WorkTitle();
        title.setTitle(new Title("Bulk work " + i + " " + time));
        work.setWorkTitle(title);
        ExternalIDs extIds = new ExternalIDs();
        ExternalID extId = new ExternalID();
        extId.setRelationship(Relationship.SELF);
        extId.setType("doi");
        extId.setUrl(new Url("http://doi/" + i + "/" + time));
        extId.setValue("doi-" + i + "-" + time);
        extIds.getExternalIdentifier().add(extId);
        work.setWorkExternalIdentifiers(extIds);
        work.setWorkType(WorkType.BOOK);
        bulk.getBulk().add(work);
    }
    bulk = workManager.createWorks(orcid, bulk);
    assertNotNull(bulk);
    assertEquals(5, bulk.getBulk().size());
    for (int i = 0; i < 5; i++) {
        assertTrue(Work.class.isAssignableFrom(bulk.getBulk().get(i).getClass()));
        Work w = (Work) bulk.getBulk().get(i);
        assertNotNull(w.getPutCode());
        assertTrue(0L < w.getPutCode());
        assertEquals("Bulk work " + i + " " + time, w.getWorkTitle().getTitle().getContent());
        assertNotNull(w.getExternalIdentifiers().getExternalIdentifier());
        assertEquals("doi-" + i + "-" + time, w.getExternalIdentifiers().getExternalIdentifier().get(0).getValue());
        Work w1 = workManager.getWork(orcid, w.getPutCode(), 0L);
        assertNotNull(w1);
        assertEquals("Bulk work " + i + " " + time, w1.getWorkTitle().getTitle().getContent());
        //Delete the work
        assertTrue(workManager.checkSourceAndRemoveWork(orcid, w1.getPutCode()));
    }
}
Also used : ClientDetailsEntity(org.orcid.persistence.jpa.entities.ClientDetailsEntity) ExternalIDs(org.orcid.jaxb.model.record_v2.ExternalIDs) WorkTitle(org.orcid.jaxb.model.record_v2.WorkTitle) SourceEntity(org.orcid.persistence.jpa.entities.SourceEntity) WorkBulk(org.orcid.jaxb.model.record_v2.WorkBulk) ExternalID(org.orcid.jaxb.model.record_v2.ExternalID) Work(org.orcid.jaxb.model.record_v2.Work) WorkTitle(org.orcid.jaxb.model.record_v2.WorkTitle) Title(org.orcid.jaxb.model.common_v2.Title) Url(org.orcid.jaxb.model.common_v2.Url) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 20 with Title

use of org.orcid.jaxb.model.common_rc2.Title in project ORCID-Source by ORCID.

the class WorkManagerTest method getWorkSummary.

private WorkSummary getWorkSummary(String titleValue, String extIdValue, Visibility visibility, String displayIndex) {
    WorkSummary summary = new WorkSummary();
    summary.setDisplayIndex(displayIndex);
    Title title = new Title(titleValue);
    WorkTitle workTitle = new WorkTitle();
    workTitle.setTitle(title);
    summary.setTitle(workTitle);
    summary.setType(WorkType.ARTISTIC_PERFORMANCE);
    summary.setVisibility(visibility);
    ExternalIDs extIds = new ExternalIDs();
    ExternalID extId = new ExternalID();
    extId.setRelationship(Relationship.SELF);
    extId.setType("doi");
    extId.setUrl(new Url("http://orcid.org"));
    extId.setValue(extIdValue);
    extIds.getExternalIdentifier().add(extId);
    summary.setExternalIdentifiers(extIds);
    return summary;
}
Also used : WorkSummary(org.orcid.jaxb.model.record.summary_v2.WorkSummary) 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) Title(org.orcid.jaxb.model.common_v2.Title) Url(org.orcid.jaxb.model.common_v2.Url)

Aggregations

Title (org.orcid.jaxb.model.common_v2.Title)43 WorkTitle (org.orcid.jaxb.model.record_v2.WorkTitle)37 ExternalID (org.orcid.jaxb.model.record_v2.ExternalID)28 Test (org.junit.Test)26 ExternalIDs (org.orcid.jaxb.model.record_v2.ExternalIDs)24 Url (org.orcid.jaxb.model.common_v2.Url)23 FundingTitle (org.orcid.jaxb.model.record_v2.FundingTitle)23 Work (org.orcid.jaxb.model.record_v2.Work)22 ClientResponse (com.sun.jersey.api.client.ClientResponse)19 TranslatedTitle (org.orcid.jaxb.model.common_v2.TranslatedTitle)12 Funding (org.orcid.jaxb.model.record_v2.Funding)11 ArrayList (java.util.ArrayList)8 List (java.util.List)7 Visibility (org.orcid.jaxb.model.common_rc2.Visibility)7 Map (java.util.Map)6 PeerReview (org.orcid.jaxb.model.record_v2.PeerReview)6 ExternalID (org.orcid.jaxb.model.record_rc2.ExternalID)5 Url (org.orcid.jaxb.model.common_rc2.Url)4 ContributorOrcid (org.orcid.jaxb.model.common_v2.ContributorOrcid)4 BaseTest (org.orcid.core.BaseTest)3