use of org.orcid.jaxb.model.v3.dev1.common.LastModifiedDate in project ORCID-Source by ORCID.
the class WorkFormTest method getWorkForm.
private WorkForm getWorkForm() {
WorkForm form = new WorkForm();
form.setCitation(new Citation("Citation", "formatted-unspecified"));
List<Contributor> çontributors = new ArrayList<Contributor>();
Contributor contributor = new Contributor();
contributor.setContributorRole(Text.valueOf("co_inventor"));
contributor.setContributorSequence(Text.valueOf("first"));
contributor.setCreditName(Text.valueOf("Contributor credit name"));
contributor.setEmail(null);
contributor.setOrcid(Text.valueOf("Contributor orcid"));
contributor.setUri(Text.valueOf("Contributor uri"));
çontributors.add(contributor);
form.setContributors(çontributors);
form.setCountryCode(Text.valueOf("US"));
Date createdDate = new Date();
createdDate.setDay("1");
createdDate.setMonth("1");
createdDate.setYear("2015");
form.setCreatedDate(createdDate);
form.setJournalTitle(Text.valueOf("Journal title"));
form.setLanguageCode(Text.valueOf("en"));
Date lastModifiedDate = new Date();
lastModifiedDate.setDay("2");
lastModifiedDate.setMonth("2");
lastModifiedDate.setYear("2015");
form.setLastModified(lastModifiedDate);
Date publicationDate = new Date();
publicationDate.setDay("03");
publicationDate.setMonth("03");
publicationDate.setYear("2015");
form.setPublicationDate(publicationDate);
form.setDateSortString(PojoUtil.createDateSortString(null, FuzzyDate.valueOf(2015, 3, 3)));
form.setPutCode(Text.valueOf("1"));
form.setShortDescription(Text.valueOf("Short description"));
form.setSource("0000-0000-0000-0000");
form.setSubtitle(Text.valueOf("Subtitle"));
form.setTitle(Text.valueOf("Title"));
form.setTranslatedTitle(new TranslatedTitleForm("Translated Title", "es"));
form.setUrl(Text.valueOf("http://myurl.com"));
form.setVisibility(Visibility.valueOf(org.orcid.jaxb.model.v3.dev1.common.Visibility.PUBLIC));
List<WorkExternalIdentifier> extIds = new ArrayList<WorkExternalIdentifier>();
WorkExternalIdentifier extId = new WorkExternalIdentifier();
extId.setWorkExternalIdentifierId(Text.valueOf("External Identifier ID"));
extId.setWorkExternalIdentifierType(Text.valueOf("asin"));
extId.setRelationship(Text.valueOf(Relationship.SELF.value()));
extIds.add(extId);
form.setWorkExternalIdentifiers(extIds);
form.setWorkType(Text.valueOf("artistic-performance"));
WorkCategory category = WorkCategory.fromWorkType(WorkType.fromValue(form.getWorkType().getValue()));
form.setWorkCategory(Text.valueOf(category.value()));
return form;
}
use of org.orcid.jaxb.model.v3.dev1.common.LastModifiedDate in project ORCID-Source by ORCID.
the class KeywordForm method toKeyword.
public Keyword toKeyword() {
Keyword keyword = new Keyword();
if (!PojoUtil.isEmpty(putCode)) {
keyword.setPutCode(Long.valueOf(putCode));
}
if (!PojoUtil.isEmpty(content)) {
keyword.setContent(content);
}
if (visibility != null && visibility.getVisibility() != null) {
keyword.setVisibility(org.orcid.jaxb.model.v3.dev1.common.Visibility.fromValue(visibility.getVisibility().value()));
} else {
keyword.setVisibility(org.orcid.jaxb.model.v3.dev1.common.Visibility.fromValue(OrcidVisibilityDefaults.KEYWORD_DEFAULT.getVisibility().value()));
}
if (createdDate != null) {
keyword.setCreatedDate(new CreatedDate(DateUtils.convertToXMLGregorianCalendar(createdDate.toCalendar())));
}
if (lastModified != null) {
keyword.setLastModifiedDate(new LastModifiedDate(DateUtils.convertToXMLGregorianCalendar(lastModified.toCalendar())));
}
if (displayIndex != null) {
keyword.setDisplayIndex(displayIndex);
} else {
keyword.setDisplayIndex(0L);
}
keyword.setSource(new Source(source));
return keyword;
}
use of org.orcid.jaxb.model.v3.dev1.common.LastModifiedDate in project ORCID-Source by ORCID.
the class WorksPaginatorTest method getMixedWorkGroup.
private WorkGroup getMixedWorkGroup(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(i % 2 == 0 ? Visibility.PUBLIC : Visibility.PRIVATE);
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;
}
use of org.orcid.jaxb.model.v3.dev1.common.LastModifiedDate in project ORCID-Source by ORCID.
the class WorksPaginatorTest method get1000PublicWorkGroups.
private Works get1000PublicWorkGroups() {
Works works = new Works();
works.setLastModifiedDate(new LastModifiedDate(DateUtils.convertToXMLGregorianCalendar(System.currentTimeMillis())));
works.setPath("some path");
for (int i = 0; i < 1000; i++) {
works.getWorkGroup().add(getPublicWorkGroup(i));
}
return works;
}
use of org.orcid.jaxb.model.v3.dev1.common.LastModifiedDate in project ORCID-Source by ORCID.
the class RecordNameManagerV3Test method testUpdateRecordName.
@Test
public void testUpdateRecordName() {
String orcid = "0000-0000-0000-0002";
Name name = recordNameManager.getRecordName(orcid);
assertNotNull(name);
assertEquals("Given Names", name.getGivenNames().getContent());
assertEquals("Family Name", name.getFamilyName().getContent());
assertEquals("Credit Name", name.getCreditName().getContent());
assertEquals(Visibility.LIMITED, name.getVisibility());
LastModifiedDate lastModified = name.getLastModifiedDate();
assertNotNull(lastModified);
long now = System.currentTimeMillis();
name.getCreditName().setContent("Updated Credit Name " + now);
name.getFamilyName().setContent("Updated Family Name " + now);
name.getGivenNames().setContent("Updated Given Names " + now);
name.setVisibility(Visibility.PRIVATE);
recordNameManager.updateRecordName(orcid, name);
Name updatedName = recordNameManager.getRecordName(orcid);
assertNotNull(updatedName);
assertEquals("Updated Given Names " + now, updatedName.getGivenNames().getContent());
assertEquals("Updated Family Name " + now, updatedName.getFamilyName().getContent());
assertEquals("Updated Credit Name " + now, updatedName.getCreditName().getContent());
assertEquals(Visibility.PRIVATE, updatedName.getVisibility());
LastModifiedDate updatedLastModified = updatedName.getLastModifiedDate();
assertNotNull(updatedLastModified);
assertFalse(updatedLastModified.equals(lastModified));
}
Aggregations