Search in sources :

Example 51 with ExternalID

use of org.orcid.jaxb.model.record_rc2.ExternalID in project ORCID-Source by ORCID.

the class FundingExternalIdentifiersConversionsTest method recordToCoreObjectTest.

@Test
public void recordToCoreObjectTest() {
    ExternalIDs recordFei = new ExternalIDs();
    ExternalID f1 = new ExternalID();
    f1.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
    f1.setUrl(new org.orcid.jaxb.model.common_v2.Url("www.f1.com"));
    f1.setValue("f1");
    recordFei.getExternalIdentifier().add(f1);
    ExternalID f2 = new ExternalID();
    f2.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
    f2.setUrl(new org.orcid.jaxb.model.common_v2.Url("www.f2.com"));
    f2.setValue("f2");
    recordFei.getExternalIdentifier().add(f2);
    ExternalID f3 = new ExternalID();
    f3.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
    f3.setUrl(new org.orcid.jaxb.model.common_v2.Url("www.f3.com"));
    f3.setValue("f3");
    recordFei.getExternalIdentifier().add(f3);
    FundingExternalIdentifiers fei = new FundingExternalIdentifiers(recordFei);
    assertNotNull(fei);
    assertEquals(3, fei.getFundingExternalIdentifier().size());
    boolean found1 = false, found2 = false, found3 = false;
    for (FundingExternalIdentifier f : fei.getFundingExternalIdentifier()) {
        if (f.getValue().equals("f1")) {
            found1 = true;
            assertEquals("www.f1.com", f.getUrl().getValue());
            assertEquals(FundingExternalIdentifierType.GRANT_NUMBER.value().toUpperCase(), f.getType());
        } else if (f.getValue().equals("f2")) {
            found2 = true;
            assertEquals("www.f2.com", f.getUrl().getValue());
            assertEquals(FundingExternalIdentifierType.GRANT_NUMBER.value().toUpperCase(), f.getType());
        } else if (f.getValue().equals("f3")) {
            found3 = true;
            assertEquals("www.f3.com", f.getUrl().getValue());
            assertEquals(FundingExternalIdentifierType.GRANT_NUMBER.value().toUpperCase(), f.getType());
        } else {
            fail();
        }
    }
    assertTrue(found1);
    assertTrue(found2);
    assertTrue(found3);
}
Also used : ExternalIDs(org.orcid.jaxb.model.record_v2.ExternalIDs) ExternalID(org.orcid.jaxb.model.record_v2.ExternalID) FundingExternalIdentifiers(org.orcid.core.adapter.impl.jsonidentifiers.FundingExternalIdentifiers) FundingExternalIdentifier(org.orcid.core.adapter.impl.jsonidentifiers.FundingExternalIdentifier) Test(org.junit.Test)

Example 52 with ExternalID

use of org.orcid.jaxb.model.record_rc2.ExternalID in project ORCID-Source by ORCID.

the class WorkExternalIdentifiersConversionsTest method testConvertToExternalID.

@Test
public void testConvertToExternalID() {
    PeerReviewWorkExternalIDConverter conv = new PeerReviewWorkExternalIDConverter();
    ExternalID id = new ExternalID();
    id.setRelationship(Relationship.SELF);
    id.setType("doi");
    id.setUrl(new Url("http://what.com"));
    id.setValue("value");
    String externalIdentifiersAsString = conv.convertTo(id, null);
    assertEquals(expected, externalIdentifiersAsString);
}
Also used : PeerReviewWorkExternalIDConverter(org.orcid.core.adapter.impl.jsonidentifiers.PeerReviewWorkExternalIDConverter) ExternalID(org.orcid.jaxb.model.record_v2.ExternalID) Url(org.orcid.jaxb.model.common_v2.Url) Test(org.junit.Test)

Example 53 with ExternalID

use of org.orcid.jaxb.model.record_rc2.ExternalID in project ORCID-Source by ORCID.

the class WorkExternalIdentifiersConversionsTest method testConvertFromExternalID.

@Test
public void testConvertFromExternalID() {
    PeerReviewWorkExternalIDConverter conv = new PeerReviewWorkExternalIDConverter();
    String externalIdentifiersAsString = expected;
    ExternalID id = conv.convertFrom(externalIdentifiersAsString, null);
    assertEquals(Relationship.SELF, id.getRelationship());
    assertEquals(new Url("http://what.com"), id.getUrl());
    assertEquals("doi", id.getType());
    assertEquals("value", id.getValue());
}
Also used : PeerReviewWorkExternalIDConverter(org.orcid.core.adapter.impl.jsonidentifiers.PeerReviewWorkExternalIDConverter) ExternalID(org.orcid.jaxb.model.record_v2.ExternalID) Url(org.orcid.jaxb.model.common_v2.Url) Test(org.junit.Test)

Example 54 with ExternalID

use of org.orcid.jaxb.model.record_rc2.ExternalID in project ORCID-Source by ORCID.

the class PeerReviewManagerTest method getPeerReviewSummary.

private PeerReviewSummary getPeerReviewSummary(String titleValue, String extIdValue, Visibility visibility) {
    PeerReviewSummary summary = new PeerReviewSummary();
    summary.setGroupId(titleValue);
    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 : 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) Url(org.orcid.jaxb.model.common_v2.Url)

Example 55 with ExternalID

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

Aggregations

ExternalID (org.orcid.jaxb.model.record_v2.ExternalID)110 Test (org.junit.Test)97 Url (org.orcid.jaxb.model.common_v2.Url)55 ClientResponse (com.sun.jersey.api.client.ClientResponse)52 ExternalIDs (org.orcid.jaxb.model.record_v2.ExternalIDs)50 Work (org.orcid.jaxb.model.record_v2.Work)32 Title (org.orcid.jaxb.model.common_v2.Title)28 WorkTitle (org.orcid.jaxb.model.record_v2.WorkTitle)22 Funding (org.orcid.jaxb.model.record_v2.Funding)16 PeerReview (org.orcid.jaxb.model.record_v2.PeerReview)16 WorkSummary (org.orcid.jaxb.model.record.summary_v2.WorkSummary)14 ArrayList (java.util.ArrayList)13 ExternalID (org.orcid.jaxb.model.record_rc3.ExternalID)13 ExternalID (org.orcid.jaxb.model.record_rc4.ExternalID)13 FundingTitle (org.orcid.jaxb.model.record_v2.FundingTitle)11 OrcidError (org.orcid.jaxb.model.error_v2.OrcidError)9 WorkGroup (org.orcid.jaxb.model.record.summary_v2.WorkGroup)8 ExternalID (org.orcid.jaxb.model.record_rc2.ExternalID)8 List (java.util.List)7 Validator (javax.xml.validation.Validator)7