Search in sources :

Example 1 with TranslatedTitle

use of org.orcid.jaxb.model.common_v2.TranslatedTitle in project ORCID-Source by ORCID.

the class WorksTest method getWork.

private Work getWork(String title, boolean randomExtId, String extIdValue) {
    Long time = System.currentTimeMillis();
    Work work = new Work();
    WorkTitle workTitle = new WorkTitle();
    Title wTitle = new Title(title);
    workTitle.setTranslatedTitle(new TranslatedTitle(title, "en"));
    workTitle.setTitle(wTitle);
    work.setWorkTitle(workTitle);
    work.setWorkType(WorkType.BOOK);
    ExternalID extId = new ExternalID();
    extId.setRelationship(Relationship.SELF);
    if (randomExtId) {
        extId.setValue("work-ext-id-" + (Math.random() * 1000) + "-" + time);
    } else {
        extId.setValue("work-ext-id-" + extIdValue);
    }
    extId.setType("doi");
    ExternalIDs extIds = new ExternalIDs();
    extIds.getExternalIdentifier().add(extId);
    work.setWorkExternalIdentifiers(extIds);
    return work;
}
Also used : ExternalIDs(org.orcid.jaxb.model.record_rc4.ExternalIDs) TranslatedTitle(org.orcid.jaxb.model.common_rc4.TranslatedTitle) WorkTitle(org.orcid.jaxb.model.record_rc4.WorkTitle) ExternalID(org.orcid.jaxb.model.record_rc4.ExternalID) Work(org.orcid.jaxb.model.record_rc4.Work) TranslatedTitle(org.orcid.jaxb.model.common_rc4.TranslatedTitle) Title(org.orcid.jaxb.model.common_rc4.Title) WorkTitle(org.orcid.jaxb.model.record_rc4.WorkTitle)

Example 2 with TranslatedTitle

use of org.orcid.jaxb.model.common_v2.TranslatedTitle in project ORCID-Source by ORCID.

the class WorksTest method getWork.

private Work getWork(String title, boolean randomExtId, String extIdValue) {
    Long time = System.currentTimeMillis();
    Work work = new Work();
    WorkTitle workTitle = new WorkTitle();
    Title wTitle = new Title(title);
    workTitle.setTranslatedTitle(new TranslatedTitle(title, "en"));
    workTitle.setTitle(wTitle);
    work.setWorkTitle(workTitle);
    work.setWorkType(WorkType.BOOK);
    ExternalID extId = new ExternalID();
    extId.setRelationship(Relationship.SELF);
    if (randomExtId) {
        extId.setValue("work-ext-id-" + (Math.random() * 1000) + "-" + time);
    } else {
        extId.setValue("work-ext-id-" + extIdValue);
    }
    extId.setType("doi");
    ExternalIDs extIds = new ExternalIDs();
    extIds.getExternalIdentifier().add(extId);
    work.setWorkExternalIdentifiers(extIds);
    return work;
}
Also used : ExternalIDs(org.orcid.jaxb.model.record_rc3.ExternalIDs) TranslatedTitle(org.orcid.jaxb.model.common_rc3.TranslatedTitle) WorkTitle(org.orcid.jaxb.model.record_rc3.WorkTitle) ExternalID(org.orcid.jaxb.model.record_rc3.ExternalID) Work(org.orcid.jaxb.model.record_rc3.Work) WorkTitle(org.orcid.jaxb.model.record_rc3.WorkTitle) Title(org.orcid.jaxb.model.common_rc3.Title) TranslatedTitle(org.orcid.jaxb.model.common_rc3.TranslatedTitle)

Example 3 with TranslatedTitle

use of org.orcid.jaxb.model.common_v2.TranslatedTitle in project ORCID-Source by ORCID.

the class MemberV2ApiServiceDelegator_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.common_v2.LastModifiedDate) Subtitle(org.orcid.jaxb.model.common_v2.Subtitle) TranslatedTitle(org.orcid.jaxb.model.common_v2.TranslatedTitle) WorkTitle(org.orcid.jaxb.model.record_v2.WorkTitle) Work(org.orcid.jaxb.model.record_v2.Work) WorkTitle(org.orcid.jaxb.model.record_v2.WorkTitle) TranslatedTitle(org.orcid.jaxb.model.common_v2.TranslatedTitle) Title(org.orcid.jaxb.model.common_v2.Title) Citation(org.orcid.jaxb.model.record_v2.Citation) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 4 with TranslatedTitle

use of org.orcid.jaxb.model.common_v2.TranslatedTitle in project ORCID-Source by ORCID.

the class WorksTest method getWork.

private Work getWork(String title, boolean randomExtId, String extIdValue) {
    Long time = System.currentTimeMillis();
    Work work = new Work();
    WorkTitle workTitle = new WorkTitle();
    Title wTitle = new Title(title);
    workTitle.setTranslatedTitle(new TranslatedTitle(title, "en"));
    workTitle.setTitle(wTitle);
    work.setWorkTitle(workTitle);
    work.setWorkType(WorkType.BOOK);
    ExternalID extId = new ExternalID();
    extId.setRelationship(Relationship.SELF);
    if (randomExtId) {
        extId.setValue("work-ext-id-" + (Math.random() * 1000) + "-" + time);
    } else {
        extId.setValue("work-ext-id-" + extIdValue);
    }
    extId.setType("doi");
    ExternalIDs extIds = new ExternalIDs();
    extIds.getExternalIdentifier().add(extId);
    work.setWorkExternalIdentifiers(extIds);
    return work;
}
Also used : ExternalIDs(org.orcid.jaxb.model.record_v2.ExternalIDs) TranslatedTitle(org.orcid.jaxb.model.common_v2.TranslatedTitle) WorkTitle(org.orcid.jaxb.model.record_v2.WorkTitle) ExternalID(org.orcid.jaxb.model.record_v2.ExternalID) Work(org.orcid.jaxb.model.record_v2.Work) WorkTitle(org.orcid.jaxb.model.record_v2.WorkTitle) Title(org.orcid.jaxb.model.common_v2.Title) TranslatedTitle(org.orcid.jaxb.model.common_v2.TranslatedTitle)

Example 5 with TranslatedTitle

use of org.orcid.jaxb.model.common_v2.TranslatedTitle 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.common_v2.Subtitle) WorkSummary(org.orcid.jaxb.model.record.summary_v2.WorkSummary) TranslatedTitle(org.orcid.jaxb.model.common_v2.TranslatedTitle) WorkTitle(org.orcid.jaxb.model.record_v2.WorkTitle) WorkTitle(org.orcid.jaxb.model.record_v2.WorkTitle) Title(org.orcid.jaxb.model.common_v2.Title) TranslatedTitle(org.orcid.jaxb.model.common_v2.TranslatedTitle)

Aggregations

WorkTitle (org.orcid.jaxb.model.record_v2.WorkTitle)9 Title (org.orcid.jaxb.model.common_v2.Title)8 TranslatedTitle (org.orcid.jaxb.model.common_v2.TranslatedTitle)8 Work (org.orcid.jaxb.model.record_v2.Work)5 Subtitle (org.orcid.jaxb.model.common_v2.Subtitle)4 ExternalID (org.orcid.jaxb.model.record_v2.ExternalID)3 ExternalIDs (org.orcid.jaxb.model.record_v2.ExternalIDs)3 FundingTitle (org.orcid.jaxb.model.record_v2.FundingTitle)3 Test (org.junit.Test)2 Amount (org.orcid.jaxb.model.common_v2.Amount)2 Contributor (org.orcid.jaxb.model.common_v2.Contributor)2 ContributorOrcid (org.orcid.jaxb.model.common_v2.ContributorOrcid)2 LastModifiedDate (org.orcid.jaxb.model.common_v2.LastModifiedDate)2 Citation (org.orcid.jaxb.model.record_v2.Citation)2 Funding (org.orcid.jaxb.model.record_v2.Funding)2 Arrays (java.util.Arrays)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Matcher (java.util.regex.Matcher)1 Pattern (java.util.regex.Pattern)1