Search in sources :

Example 1 with CreditName

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

the class ContributorUtilsTest method getWorkContributorWithOrcid.

private WorkContributors getWorkContributorWithOrcid() {
    ContributorOrcid contributorOrcid = new ContributorOrcid();
    contributorOrcid.setPath("0000-0003-4902-6327");
    contributorOrcid.setHost("orcid.org");
    contributorOrcid.setUri("http://orcid.org/0000-0003-4902-6327");
    Contributor contributor = new Contributor();
    contributor.setContributorOrcid(contributorOrcid);
    contributor.setContributorEmail(new ContributorEmail("never@show.this"));
    contributor.setCreditName(new CreditName("original credit name"));
    return new WorkContributors(Arrays.asList(contributor));
}
Also used : WorkContributors(org.orcid.jaxb.model.record_v2.WorkContributors) CreditName(org.orcid.jaxb.model.common_v2.CreditName) FundingContributor(org.orcid.jaxb.model.record_v2.FundingContributor) Contributor(org.orcid.jaxb.model.common_v2.Contributor) ContributorOrcid(org.orcid.jaxb.model.common_v2.ContributorOrcid) ContributorEmail(org.orcid.jaxb.model.common_v2.ContributorEmail)

Example 2 with CreditName

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

the class ValidateV2SamplesTest 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;
        } else if (Works.class.equals(type)) {
            result = (Works) obj;
        }
        return result;
    } catch (IOException e) {
        throw new RuntimeException("Error reading notification from classpath", e);
    }
}
Also used : Email(org.orcid.jaxb.model.record_v2.Email) InputStreamReader(java.io.InputStreamReader) Keyword(org.orcid.jaxb.model.record_v2.Keyword) Address(org.orcid.jaxb.model.record_v2.Address) OtherNames(org.orcid.jaxb.model.record_v2.OtherNames) CreditName(org.orcid.jaxb.model.record_v2.CreditName) Reader(java.io.Reader) InputStreamReader(java.io.InputStreamReader) IOException(java.io.IOException) PersonExternalIdentifier(org.orcid.jaxb.model.record_v2.PersonExternalIdentifier) History(org.orcid.jaxb.model.record_v2.History) ActivitiesSummary(org.orcid.jaxb.model.record.summary_v2.ActivitiesSummary) Deprecated(org.orcid.jaxb.model.record_v2.Deprecated) Biography(org.orcid.jaxb.model.record_v2.Biography) ResearcherUrl(org.orcid.jaxb.model.record_v2.ResearcherUrl)

Example 3 with CreditName

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

the class OrcidSecurityManagerTestBase method createName.

protected Name createName(Visibility v) {
    Name name = new Name();
    name.setVisibility(v);
    name.setCreditName(new CreditName("Credit Name"));
    name.setFamilyName(new FamilyName("Family Name"));
    name.setGivenNames(new GivenNames("Given Names"));
    return name;
}
Also used : FamilyName(org.orcid.jaxb.model.record_v2.FamilyName) GivenNames(org.orcid.jaxb.model.record_v2.GivenNames) CreditName(org.orcid.jaxb.model.common_v2.CreditName) FamilyName(org.orcid.jaxb.model.record_v2.FamilyName) CreditName(org.orcid.jaxb.model.common_v2.CreditName) OtherName(org.orcid.jaxb.model.record_v2.OtherName) Name(org.orcid.jaxb.model.record_v2.Name)

Example 4 with CreditName

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

the class ValidateV2RC2SamplesTest method testUnmarshallCreditName.

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

Example 5 with CreditName

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

the class ValidateV2RC2SamplesTest 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_rc2.Email) InputStreamReader(java.io.InputStreamReader) Keyword(org.orcid.jaxb.model.record_rc2.Keyword) Address(org.orcid.jaxb.model.record_rc2.Address) OtherNames(org.orcid.jaxb.model.record_rc2.OtherNames) CreditName(org.orcid.jaxb.model.record_rc2.CreditName) Reader(java.io.Reader) InputStreamReader(java.io.InputStreamReader) IOException(java.io.IOException) PersonExternalIdentifier(org.orcid.jaxb.model.record_rc2.PersonExternalIdentifier) History(org.orcid.jaxb.model.record_rc2.History) ActivitiesSummary(org.orcid.jaxb.model.record.summary_rc2.ActivitiesSummary) Deprecated(org.orcid.jaxb.model.record_rc2.Deprecated) Biography(org.orcid.jaxb.model.record_rc2.Biography) ResearcherUrl(org.orcid.jaxb.model.record_rc2.ResearcherUrl)

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