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;
}
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;
}
Aggregations