Search in sources :

Example 11 with ExternalIDs

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

the class MemberV2ApiServiceDelegator_WorksTest method testUpdateWorkYouAreNotTheSourceOf.

@Test(expected = WrongSourceException.class)
public void testUpdateWorkYouAreNotTheSourceOf() {
    SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4443", ScopePathType.READ_LIMITED, ScopePathType.ACTIVITIES_UPDATE);
    Response response = serviceDelegator.viewWork("4444-4444-4444-4443", 2L);
    assertNotNull(response);
    Work work = (Work) response.getEntity();
    assertNotNull(work);
    Utils.verifyLastModified(work.getLastModifiedDate());
    assertEquals(Long.valueOf(2), work.getPutCode());
    assertNotNull(work.getWorkTitle());
    assertNotNull(work.getWorkTitle().getTitle());
    assertEquals("Another day in the life", work.getWorkTitle().getTitle().getContent());
    assertEquals(WorkType.BOOK, work.getWorkType());
    work.setWorkType(WorkType.EDITED_BOOK);
    work.getWorkTitle().getTitle().setContent("Updated work title");
    ExternalIDs extIds = new ExternalIDs();
    ExternalID extId = new ExternalID();
    extId.setRelationship(Relationship.PART_OF);
    extId.setType(WorkExternalIdentifierType.AGR.value());
    extId.setValue("ext-id-" + System.currentTimeMillis());
    extId.setUrl(new Url("http://thisIsANewUrl.com"));
    extIds.getExternalIdentifier().add(extId);
    work.setWorkExternalIdentifiers(extIds);
    serviceDelegator.updateWork("4444-4444-4444-4443", 2L, work);
    fail();
}
Also used : Response(javax.ws.rs.core.Response) ExternalIDs(org.orcid.jaxb.model.record_v2.ExternalIDs) ExternalID(org.orcid.jaxb.model.record_v2.ExternalID) Work(org.orcid.jaxb.model.record_v2.Work) Url(org.orcid.jaxb.model.common_v2.Url) ResearcherUrl(org.orcid.jaxb.model.record_v2.ResearcherUrl) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 12 with ExternalIDs

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

the class FundingExternalIDsConverter method convertFrom.

@Override
public ExternalIDs convertFrom(String externalIdentifiersAsString, Type<ExternalIDs> type) {
    FundingExternalIdentifiers jpaExtIds = FundingExternalIdentifiers.fromDBJSONString(externalIdentifiersAsString);
    ExternalIDs result = new ExternalIDs();
    for (FundingExternalIdentifier jpaExtId : jpaExtIds.getFundingExternalIdentifier()) {
        result.getExternalIdentifier().add(jpaExtId.toRecordPojo());
    }
    return result;
}
Also used : ExternalIDs(org.orcid.jaxb.model.record_v2.ExternalIDs)

Example 13 with ExternalIDs

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

the class SingleWorkExternalIdentifierFromJsonConverter method convertTo.

@Override
public String convertTo(ExternalID source, Type<String> destinationType) {
    ExternalIDs eids = new ExternalIDs();
    eids.getExternalIdentifier().add(source);
    WorkExternalIdentifiers ids = new WorkExternalIdentifiers(eids);
    return ids.toDBJSONString();
}
Also used : ExternalIDs(org.orcid.jaxb.model.record_v2.ExternalIDs)

Example 14 with ExternalIDs

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

the class OrcidSecurityManagerTestBase method createPeerReviewSummary.

protected PeerReviewSummary createPeerReviewSummary(Visibility v, String sourceId, String extIdValue) {
    PeerReviewSummary p = new PeerReviewSummary();
    p.setVisibility(v);
    p.setGroupId(EXTID_SHARED);
    setSource(p, sourceId);
    ExternalID extId = new ExternalID();
    extId.setValue(extIdValue);
    ExternalIDs extIds = new ExternalIDs();
    extIds.getExternalIdentifier().add(extId);
    addSharedExtId(extIds);
    p.setExternalIdentifiers(extIds);
    return p;
}
Also used : ExternalIDs(org.orcid.jaxb.model.record_v2.ExternalIDs) PeerReviewSummary(org.orcid.jaxb.model.record.summary_v2.PeerReviewSummary) ExternalID(org.orcid.jaxb.model.record_v2.ExternalID)

Example 15 with ExternalIDs

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

the class OrcidSecurityManagerTestBase method createFundingSummary.

protected FundingSummary createFundingSummary(Visibility v, String sourceId, String extIdValue) {
    FundingSummary f = new FundingSummary();
    f.setVisibility(v);
    setSource(f, sourceId);
    ExternalID extId = new ExternalID();
    extId.setValue(extIdValue);
    ExternalIDs extIds = new ExternalIDs();
    extIds.getExternalIdentifier().add(extId);
    addSharedExtId(extIds);
    f.setExternalIdentifiers(extIds);
    return f;
}
Also used : ExternalIDs(org.orcid.jaxb.model.record_v2.ExternalIDs) ExternalID(org.orcid.jaxb.model.record_v2.ExternalID) FundingSummary(org.orcid.jaxb.model.record.summary_v2.FundingSummary)

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