Search in sources :

Example 6 with CreatedDate

use of org.orcid.jaxb.model.common_v2.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.common_v2.Visibility.LIMITED);
    work.setWorkCitation(new org.orcid.jaxb.model.record_v2.Citation("Citation", CitationType.BIBTEX));
    WorkContributors contributors = new WorkContributors();
    org.orcid.jaxb.model.common_v2.Contributor contributor = new org.orcid.jaxb.model.common_v2.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.record_v2.ExternalIDs) WorkContributors(org.orcid.jaxb.model.record_v2.WorkContributors) ExternalID(org.orcid.jaxb.model.record_v2.ExternalID) Url(org.orcid.jaxb.model.common_v2.Url) Month(org.orcid.jaxb.model.common_v2.Month) Work(org.orcid.jaxb.model.record_v2.Work) PublicationDate(org.orcid.jaxb.model.common_v2.PublicationDate) ContributorAttributes(org.orcid.jaxb.model.common_v2.ContributorAttributes) CreditName(org.orcid.jaxb.model.common_v2.CreditName) WorkTitle(org.orcid.jaxb.model.record_v2.WorkTitle) Title(org.orcid.jaxb.model.common_v2.Title) TranslatedTitle(org.orcid.jaxb.model.common_v2.TranslatedTitle) Date(java.util.Date) CreatedDate(org.orcid.jaxb.model.common_v2.CreatedDate) PublicationDate(org.orcid.jaxb.model.common_v2.PublicationDate) Subtitle(org.orcid.jaxb.model.common_v2.Subtitle) Year(org.orcid.jaxb.model.common_v2.Year) TranslatedTitle(org.orcid.jaxb.model.common_v2.TranslatedTitle) 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 CreatedDate

use of org.orcid.jaxb.model.common_v2.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.common_v2.LastModifiedDate) CreatedDate(org.orcid.jaxb.model.common_v2.CreatedDate)

Aggregations

CreatedDate (org.orcid.jaxb.model.common_v2.CreatedDate)7 LastModifiedDate (org.orcid.jaxb.model.common_v2.LastModifiedDate)5 PublicationDate (org.orcid.jaxb.model.common_v2.PublicationDate)3 Url (org.orcid.jaxb.model.common_v2.Url)3 Work (org.orcid.jaxb.model.record_v2.Work)3 ContributorOrcid (org.orcid.jaxb.model.common_v2.ContributorOrcid)2 Country (org.orcid.jaxb.model.common_v2.Country)2 CreditName (org.orcid.jaxb.model.common_v2.CreditName)2 Day (org.orcid.jaxb.model.common_v2.Day)2 FuzzyDate (org.orcid.jaxb.model.common_v2.FuzzyDate)2 Iso3166Country (org.orcid.jaxb.model.common_v2.Iso3166Country)2 Month (org.orcid.jaxb.model.common_v2.Month)2 Subtitle (org.orcid.jaxb.model.common_v2.Subtitle)2 Title (org.orcid.jaxb.model.common_v2.Title)2 Year (org.orcid.jaxb.model.common_v2.Year)2 ExternalID (org.orcid.jaxb.model.record_v2.ExternalID)2 ExternalIDs (org.orcid.jaxb.model.record_v2.ExternalIDs)2 WorkTitle (org.orcid.jaxb.model.record_v2.WorkTitle)2 Citation (org.orcid.pojo.ajaxForm.Citation)2 Contributor (org.orcid.pojo.ajaxForm.Contributor)2