Search in sources :

Example 11 with Title

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

the class MemberV2ApiServiceDelegator_PeerReviewsTest method testAddPeerReviewWithSameExtIdValueButDifferentExtIdType.

@Test
public void testAddPeerReviewWithSameExtIdValueButDifferentExtIdType() {
    SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4444", ScopePathType.READ_LIMITED, ScopePathType.ACTIVITIES_UPDATE);
    PeerReview peerReview1 = new PeerReview();
    ExternalIDs weis1 = new ExternalIDs();
    ExternalID wei1 = new ExternalID();
    wei1.setRelationship(null);
    wei1.setValue("same_but_different_type");
    wei1.setType(WorkExternalIdentifierType.DOI.value());
    weis1.getExternalIdentifier().add(wei1);
    peerReview1.setExternalIdentifiers(weis1);
    peerReview1.setGroupId("issn:0000003");
    peerReview1.setOrganization(Utils.getOrganization());
    peerReview1.setRole(Role.CHAIR);
    peerReview1.setSubjectContainerName(new Title("subject-container-name"));
    peerReview1.setSubjectExternalIdentifier(wei1);
    WorkTitle workTitle1 = new WorkTitle();
    workTitle1.setTitle(new Title("work-title"));
    peerReview1.setSubjectName(workTitle1);
    peerReview1.setSubjectType(WorkType.DATA_SET);
    peerReview1.setType(PeerReviewType.EVALUATION);
    Response response1 = serviceDelegator.createPeerReview("4444-4444-4444-4444", peerReview1);
    assertNotNull(response1);
    assertEquals(Response.Status.CREATED.getStatusCode(), response1.getStatus());
    Map<?, ?> map = response1.getMetadata();
    assertNotNull(map);
    assertTrue(map.containsKey("Location"));
    List<?> resultWithPutCode = (List<?>) map.get("Location");
    Long putCode1 = Long.valueOf(String.valueOf(resultWithPutCode.get(0)));
    PeerReview peerReview2 = new PeerReview();
    ExternalIDs weis2 = new ExternalIDs();
    ExternalID wei2 = new ExternalID();
    wei2.setRelationship(null);
    // Same value
    wei2.setValue("same_but_different_type");
    // But different
    wei2.setType(WorkExternalIdentifierType.ARXIV.value());
    // type
    weis2.getExternalIdentifier().add(wei2);
    peerReview2.setExternalIdentifiers(weis2);
    peerReview2.setGroupId("issn:0000003");
    peerReview2.setOrganization(Utils.getOrganization());
    peerReview2.setRole(Role.CHAIR);
    peerReview2.setSubjectContainerName(new Title("subject-container-name"));
    peerReview2.setSubjectExternalIdentifier(wei2);
    WorkTitle workTitle2 = new WorkTitle();
    workTitle2.setTitle(new Title("work-title"));
    peerReview2.setSubjectName(workTitle2);
    peerReview2.setSubjectType(WorkType.DATA_SET);
    peerReview2.setType(PeerReviewType.EVALUATION);
    Response response2 = serviceDelegator.createPeerReview("4444-4444-4444-4444", peerReview2);
    assertNotNull(response2);
    assertEquals(Response.Status.CREATED.getStatusCode(), response2.getStatus());
    map = response2.getMetadata();
    assertNotNull(map);
    assertTrue(map.containsKey("Location"));
    resultWithPutCode = (List<?>) map.get("Location");
    Long putCode2 = Long.valueOf(String.valueOf(resultWithPutCode.get(0)));
    // Delete new peer reviews so they don't affect other tests
    serviceDelegator.deletePeerReview("4444-4444-4444-4444", putCode1);
    serviceDelegator.deletePeerReview("4444-4444-4444-4444", putCode2);
}
Also used : Response(javax.ws.rs.core.Response) 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) List(java.util.List) PeerReview(org.orcid.jaxb.model.record_v2.PeerReview) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 12 with Title

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

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

use of org.orcid.jaxb.model.common_rc3.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)

Example 15 with Title

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

the class BibtexManagerTest method testGenerateBibtexForSingleWorkEsaped.

@Test
public void testGenerateBibtexForSingleWorkEsaped() {
    Work w = new Work();
    WorkTitle title = new WorkTitle();
    title.setTitle(new Title("Escapes θ à À È © ë Ö ì"));
    w.setWorkTitle(title);
    w.setWorkType(WorkType.JOURNAL_ARTICLE);
    w.setPutCode(100l);
    String bib = bibtexManager.generateBibtex(ORCID, w);
    Assert.assertEquals("@article{Credit_Name100,\ntitle={Escapes \\texttheta {\\`a} \\`{A} \\`{E} \\textcopyright {\\\"e} {\\\"O} {\\`i}},\nauthor={Credit Name}\n}", bib);
}
Also used : WorkTitle(org.orcid.jaxb.model.record_v2.WorkTitle) Work(org.orcid.jaxb.model.record_v2.Work) Title(org.orcid.jaxb.model.common_v2.Title) WorkTitle(org.orcid.jaxb.model.record_v2.WorkTitle) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Aggregations

Title (org.orcid.jaxb.model.common_v2.Title)47 WorkTitle (org.orcid.jaxb.model.record_v2.WorkTitle)41 Test (org.junit.Test)30 ExternalID (org.orcid.jaxb.model.record_v2.ExternalID)28 ExternalIDs (org.orcid.jaxb.model.record_v2.ExternalIDs)24 Work (org.orcid.jaxb.model.record_v2.Work)24 Url (org.orcid.jaxb.model.common_v2.Url)23 FundingTitle (org.orcid.jaxb.model.record_v2.FundingTitle)23 ClientResponse (com.sun.jersey.api.client.ClientResponse)19 TranslatedTitle (org.orcid.jaxb.model.common_v2.TranslatedTitle)14 Funding (org.orcid.jaxb.model.record_v2.Funding)11 ArrayList (java.util.ArrayList)8 List (java.util.List)8 WorkSummary (org.orcid.jaxb.model.record.summary_v2.WorkSummary)8 Visibility (org.orcid.jaxb.model.common_rc3.Visibility)7 ExternalID (org.orcid.jaxb.model.record_rc3.ExternalID)7 Map (java.util.Map)6 WorkBulk (org.orcid.jaxb.model.record_v2.WorkBulk)6 BaseTest (org.orcid.core.BaseTest)5 ActivitiesSummary (org.orcid.jaxb.model.record.summary_v2.ActivitiesSummary)5