use of org.orcid.jaxb.model.v3.dev1.record.ExternalID in project ORCID-Source by ORCID.
the class WorkForm method populateExternalIdentifiers.
public static void populateExternalIdentifiers(ExternalIDs extIds, WorkForm workForm, WorkType workType) {
if (extIds != null) {
List<WorkExternalIdentifier> workExternalIdentifiersList = new ArrayList<WorkExternalIdentifier>();
for (ExternalID extId : extIds.getExternalIdentifier()) {
if (extId.getRelationship() == null) {
if (org.orcid.jaxb.model.message.WorkExternalIdentifierType.ISSN.equals(extId.getType())) {
if (WorkType.BOOK.equals(workType)) {
extId.setRelationship(Relationship.PART_OF);
} else {
extId.setRelationship(Relationship.SELF);
}
} else if (org.orcid.jaxb.model.message.WorkExternalIdentifierType.ISBN.equals(extId.getType())) {
if (WorkType.BOOK_CHAPTER.equals(workType) || WorkType.CONFERENCE_PAPER.equals(workType)) {
extId.setRelationship(Relationship.PART_OF);
} else {
extId.setRelationship(Relationship.SELF);
}
} else {
extId.setRelationship(Relationship.SELF);
}
}
workExternalIdentifiersList.add(WorkExternalIdentifier.valueOf(extId));
}
workForm.setWorkExternalIdentifiers(workExternalIdentifiersList);
}
}
use of org.orcid.jaxb.model.v3.dev1.record.ExternalID in project ORCID-Source by ORCID.
the class JpaJaxbWorkAdapterTest method fromProfileWorkEntityToWorkSummaryTest.
@Test
public void fromProfileWorkEntityToWorkSummaryTest() {
WorkEntity work = getWorkEntity();
assertNotNull(work);
WorkSummary ws = jpaJaxbWorkAdapter.toWorkSummary(work);
assertNotNull(ws);
assertEquals(Long.valueOf(12345), ws.getPutCode());
assertEquals(Visibility.LIMITED.value(), ws.getVisibility().value());
assertEquals("1234567890", ws.getDisplayIndex());
assertNotNull(ws.getExternalIdentifiers());
assertNotNull(ws.getExternalIdentifiers().getExternalIdentifier());
assertEquals(1, ws.getExternalIdentifiers().getExternalIdentifier().size());
ExternalID workExtId = ws.getExternalIdentifiers().getExternalIdentifier().get(0);
assertNotNull(workExtId.getValue());
assertEquals("123", workExtId.getValue());
assertNotNull(workExtId.getType());
assertEquals(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value(), workExtId.getType());
assertEquals("work:journalTitle", ws.getJournalTitle().getContent());
}
use of org.orcid.jaxb.model.v3.dev1.record.ExternalID in project ORCID-Source by ORCID.
the class JpaJaxbNotificationAdapterTest method testToNotificationAmendedEntity.
@Test
public void testToNotificationAmendedEntity() {
NotificationAmended notification = new NotificationAmended();
notification.setNotificationType(NotificationType.AMENDED);
Source source = new Source();
notification.setSource(source);
SourceClientId clientId = new SourceClientId();
source.setSourceClientId(clientId);
clientId.setPath("APP-5555-5555-5555-5555");
Items activities = new Items();
notification.setItems(activities);
Item activity = new Item();
activities.getItems().add(activity);
activity.setItemType(ItemType.WORK);
activity.setItemName("Latest Research Article");
ExternalID extId = new ExternalID();
activity.setExternalIdentifier(extId);
extId.setType("doi");
extId.setValue("1234/abc123");
NotificationEntity notificationEntity = jpaJaxbNotificationAdapter.toNotificationEntity(notification);
assertTrue(notificationEntity instanceof NotificationAmendedEntity);
NotificationAmendedEntity notificationAmendedEntity = (NotificationAmendedEntity) notificationEntity;
assertNotNull(notificationEntity);
assertEquals(org.orcid.jaxb.model.notification_v2.NotificationType.AMENDED, notificationEntity.getNotificationType());
// Source
assertNull(notificationAmendedEntity.getSourceId());
assertNull(notificationAmendedEntity.getClientSourceId());
assertNull(notificationAmendedEntity.getElementSourceId());
}
use of org.orcid.jaxb.model.v3.dev1.record.ExternalID in project ORCID-Source by ORCID.
the class JSONExternalIdentifiersConverterV3Test method testConvertFrom.
@Test
public void testConvertFrom() {
ExternalIDs externalIDs = converter.convertFrom("{\"externalIdentifier\":[{\"type\":\"GRANT_NUMBER\",\"value\":\"external-identifier-value\",\"url\":{\"value\":\"http://tempuri.org\"},\"relationship\":\"SELF\"},{\"type\":\"GRANT_NUMBER\",\"value\":\"external-identifier-value2\",\"url\":{\"value\":\"http://tempuri.org/2\"},\"relationship\":\"SELF\"}]}", null);
assertNotNull(externalIDs);
assertEquals(2, externalIDs.getExternalIdentifier().size());
ExternalID externalID = externalIDs.getExternalIdentifier().get(0);
assertEquals("grant_number", externalID.getType());
assertEquals("external-identifier-value", externalID.getValue());
assertEquals("http://tempuri.org", externalID.getUrl().getValue());
externalID = externalIDs.getExternalIdentifier().get(1);
assertEquals("grant_number", externalID.getType());
assertEquals("external-identifier-value2", externalID.getValue());
assertEquals("http://tempuri.org/2", externalID.getUrl().getValue());
}
use of org.orcid.jaxb.model.v3.dev1.record.ExternalID in project ORCID-Source by ORCID.
the class JSONPeerReviewWorkExternalIdentifierConverterV3Test method testConvertFrom.
@Test
public void testConvertFrom() {
PeerReviewEntity peerReview = getPeerReviewEntity();
ExternalID externalID = converter.convertFrom(peerReview.getSubjectExternalIdentifiersJson(), null);
assertNotNull(externalID);
assertEquals("source-work-id", externalID.getType());
assertEquals("peer-review:subject-external-identifier-id", externalID.getValue());
assertEquals("http://orcid.org", externalID.getUrl().getValue());
}
Aggregations