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