Search in sources :

Example 16 with CreditName

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

the class ValidateV2RC3SamplesTest method testUnmarshallCreditName.

@Test
public void testUnmarshallCreditName() throws SAXException, URISyntaxException {
    CreditName creditName = (CreditName) unmarshallFromPath("/record_2.0_rc3/samples/credit-name-2.0_rc3.xml", CreditName.class, "/record_2.0_rc3/personal-details-2.0_rc3.xsd");
    assertNotNull(creditName);
    assertEquals("credit-name", creditName.getContent());
    assertEquals(Visibility.PUBLIC.value(), creditName.getVisibility().value());
}
Also used : CreditName(org.orcid.jaxb.model.record_rc3.CreditName) Test(org.junit.Test)

Example 17 with CreditName

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

the class ActivityValidatorTest method getWork.

public Work getWork() {
    Work work = new Work();
    work.setCountry(new Country(Iso3166Country.US));
    work.setJournalTitle(new Title("journal-title"));
    work.setLanguageCode("en");
    work.setPublicationDate(new PublicationDate(getFuzzyDate()));
    work.setShortDescription("short-description");
    work.setUrl(new Url("http://test.orcid.org"));
    work.setVisibility(Visibility.PUBLIC);
    work.setWorkCitation(new Citation("citation", CitationType.FORMATTED_HARVARD));
    ContributorAttributes attributes = new ContributorAttributes();
    attributes.setContributorRole(ContributorRole.ASSIGNEE);
    attributes.setContributorSequence(SequenceType.FIRST);
    ContributorOrcid contributorOrcid = new ContributorOrcid();
    contributorOrcid.setHost("http://test.orcid.org");
    contributorOrcid.setPath("0000-0000-0000-0000");
    contributorOrcid.setUri("http://test.orcid.org/0000-0000-0000-0000");
    Contributor contributor = new Contributor();
    contributor.setContributorAttributes(attributes);
    contributor.setContributorOrcid(contributorOrcid);
    contributor.setCreditName(new CreditName("credit name"));
    contributor.setContributorEmail(new ContributorEmail("email@test.orcid.org"));
    WorkContributors contributors = new WorkContributors(Stream.of(contributor).collect(Collectors.toList()));
    work.setWorkContributors(contributors);
    work.setWorkExternalIdentifiers(getExternalIDs());
    work.setWorkTitle(getWorkTitle());
    work.setWorkType(WorkType.ARTISTIC_PERFORMANCE);
    return work;
}
Also used : PublicationDate(org.orcid.jaxb.model.common_v2.PublicationDate) FundingContributorAttributes(org.orcid.jaxb.model.record_v2.FundingContributorAttributes) ContributorAttributes(org.orcid.jaxb.model.common_v2.ContributorAttributes) WorkContributors(org.orcid.jaxb.model.record_v2.WorkContributors) Work(org.orcid.jaxb.model.record_v2.Work) CreditName(org.orcid.jaxb.model.common_v2.CreditName) Country(org.orcid.jaxb.model.common_v2.Country) Iso3166Country(org.orcid.jaxb.model.common_v2.Iso3166Country) WorkTitle(org.orcid.jaxb.model.record_v2.WorkTitle) TranslatedTitle(org.orcid.jaxb.model.common_v2.TranslatedTitle) FundingTitle(org.orcid.jaxb.model.record_v2.FundingTitle) Title(org.orcid.jaxb.model.common_v2.Title) FundingContributor(org.orcid.jaxb.model.record_v2.FundingContributor) Contributor(org.orcid.jaxb.model.common_v2.Contributor) Citation(org.orcid.jaxb.model.record_v2.Citation) ContributorOrcid(org.orcid.jaxb.model.common_v2.ContributorOrcid) ContributorEmail(org.orcid.jaxb.model.common_v2.ContributorEmail) Url(org.orcid.jaxb.model.common_v2.Url)

Example 18 with CreditName

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

the class ValidateV2RC4SamplesTest method unmarshallFromPath.

private Object unmarshallFromPath(String path, Class<?> type, String schemaPath) throws SAXException, URISyntaxException {
    try (Reader reader = new InputStreamReader(getClass().getResourceAsStream(path))) {
        Object obj = unmarshall(reader, type, schemaPath);
        Object result = null;
        if (ResearcherUrls.class.equals(type)) {
            result = (ResearcherUrls) obj;
        } else if (ResearcherUrl.class.equals(type)) {
            result = (ResearcherUrl) obj;
        } else if (PersonalDetails.class.equals(type)) {
            result = (PersonalDetails) obj;
        } else if (PersonExternalIdentifier.class.equals(type)) {
            result = (PersonExternalIdentifier) obj;
        } else if (PersonExternalIdentifiers.class.equals(type)) {
            result = (PersonExternalIdentifiers) obj;
        } else if (Biography.class.equals(type)) {
            result = (Biography) obj;
        } else if (Name.class.equals(type)) {
            result = (Name) obj;
        } else if (CreditName.class.equals(type)) {
            result = (CreditName) obj;
        } else if (OtherName.class.equals(type)) {
            result = (OtherName) obj;
        } else if (OtherNames.class.equals(type)) {
            result = (OtherNames) obj;
        } else if (Keywords.class.equals(type)) {
            result = (Keywords) obj;
        } else if (Keyword.class.equals(type)) {
            result = (Keyword) obj;
        } else if (Addresses.class.equals(type)) {
            result = (Addresses) obj;
        } else if (Address.class.equals(type)) {
            result = (Address) obj;
        } else if (Emails.class.equals(type)) {
            result = (Emails) obj;
        } else if (Email.class.equals(type)) {
            result = (Email) obj;
        } else if (Person.class.equals(type)) {
            result = (Person) obj;
        } else if (Deprecated.class.equals(type)) {
            result = (Deprecated) obj;
        } else if (Preferences.class.equals(type)) {
            result = (Preferences) obj;
        } else if (History.class.equals(type)) {
            result = (History) obj;
        } else if (Record.class.equals(type)) {
            result = (Record) obj;
        } else if (ActivitiesSummary.class.equals(type)) {
            result = (ActivitiesSummary) obj;
        }
        return result;
    } catch (IOException e) {
        throw new RuntimeException("Error reading notification from classpath", e);
    }
}
Also used : Email(org.orcid.jaxb.model.record_rc4.Email) InputStreamReader(java.io.InputStreamReader) Keyword(org.orcid.jaxb.model.record_rc4.Keyword) Address(org.orcid.jaxb.model.record_rc4.Address) OtherNames(org.orcid.jaxb.model.record_rc4.OtherNames) CreditName(org.orcid.jaxb.model.record_rc4.CreditName) Reader(java.io.Reader) InputStreamReader(java.io.InputStreamReader) IOException(java.io.IOException) PersonExternalIdentifier(org.orcid.jaxb.model.record_rc4.PersonExternalIdentifier) History(org.orcid.jaxb.model.record_rc4.History) ActivitiesSummary(org.orcid.jaxb.model.record.summary_rc4.ActivitiesSummary) Deprecated(org.orcid.jaxb.model.record_rc4.Deprecated) Biography(org.orcid.jaxb.model.record_rc4.Biography) ResearcherUrl(org.orcid.jaxb.model.record_rc4.ResearcherUrl)

Example 19 with CreditName

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

the class ValidateV2RC4SamplesTest method testMarshallCreditName.

@Test
public void testMarshallCreditName() throws JAXBException, SAXException, URISyntaxException {
    CreditName object = (CreditName) unmarshallFromPath("/record_2.0_rc4/samples/credit-name-2.0_rc4.xml", CreditName.class);
    marshall(object, "/record_2.0_rc4/personal-details-2.0_rc4.xsd");
}
Also used : CreditName(org.orcid.jaxb.model.record_rc4.CreditName) Test(org.junit.Test)

Example 20 with CreditName

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

the class ValidateV2RC4SamplesTest method testUnmarshallCreditName.

@Test
public void testUnmarshallCreditName() throws SAXException, URISyntaxException {
    CreditName creditName = (CreditName) unmarshallFromPath("/record_2.0_rc4/samples/credit-name-2.0_rc4.xml", CreditName.class, "/record_2.0_rc4/personal-details-2.0_rc4.xsd");
    assertNotNull(creditName);
    assertEquals("credit-name", creditName.getContent());
}
Also used : CreditName(org.orcid.jaxb.model.record_rc4.CreditName) Test(org.junit.Test)

Aggregations

CreditName (org.orcid.jaxb.model.common_v2.CreditName)17 Test (org.junit.Test)14 FundingContributor (org.orcid.jaxb.model.record_v2.FundingContributor)8 CreditName (org.orcid.jaxb.model.record_v2.CreditName)7 FamilyName (org.orcid.jaxb.model.record_v2.FamilyName)7 GivenNames (org.orcid.jaxb.model.record_v2.GivenNames)7 Name (org.orcid.jaxb.model.record_v2.Name)7 ContributorOrcid (org.orcid.jaxb.model.common_v2.ContributorOrcid)6 IOException (java.io.IOException)5 InputStreamReader (java.io.InputStreamReader)5 Reader (java.io.Reader)5 ContributorEmail (org.orcid.jaxb.model.common_v2.ContributorEmail)5 WorkContributors (org.orcid.jaxb.model.record_v2.WorkContributors)4 Contributor (org.orcid.jaxb.model.common_v2.Contributor)3 Country (org.orcid.jaxb.model.common_v2.Country)3 Iso3166Country (org.orcid.jaxb.model.common_v2.Iso3166Country)3 PublicationDate (org.orcid.jaxb.model.common_v2.PublicationDate)3 Title (org.orcid.jaxb.model.common_v2.Title)3 Url (org.orcid.jaxb.model.common_v2.Url)3 CreditName (org.orcid.jaxb.model.record_rc2.CreditName)3