Search in sources :

Example 6 with CreatedDate

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

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

the class PojoUtilTest method affiliationsCreateDateSortString_StartAndEndDateNullTest.

@Test
public void affiliationsCreateDateSortString_StartAndEndDateNullTest() {
    Affiliation aff = new Employment();
    aff.setCreatedDate(new CreatedDate(DateUtils.convertToXMLGregorianCalendar(0)));
    String dateSortString = PojoUtil.createDateSortString(aff);
    assertNotNull(dateSortString);
    assertThat(dateSortString, anyOf(is("Z-1969-12-31"), is("Z-1970-1-1")));
}
Also used : Employment(org.orcid.jaxb.model.v3.dev1.record.Employment) CreatedDate(org.orcid.jaxb.model.v3.dev1.common.CreatedDate) Affiliation(org.orcid.jaxb.model.v3.dev1.record.Affiliation) Test(org.junit.Test)

Example 8 with CreatedDate

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

the class KeywordForm method valueOf.

public static KeywordForm valueOf(Keyword keyword) {
    KeywordForm form = new KeywordForm();
    if (keyword == null) {
        return form;
    }
    if (keyword.getPutCode() != null) {
        form.setPutCode(String.valueOf(keyword.getPutCode()));
    }
    if (!PojoUtil.isEmpty(keyword.getContent())) {
        form.setContent(keyword.getContent());
    }
    if (keyword.getVisibility() != null) {
        form.setVisibility(Visibility.valueOf(keyword.getVisibility()));
    } else {
        form.setVisibility(Visibility.valueOf(org.orcid.jaxb.model.common_v2.Visibility.fromValue(OrcidVisibilityDefaults.KEYWORD_DEFAULT.getVisibility().value())));
    }
    if (keyword.getCreatedDate() != null) {
        Date createdDate = new Date();
        createdDate.setYear(String.valueOf(keyword.getCreatedDate().getValue().getYear()));
        createdDate.setMonth(String.valueOf(keyword.getCreatedDate().getValue().getMonth()));
        createdDate.setDay(String.valueOf(keyword.getCreatedDate().getValue().getDay()));
        form.setCreatedDate(createdDate);
    }
    if (keyword.getLastModifiedDate() != null) {
        Date lastModifiedDate = new Date();
        lastModifiedDate.setYear(String.valueOf(keyword.getLastModifiedDate().getValue().getYear()));
        lastModifiedDate.setMonth(String.valueOf(keyword.getLastModifiedDate().getValue().getMonth()));
        lastModifiedDate.setDay(String.valueOf(keyword.getLastModifiedDate().getValue().getDay()));
        form.setLastModified(lastModifiedDate);
    }
    if (keyword.getSource() != null) {
        // Set source
        form.setSource(keyword.getSource().retrieveSourcePath());
        if (keyword.getSource().getSourceName() != null) {
            form.setSourceName(keyword.getSource().getSourceName().getContent());
        }
    }
    if (keyword.getDisplayIndex() != null) {
        form.setDisplayIndex(keyword.getDisplayIndex());
    } else {
        form.setDisplayIndex(0L);
    }
    return form;
}
Also used : LastModifiedDate(org.orcid.jaxb.model.v3.dev1.common.LastModifiedDate) CreatedDate(org.orcid.jaxb.model.v3.dev1.common.CreatedDate)

Example 9 with CreatedDate

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

the class BiographyManagerReadOnlyImpl method getBiography.

@Override
public Biography getBiography(String orcid) {
    BiographyEntity biographyEntity = null;
    try {
        biographyEntity = biographyDao.getBiography(orcid, getLastModified(orcid));
    } catch (Exception e) {
        LOGGER.debug("Couldn't find biography for " + orcid);
    }
    if (biographyEntity != null) {
        Biography bio = new Biography();
        bio.setContent(biographyEntity.getBiography());
        bio.setVisibility(Visibility.fromValue(biographyEntity.getVisibility().value()));
        bio.setLastModifiedDate(new LastModifiedDate(DateUtils.convertToXMLGregorianCalendar(biographyEntity.getLastModified())));
        bio.setCreatedDate(new CreatedDate(DateUtils.convertToXMLGregorianCalendar(biographyEntity.getDateCreated())));
        return bio;
    }
    return null;
}
Also used : LastModifiedDate(org.orcid.jaxb.model.v3.dev1.common.LastModifiedDate) Biography(org.orcid.jaxb.model.v3.dev1.record.Biography) CreatedDate(org.orcid.jaxb.model.v3.dev1.common.CreatedDate) BiographyEntity(org.orcid.persistence.jpa.entities.BiographyEntity)

Example 10 with CreatedDate

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

the class WorksPaginatorTest method getLimitedWorkGroup.

private WorkGroup getLimitedWorkGroup(int i) {
    WorkGroup workGroup = new WorkGroup();
    workGroup.setLastModifiedDate(new LastModifiedDate(DateUtils.convertToXMLGregorianCalendar(System.currentTimeMillis())));
    for (int x = 0; x < 10; x++) {
        WorkSummary workSummary = new WorkSummary();
        workSummary.setCreatedDate(new CreatedDate(DateUtils.convertToXMLGregorianCalendar(System.currentTimeMillis())));
        workSummary.setTitle(getTitle(i));
        workSummary.setVisibility(Visibility.LIMITED);
        workSummary.setDisplayIndex(Integer.toString(x));
        workSummary.setPutCode(Long.valueOf(new StringBuilder(i).append(x).toString()));
        workSummary.setSource(getSource());
        workSummary.setType(WorkType.EDITED_BOOK);
        workGroup.getWorkSummary().add(workSummary);
    }
    return workGroup;
}
Also used : WorkGroup(org.orcid.jaxb.model.v3.dev1.record.summary.WorkGroup) LastModifiedDate(org.orcid.jaxb.model.v3.dev1.common.LastModifiedDate) WorkSummary(org.orcid.jaxb.model.v3.dev1.record.summary.WorkSummary) CreatedDate(org.orcid.jaxb.model.v3.dev1.common.CreatedDate)

Aggregations

CreatedDate (org.orcid.jaxb.model.v3.dev1.common.CreatedDate)11 LastModifiedDate (org.orcid.jaxb.model.v3.dev1.common.LastModifiedDate)8 PublicationDate (org.orcid.jaxb.model.v3.dev1.common.PublicationDate)4 Day (org.orcid.jaxb.model.v3.dev1.common.Day)3 FuzzyDate (org.orcid.jaxb.model.v3.dev1.common.FuzzyDate)3 Month (org.orcid.jaxb.model.v3.dev1.common.Month)3 Url (org.orcid.jaxb.model.v3.dev1.common.Url)3 Year (org.orcid.jaxb.model.v3.dev1.common.Year)3 Work (org.orcid.jaxb.model.v3.dev1.record.Work)3 WorkGroup (org.orcid.jaxb.model.v3.dev1.record.summary.WorkGroup)3 WorkSummary (org.orcid.jaxb.model.v3.dev1.record.summary.WorkSummary)3 ContributorOrcid (org.orcid.jaxb.model.v3.dev1.common.ContributorOrcid)2 Country (org.orcid.jaxb.model.v3.dev1.common.Country)2 CreditName (org.orcid.jaxb.model.v3.dev1.common.CreditName)2 Iso3166Country (org.orcid.jaxb.model.v3.dev1.common.Iso3166Country)2 Subtitle (org.orcid.jaxb.model.v3.dev1.common.Subtitle)2 Title (org.orcid.jaxb.model.v3.dev1.common.Title)2 ExternalID (org.orcid.jaxb.model.v3.dev1.record.ExternalID)2 ExternalIDs (org.orcid.jaxb.model.v3.dev1.record.ExternalIDs)2 WorkTitle (org.orcid.jaxb.model.v3.dev1.record.WorkTitle)2