Search in sources :

Example 6 with CreditName

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

the class WorkFormTest method getWork.

private Work getWork() {
    Work work = new Work();
    work.setCountry(new Country(Iso3166Country.US));
    work.setJournalTitle(new Title("Journal title"));
    work.setLanguageCode("en");
    work.setPutCode(Long.valueOf("1"));
    work.setShortDescription("Short description");
    work.setSource(new org.orcid.jaxb.model.common_v2.Source("0000-0000-0000-0000"));
    work.setUrl(new Url("http://myurl.com"));
    work.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.PUBLIC);
    org.orcid.jaxb.model.record_v2.Citation citation = new org.orcid.jaxb.model.record_v2.Citation();
    citation.setCitation("Citation");
    citation.setWorkCitationType(CitationType.FORMATTED_UNSPECIFIED);
    work.setWorkCitation(citation);
    WorkTitle title = new WorkTitle();
    title.setTitle(new Title("Title"));
    title.setTranslatedTitle(new org.orcid.jaxb.model.common_v2.TranslatedTitle("Translated Title", "es"));
    title.setSubtitle(new Subtitle("Subtitle"));
    work.setWorkTitle(title);
    work.setWorkType(WorkType.ARTISTIC_PERFORMANCE);
    Date date = new Date();
    date.setDay("1");
    date.setMonth("1");
    date.setYear("2015");
    GregorianCalendar calendar = date.toCalendar();
    work.setCreatedDate(new CreatedDate(datatypeFactory.newXMLGregorianCalendar(calendar)));
    date = new Date();
    date.setDay("2");
    date.setMonth("2");
    date.setYear("2015");
    calendar = date.toCalendar();
    work.setLastModifiedDate(new LastModifiedDate(datatypeFactory.newXMLGregorianCalendar(calendar)));
    work.setPublicationDate(new PublicationDate(new Year(2015), new Month(3), new Day(3)));
    org.orcid.jaxb.model.record_v2.WorkContributors contributors = new org.orcid.jaxb.model.record_v2.WorkContributors();
    org.orcid.jaxb.model.common_v2.Contributor contributor = new org.orcid.jaxb.model.common_v2.Contributor();
    org.orcid.jaxb.model.common_v2.ContributorAttributes attributes = new org.orcid.jaxb.model.common_v2.ContributorAttributes();
    attributes.setContributorRole(org.orcid.jaxb.model.common_v2.ContributorRole.CO_INVENTOR);
    attributes.setContributorSequence(org.orcid.jaxb.model.record_v2.SequenceType.FIRST);
    contributor.setContributorAttributes(attributes);
    contributor.setContributorEmail(null);
    ContributorOrcid contributorOrcid = new ContributorOrcid("Contributor orcid");
    contributorOrcid.setUri("Contributor uri");
    contributor.setContributorOrcid(contributorOrcid);
    CreditName creditName = new CreditName("Contributor credit name");
    contributor.setCreditName(creditName);
    contributors.getContributor().add(contributor);
    work.setWorkContributors(contributors);
    ExternalIDs externalIdentifiers = new ExternalIDs();
    ExternalID extId = new ExternalID();
    extId.setValue("External Identifier ID");
    extId.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.ASIN.value());
    extId.setRelationship(Relationship.SELF);
    externalIdentifiers.getExternalIdentifier().add(extId);
    work.setWorkExternalIdentifiers(externalIdentifiers);
    return work;
}
Also used : LastModifiedDate(org.orcid.jaxb.model.common_v2.LastModifiedDate) ExternalIDs(org.orcid.jaxb.model.record_v2.ExternalIDs) ExternalID(org.orcid.jaxb.model.record_v2.ExternalID) Contributor(org.orcid.pojo.ajaxForm.Contributor) Url(org.orcid.jaxb.model.common_v2.Url) Month(org.orcid.jaxb.model.common_v2.Month) Work(org.orcid.jaxb.model.record_v2.Work) Citation(org.orcid.pojo.ajaxForm.Citation) PublicationDate(org.orcid.jaxb.model.common_v2.PublicationDate) GregorianCalendar(java.util.GregorianCalendar) CreditName(org.orcid.jaxb.model.common_v2.CreditName) WorkTitle(org.orcid.jaxb.model.record_v2.WorkTitle) Title(org.orcid.jaxb.model.common_v2.Title) LastModifiedDate(org.orcid.jaxb.model.common_v2.LastModifiedDate) FuzzyDate(org.orcid.jaxb.model.common_v2.FuzzyDate) CreatedDate(org.orcid.jaxb.model.common_v2.CreatedDate) PublicationDate(org.orcid.jaxb.model.common_v2.PublicationDate) Date(org.orcid.pojo.ajaxForm.Date) Subtitle(org.orcid.jaxb.model.common_v2.Subtitle) Year(org.orcid.jaxb.model.common_v2.Year) WorkTitle(org.orcid.jaxb.model.record_v2.WorkTitle) CreatedDate(org.orcid.jaxb.model.common_v2.CreatedDate) Country(org.orcid.jaxb.model.common_v2.Country) Iso3166Country(org.orcid.jaxb.model.common_v2.Iso3166Country) ContributorOrcid(org.orcid.jaxb.model.common_v2.ContributorOrcid) Day(org.orcid.jaxb.model.common_v2.Day)

Example 7 with CreditName

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

the class RecordNameManagerTest method testFailOnCreatingOnARecordThatAlreadyHaveRecordName.

@Test(expected = IllegalArgumentException.class)
public void testFailOnCreatingOnARecordThatAlreadyHaveRecordName() {
    Name name = new Name();
    long time = System.currentTimeMillis();
    name.setCreditName(new CreditName("Credit Name " + time));
    name.setFamilyName(new FamilyName("Family Name " + time));
    name.setGivenNames(new GivenNames("Given Names " + time));
    name.setVisibility(Visibility.PRIVATE);
    String orcid = "0000-0000-0000-0001";
    recordNameManager.createRecordName(orcid, name);
    fail();
}
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) Name(org.orcid.jaxb.model.record_v2.Name) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 8 with CreditName

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

the class ValidateV2RC3SamplesTest method testMarshallCreditName.

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

Example 9 with CreditName

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

the class ValidateV2_1SamplesTest method testUnmarshallCreditName.

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

Example 10 with CreditName

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

the class ValidateV2_1SamplesTest 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)

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