use of org.orcid.jaxb.model.record_rc4.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();
}
use of org.orcid.jaxb.model.record_rc4.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;
}
use of org.orcid.jaxb.model.record_rc4.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();
}
use of org.orcid.jaxb.model.record_rc4.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;
}
use of org.orcid.jaxb.model.record_rc4.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;
}
Aggregations