Search in sources :

Example 26 with CreditName

use of org.orcid.jaxb.model.record_v2.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 27 with CreditName

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

Example 28 with CreditName

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

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

Example 29 with CreditName

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

the class ContributorUtilsTest method getFundingContributorWithoutOrcid.

private FundingContributors getFundingContributorWithoutOrcid() {
    FundingContributor contributor = new FundingContributor();
    contributor.setContributorEmail(new ContributorEmail("never@show.this"));
    contributor.setCreditName(new CreditName("original credit name"));
    FundingContributors fundingContributors = new FundingContributors();
    fundingContributors.getContributor().add(contributor);
    return fundingContributors;
}
Also used : FundingContributor(org.orcid.jaxb.model.record_v2.FundingContributor) CreditName(org.orcid.jaxb.model.common_v2.CreditName) FundingContributors(org.orcid.jaxb.model.record_v2.FundingContributors) ContributorEmail(org.orcid.jaxb.model.common_v2.ContributorEmail)

Example 30 with CreditName

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

the class ContributorUtilsTest method getWorkContributorWithoutOrcid.

private WorkContributors getWorkContributorWithoutOrcid() {
    Contributor contributor = new Contributor();
    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) ContributorEmail(org.orcid.jaxb.model.common_v2.ContributorEmail)

Aggregations

Test (org.junit.Test)17 CreditName (org.orcid.jaxb.model.common_v2.CreditName)16 Name (org.orcid.jaxb.model.record_v2.Name)10 CreditName (org.orcid.jaxb.model.record_v2.CreditName)9 FundingContributor (org.orcid.jaxb.model.record_v2.FundingContributor)9 FamilyName (org.orcid.jaxb.model.record_v2.FamilyName)8 GivenNames (org.orcid.jaxb.model.record_v2.GivenNames)8 IOException (java.io.IOException)5 InputStreamReader (java.io.InputStreamReader)5 Reader (java.io.Reader)5 Contributor (org.orcid.jaxb.model.common_v2.Contributor)5 ContributorEmail (org.orcid.jaxb.model.common_v2.ContributorEmail)5 Biography (org.orcid.jaxb.model.record_v2.Biography)4 Work (org.orcid.jaxb.model.record_v2.Work)4 WorkContributors (org.orcid.jaxb.model.record_v2.WorkContributors)4 ProfileEntity (org.orcid.persistence.jpa.entities.ProfileEntity)4 ContributorOrcid (org.orcid.jaxb.model.common_v2.ContributorOrcid)3 ActivitiesSummary (org.orcid.jaxb.model.record.summary_v2.ActivitiesSummary)3 CreditName (org.orcid.jaxb.model.record_rc2.CreditName)3 CreditName (org.orcid.jaxb.model.record_rc4.CreditName)3