Search in sources :

Example 1 with WorkContributors

use of org.orcid.jaxb.model.v3.dev1.record.WorkContributors in project ORCID-Source by ORCID.

the class WorkFormTest method getWork.

public static Work getWork() {
    Work work = new Work();
    work.setCountry(new Country(Iso3166Country.US));
    Date date = new Date();
    work.setCreatedDate(new CreatedDate(DateUtils.convertToXMLGregorianCalendar(date)));
    work.setJournalTitle(new Title("Journal Title"));
    work.setLanguageCode("EN");
    work.setPublicationDate(new PublicationDate(new Year(2015), new Month(1), new Day(1)));
    work.setPutCode(Long.valueOf("12345"));
    work.setShortDescription("Short description");
    work.setUrl(new Url("http://test.com"));
    work.setVisibility(org.orcid.jaxb.model.v3.dev1.common.Visibility.LIMITED);
    work.setWorkCitation(new org.orcid.jaxb.model.v3.dev1.record.Citation("Citation", CitationType.BIBTEX));
    WorkContributors contributors = new WorkContributors();
    org.orcid.jaxb.model.v3.dev1.common.Contributor contributor = new org.orcid.jaxb.model.v3.dev1.common.Contributor();
    contributor.setCreditName(new CreditName("Credit name"));
    contributor.setContributorOrcid(new ContributorOrcid("0000-0000-0000-0000"));
    ContributorAttributes att = new ContributorAttributes();
    att.setContributorRole(ContributorRole.ASSIGNEE);
    att.setContributorSequence(SequenceType.FIRST);
    contributor.setContributorAttributes(att);
    contributors.getContributor().add(contributor);
    work.setWorkContributors(contributors);
    ExternalIDs weis = new ExternalIDs();
    ExternalID wei = new ExternalID();
    wei.setRelationship(Relationship.SELF);
    wei.setUrl(new Url("http://test.com"));
    wei.setValue("ID");
    wei.setType(WorkExternalIdentifierType.AGR.value());
    weis.getExternalIdentifier().add(wei);
    work.setWorkExternalIdentifiers(weis);
    WorkTitle workTitle = new WorkTitle();
    workTitle.setTitle(new Title("Work Title"));
    workTitle.setSubtitle(new Subtitle("Subtitle"));
    TranslatedTitle translated = new TranslatedTitle("Translated", "US");
    workTitle.setTranslatedTitle(translated);
    work.setWorkTitle(workTitle);
    work.setWorkType(WorkType.ARTISTIC_PERFORMANCE);
    return work;
}
Also used : ExternalIDs(org.orcid.jaxb.model.v3.dev1.record.ExternalIDs) WorkContributors(org.orcid.jaxb.model.v3.dev1.record.WorkContributors) ExternalID(org.orcid.jaxb.model.v3.dev1.record.ExternalID) Url(org.orcid.jaxb.model.v3.dev1.common.Url) Month(org.orcid.jaxb.model.v3.dev1.common.Month) Work(org.orcid.jaxb.model.v3.dev1.record.Work) PublicationDate(org.orcid.jaxb.model.v3.dev1.common.PublicationDate) ContributorAttributes(org.orcid.jaxb.model.v3.dev1.common.ContributorAttributes) CreditName(org.orcid.jaxb.model.v3.dev1.common.CreditName) TranslatedTitle(org.orcid.jaxb.model.v3.dev1.common.TranslatedTitle) Title(org.orcid.jaxb.model.v3.dev1.common.Title) WorkTitle(org.orcid.jaxb.model.v3.dev1.record.WorkTitle) Date(java.util.Date) CreatedDate(org.orcid.jaxb.model.v3.dev1.common.CreatedDate) PublicationDate(org.orcid.jaxb.model.v3.dev1.common.PublicationDate) Subtitle(org.orcid.jaxb.model.v3.dev1.common.Subtitle) Year(org.orcid.jaxb.model.v3.dev1.common.Year) TranslatedTitle(org.orcid.jaxb.model.v3.dev1.common.TranslatedTitle) WorkTitle(org.orcid.jaxb.model.v3.dev1.record.WorkTitle) CreatedDate(org.orcid.jaxb.model.v3.dev1.common.CreatedDate) Iso3166Country(org.orcid.jaxb.model.v3.dev1.common.Iso3166Country) Country(org.orcid.jaxb.model.v3.dev1.common.Country) ContributorOrcid(org.orcid.jaxb.model.v3.dev1.common.ContributorOrcid) Day(org.orcid.jaxb.model.v3.dev1.common.Day)

Example 2 with WorkContributors

use of org.orcid.jaxb.model.v3.dev1.record.WorkContributors in project ORCID-Source by ORCID.

the class MapperFacadeFactory method getWorkMapperFacade.

public MapperFacade getWorkMapperFacade() {
    MapperFactory mapperFactory = new DefaultMapperFactory.Builder().build();
    ConverterFactory converterFactory = mapperFactory.getConverterFactory();
    converterFactory.registerConverter("workExternalIdentifiersConverterId", new JSONWorkExternalIdentifiersConverterV3(norm, localeManager));
    converterFactory.registerConverter("workContributorsConverterId", new JsonOrikaConverter<WorkContributors>());
    ClassMapBuilder<Work, WorkEntity> workClassMap = mapperFactory.classMap(Work.class, WorkEntity.class);
    workClassMap.byDefault();
    workClassMap.field("putCode", "id");
    addV3DateFields(workClassMap);
    registerSourceConverters(mapperFactory, workClassMap);
    workClassMap.field("journalTitle.content", "journalTitle");
    workClassMap.field("workTitle.title.content", "title");
    workClassMap.field("workTitle.translatedTitle.content", "translatedTitle");
    workClassMap.field("workTitle.translatedTitle.languageCode", "translatedTitleLanguageCode");
    workClassMap.field("workTitle.subtitle.content", "subtitle");
    workClassMap.field("shortDescription", "description");
    workClassMap.field("workCitation.workCitationType", "citationType");
    workClassMap.field("workCitation.citation", "citation");
    workClassMap.field("workType", "workType");
    workClassMap.field("publicationDate", "publicationDate");
    workClassMap.fieldMap("workExternalIdentifiers", "externalIdentifiersJson").converter("workExternalIdentifiersConverterId").add();
    workClassMap.field("url.value", "workUrl");
    workClassMap.fieldMap("workContributors", "contributorsJson").converter("workContributorsConverterId").add();
    workClassMap.field("languageCode", "languageCode");
    workClassMap.field("country.value", "iso2Country");
    workClassMap.register();
    ClassMapBuilder<WorkSummary, WorkEntity> workSummaryClassMap = mapperFactory.classMap(WorkSummary.class, WorkEntity.class);
    registerSourceConverters(mapperFactory, workSummaryClassMap);
    workSummaryClassMap.field("putCode", "id");
    workSummaryClassMap.field("title.title.content", "title");
    workSummaryClassMap.field("title.translatedTitle.content", "translatedTitle");
    workSummaryClassMap.field("title.translatedTitle.languageCode", "translatedTitleLanguageCode");
    workSummaryClassMap.field("journalTitle.content", "journalTitle");
    workSummaryClassMap.field("type", "workType");
    workSummaryClassMap.field("publicationDate", "publicationDate");
    workSummaryClassMap.fieldMap("externalIdentifiers", "externalIdentifiersJson").converter("workExternalIdentifiersConverterId").add();
    workSummaryClassMap.byDefault();
    workSummaryClassMap.register();
    ClassMapBuilder<WorkSummary, MinimizedWorkEntity> workSummaryMinimizedClassMap = mapperFactory.classMap(WorkSummary.class, MinimizedWorkEntity.class);
    addV3CommonFields(workSummaryMinimizedClassMap);
    registerSourceConverters(mapperFactory, workSummaryMinimizedClassMap);
    workSummaryMinimizedClassMap.field("title.title.content", "title");
    workSummaryMinimizedClassMap.field("title.translatedTitle.content", "translatedTitle");
    workSummaryMinimizedClassMap.field("title.translatedTitle.languageCode", "translatedTitleLanguageCode");
    workSummaryMinimizedClassMap.field("type", "workType");
    workSummaryMinimizedClassMap.field("publicationDate.year.value", "publicationYear");
    workSummaryMinimizedClassMap.field("publicationDate.month.value", "publicationMonth");
    workSummaryMinimizedClassMap.field("publicationDate.day.value", "publicationDay");
    workSummaryMinimizedClassMap.fieldMap("externalIdentifiers", "externalIdentifiersJson").converter("workExternalIdentifiersConverterId").add();
    workSummaryMinimizedClassMap.byDefault();
    workSummaryMinimizedClassMap.register();
    ClassMapBuilder<Work, MinimizedWorkEntity> minimizedWorkClassMap = mapperFactory.classMap(Work.class, MinimizedWorkEntity.class);
    minimizedWorkClassMap.byDefault();
    registerSourceConverters(mapperFactory, minimizedWorkClassMap);
    minimizedWorkClassMap.field("putCode", "id");
    minimizedWorkClassMap.field("journalTitle.content", "journalTitle");
    minimizedWorkClassMap.field("workTitle.title.content", "title");
    minimizedWorkClassMap.field("workTitle.translatedTitle.content", "translatedTitle");
    minimizedWorkClassMap.field("workTitle.translatedTitle.languageCode", "translatedTitleLanguageCode");
    minimizedWorkClassMap.field("workTitle.subtitle.content", "subtitle");
    minimizedWorkClassMap.field("shortDescription", "description");
    minimizedWorkClassMap.field("workType", "workType");
    minimizedWorkClassMap.field("publicationDate.year.value", "publicationYear");
    minimizedWorkClassMap.field("publicationDate.month.value", "publicationMonth");
    minimizedWorkClassMap.field("publicationDate.day.value", "publicationDay");
    minimizedWorkClassMap.fieldMap("workExternalIdentifiers", "externalIdentifiersJson").converter("workExternalIdentifiersConverterId").add();
    minimizedWorkClassMap.field("url.value", "workUrl");
    minimizedWorkClassMap.register();
    mapperFactory.classMap(PublicationDate.class, PublicationDateEntity.class).field("year.value", "year").field("month.value", "month").field("day.value", "day").register();
    return mapperFactory.getMapperFacade();
}
Also used : WorkContributors(org.orcid.jaxb.model.v3.dev1.record.WorkContributors) ConverterFactory(ma.glasnost.orika.converter.ConverterFactory) WorkEntity(org.orcid.persistence.jpa.entities.WorkEntity) MinimizedWorkEntity(org.orcid.persistence.jpa.entities.MinimizedWorkEntity) NotificationWorkEntity(org.orcid.persistence.jpa.entities.NotificationWorkEntity) WorkSummary(org.orcid.jaxb.model.v3.dev1.record.summary.WorkSummary) JSONWorkExternalIdentifiersConverterV3(org.orcid.core.adapter.jsonidentifier.converter.JSONWorkExternalIdentifiersConverterV3) MinimizedWorkEntity(org.orcid.persistence.jpa.entities.MinimizedWorkEntity) DefaultMapperFactory(ma.glasnost.orika.impl.DefaultMapperFactory) DefaultMapperFactory(ma.glasnost.orika.impl.DefaultMapperFactory) MapperFactory(ma.glasnost.orika.MapperFactory) Work(org.orcid.jaxb.model.v3.dev1.record.Work)

Example 3 with WorkContributors

use of org.orcid.jaxb.model.v3.dev1.record.WorkContributors 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("https://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.v3.dev1.common.PublicationDate) ContributorAttributes(org.orcid.jaxb.model.v3.dev1.common.ContributorAttributes) FundingContributorAttributes(org.orcid.jaxb.model.v3.dev1.record.FundingContributorAttributes) WorkContributors(org.orcid.jaxb.model.v3.dev1.record.WorkContributors) Work(org.orcid.jaxb.model.v3.dev1.record.Work) CreditName(org.orcid.jaxb.model.v3.dev1.common.CreditName) Country(org.orcid.jaxb.model.v3.dev1.common.Country) Iso3166Country(org.orcid.jaxb.model.v3.dev1.common.Iso3166Country) Title(org.orcid.jaxb.model.v3.dev1.common.Title) TranslatedTitle(org.orcid.jaxb.model.v3.dev1.common.TranslatedTitle) FundingTitle(org.orcid.jaxb.model.v3.dev1.record.FundingTitle) WorkTitle(org.orcid.jaxb.model.v3.dev1.record.WorkTitle) FundingContributor(org.orcid.jaxb.model.v3.dev1.record.FundingContributor) Contributor(org.orcid.jaxb.model.v3.dev1.common.Contributor) Citation(org.orcid.jaxb.model.v3.dev1.record.Citation) ContributorOrcid(org.orcid.jaxb.model.v3.dev1.common.ContributorOrcid) ContributorEmail(org.orcid.jaxb.model.v3.dev1.common.ContributorEmail) Url(org.orcid.jaxb.model.v3.dev1.common.Url)

Example 4 with WorkContributors

use of org.orcid.jaxb.model.v3.dev1.record.WorkContributors 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.v3.dev1.record.WorkContributors) CreditName(org.orcid.jaxb.model.v3.dev1.common.CreditName) FundingContributor(org.orcid.jaxb.model.v3.dev1.record.FundingContributor) Contributor(org.orcid.jaxb.model.v3.dev1.common.Contributor) ContributorEmail(org.orcid.jaxb.model.v3.dev1.common.ContributorEmail)

Example 5 with WorkContributors

use of org.orcid.jaxb.model.v3.dev1.record.WorkContributors in project ORCID-Source by ORCID.

the class ActivityUtilsTest method getEmptyWork.

private Work getEmptyWork() {
    Work w = new Work();
    // Title
    WorkTitle title = new WorkTitle();
    title.setTitle(new Title(""));
    title.setSubtitle(new Subtitle(""));
    title.setTranslatedTitle(new TranslatedTitle(""));
    w.setWorkTitle(title);
    // Citation
    w.setWorkCitation(new Citation());
    WorkContributors wc = new WorkContributors();
    // Contributors
    Contributor c = new Contributor();
    c.setCreditName(new CreditName(""));
    wc.getContributor().add(c);
    w.setWorkContributors(wc);
    return w;
}
Also used : Subtitle(org.orcid.jaxb.model.v3.dev1.common.Subtitle) TranslatedTitle(org.orcid.jaxb.model.v3.dev1.common.TranslatedTitle) WorkTitle(org.orcid.jaxb.model.v3.dev1.record.WorkTitle) WorkContributors(org.orcid.jaxb.model.v3.dev1.record.WorkContributors) Work(org.orcid.jaxb.model.v3.dev1.record.Work) CreditName(org.orcid.jaxb.model.v3.dev1.common.CreditName) TranslatedTitle(org.orcid.jaxb.model.v3.dev1.common.TranslatedTitle) Title(org.orcid.jaxb.model.v3.dev1.common.Title) WorkTitle(org.orcid.jaxb.model.v3.dev1.record.WorkTitle) FundingContributor(org.orcid.jaxb.model.v3.dev1.record.FundingContributor) Contributor(org.orcid.jaxb.model.v3.dev1.common.Contributor) Citation(org.orcid.jaxb.model.v3.dev1.record.Citation)

Aggregations

WorkContributors (org.orcid.jaxb.model.v3.dev1.record.WorkContributors)7 Contributor (org.orcid.jaxb.model.v3.dev1.common.Contributor)5 CreditName (org.orcid.jaxb.model.v3.dev1.common.CreditName)5 ContributorOrcid (org.orcid.jaxb.model.v3.dev1.common.ContributorOrcid)4 Work (org.orcid.jaxb.model.v3.dev1.record.Work)4 ContributorEmail (org.orcid.jaxb.model.v3.dev1.common.ContributorEmail)3 Iso3166Country (org.orcid.jaxb.model.v3.dev1.common.Iso3166Country)3 PublicationDate (org.orcid.jaxb.model.v3.dev1.common.PublicationDate)3 Title (org.orcid.jaxb.model.v3.dev1.common.Title)3 TranslatedTitle (org.orcid.jaxb.model.v3.dev1.common.TranslatedTitle)3 FundingContributor (org.orcid.jaxb.model.v3.dev1.record.FundingContributor)3 WorkTitle (org.orcid.jaxb.model.v3.dev1.record.WorkTitle)3 ContributorAttributes (org.orcid.jaxb.model.v3.dev1.common.ContributorAttributes)2 Country (org.orcid.jaxb.model.v3.dev1.common.Country)2 Day (org.orcid.jaxb.model.v3.dev1.common.Day)2 Month (org.orcid.jaxb.model.v3.dev1.common.Month)2 Subtitle (org.orcid.jaxb.model.v3.dev1.common.Subtitle)2 Url (org.orcid.jaxb.model.v3.dev1.common.Url)2 Year (org.orcid.jaxb.model.v3.dev1.common.Year)2 Citation (org.orcid.jaxb.model.v3.dev1.record.Citation)2