Search in sources :

Example 6 with Subtitle

use of org.orcid.jaxb.model.v3.dev1.common.Subtitle 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 7 with Subtitle

use of org.orcid.jaxb.model.v3.dev1.common.Subtitle 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)

Example 8 with Subtitle

use of org.orcid.jaxb.model.v3.dev1.common.Subtitle in project ORCID-Source by ORCID.

the class ActivityUtilsTest method getEmptyWorkSummary.

private WorkSummary getEmptyWorkSummary() {
    WorkSummary s = new WorkSummary();
    WorkTitle title = new WorkTitle();
    title.setTitle(new Title(""));
    title.setSubtitle(new Subtitle(""));
    title.setTranslatedTitle(new TranslatedTitle(""));
    s.setTitle(title);
    return s;
}
Also used : Subtitle(org.orcid.jaxb.model.v3.dev1.common.Subtitle) WorkSummary(org.orcid.jaxb.model.v3.dev1.record.summary.WorkSummary) TranslatedTitle(org.orcid.jaxb.model.v3.dev1.common.TranslatedTitle) WorkTitle(org.orcid.jaxb.model.v3.dev1.record.WorkTitle) 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)

Example 9 with Subtitle

use of org.orcid.jaxb.model.v3.dev1.common.Subtitle in project ORCID-Source by ORCID.

the class MemberV3ApiServiceDelegator_WorksTest method testCleanEmptyFieldsOnWorks.

@Test
public void testCleanEmptyFieldsOnWorks() {
    LastModifiedDate lmd = new LastModifiedDate(DateUtils.convertToXMLGregorianCalendar(System.currentTimeMillis()));
    Work work = new Work();
    work.setLastModifiedDate(lmd);
    work.setWorkCitation(new Citation("", CitationType.FORMATTED_UNSPECIFIED));
    WorkTitle title = new WorkTitle();
    title.setTitle(new Title("My Work"));
    title.setSubtitle(new Subtitle("My subtitle"));
    title.setTranslatedTitle(new TranslatedTitle("", ""));
    work.setWorkTitle(title);
    ActivityUtils.cleanEmptyFields(work);
    assertNotNull(work);
    Utils.verifyLastModified(work.getLastModifiedDate());
    assertNotNull(work.getWorkTitle());
    assertNotNull(work.getWorkTitle().getTitle());
    assertNotNull(work.getWorkTitle().getSubtitle());
    assertEquals("My Work", work.getWorkTitle().getTitle().getContent());
    assertEquals("My subtitle", work.getWorkTitle().getSubtitle().getContent());
    assertNull(work.getWorkCitation());
    assertNull(work.getWorkTitle().getTranslatedTitle());
}
Also used : LastModifiedDate(org.orcid.jaxb.model.v3.dev1.common.LastModifiedDate) 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) Work(org.orcid.jaxb.model.v3.dev1.record.Work) Title(org.orcid.jaxb.model.v3.dev1.common.Title) TranslatedTitle(org.orcid.jaxb.model.v3.dev1.common.TranslatedTitle) WorkTitle(org.orcid.jaxb.model.v3.dev1.record.WorkTitle) Citation(org.orcid.jaxb.model.v3.dev1.record.Citation) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 10 with Subtitle

use of org.orcid.jaxb.model.v3.dev1.common.Subtitle in project ORCID-Source by ORCID.

the class WorksPaginatorTest method getTitle.

private WorkTitle getTitle(int i) {
    WorkTitle title = new WorkTitle();
    title.setTitle(new Title(UUID.randomUUID().toString()));
    title.setSubtitle(new Subtitle(UUID.randomUUID().toString()));
    return title;
}
Also used : Subtitle(org.orcid.jaxb.model.v3.dev1.common.Subtitle) WorkTitle(org.orcid.jaxb.model.v3.dev1.record.WorkTitle) Title(org.orcid.jaxb.model.v3.dev1.common.Title) WorkTitle(org.orcid.jaxb.model.v3.dev1.record.WorkTitle)

Aggregations

Subtitle (org.orcid.jaxb.model.v3.dev1.common.Subtitle)7 Title (org.orcid.jaxb.model.v3.dev1.common.Title)7 WorkTitle (org.orcid.jaxb.model.v3.dev1.record.WorkTitle)7 Work (org.orcid.jaxb.model.v3.dev1.record.Work)6 TranslatedTitle (org.orcid.jaxb.model.v3.dev1.common.TranslatedTitle)5 CreatedDate (org.orcid.jaxb.model.v3.dev1.common.CreatedDate)4 CreditName (org.orcid.jaxb.model.v3.dev1.common.CreditName)3 FuzzyDate (org.orcid.jaxb.model.v3.dev1.common.FuzzyDate)3 LastModifiedDate (org.orcid.jaxb.model.v3.dev1.common.LastModifiedDate)3 PublicationDate (org.orcid.jaxb.model.v3.dev1.common.PublicationDate)3 Url (org.orcid.jaxb.model.v3.dev1.common.Url)3 WorkContributors (org.orcid.jaxb.model.v3.dev1.record.WorkContributors)3 ContributorOrcid (org.orcid.jaxb.model.v3.dev1.common.ContributorOrcid)2 Country (org.orcid.jaxb.model.v3.dev1.common.Country)2 Day (org.orcid.jaxb.model.v3.dev1.common.Day)2 Iso3166Country (org.orcid.jaxb.model.v3.dev1.common.Iso3166Country)2 Month (org.orcid.jaxb.model.v3.dev1.common.Month)2 Year (org.orcid.jaxb.model.v3.dev1.common.Year)2 Citation (org.orcid.jaxb.model.v3.dev1.record.Citation)2 ExternalID (org.orcid.jaxb.model.v3.dev1.record.ExternalID)2