use of org.orcid.jaxb.model.common_rc4.TranslatedTitle in project ORCID-Source by ORCID.
the class TranslatedTitleForm method toTranslatedTitle.
public TranslatedTitle toTranslatedTitle() {
TranslatedTitle result = new TranslatedTitle();
result.setContent(StringUtils.isEmpty(content) ? null : content);
result.setLanguageCode(StringUtils.isEmpty(languageCode) ? null : languageCode);
return result;
}
use of org.orcid.jaxb.model.common_rc4.TranslatedTitle in project ORCID-Source by ORCID.
the class ActivityValidatorTest method getWorkTitle.
public WorkTitle getWorkTitle() {
WorkTitle title = new WorkTitle();
title.setTitle(new Title("title"));
title.setSubtitle(new Subtitle("subtitle"));
title.setTranslatedTitle(new TranslatedTitle("translated title", "en"));
return title;
}
use of org.orcid.jaxb.model.common_rc4.TranslatedTitle in project ORCID-Source by ORCID.
the class ActivityValidatorTest method getFunding.
public Funding getFunding() {
Funding funding = new Funding();
Amount amount = new Amount();
amount.setContent("1000");
amount.setCurrencyCode("$");
funding.setAmount(amount);
FundingContributor contributor = new FundingContributor();
FundingContributorAttributes attributes = new FundingContributorAttributes();
attributes.setContributorRole(FundingContributorRole.LEAD);
ContributorOrcid contributorOrcid = new ContributorOrcid();
contributorOrcid.setHost("http://test.orcid.org");
contributorOrcid.setPath("0000-0000-0000-0000");
contributorOrcid.setUri("http://test.orcid.org/0000-0000-0000-0000");
contributor.setContributorAttributes(attributes);
contributor.setContributorOrcid(contributorOrcid);
FundingContributors contributors = new FundingContributors();
contributors.getContributor().add(contributor);
funding.setContributors(contributors);
funding.setDescription("description");
funding.setEndDate(getFuzzyDate());
funding.setExternalIdentifiers(getExternalIDs());
funding.setOrganization(getOrganization());
funding.setOrganizationDefinedType(new OrganizationDefinedFundingSubType("subtype"));
funding.setStartDate(getFuzzyDate());
FundingTitle title = new FundingTitle();
title.setTitle(new Title("title"));
title.setTranslatedTitle(new TranslatedTitle("translated title", "en"));
funding.setTitle(title);
funding.setType(FundingType.AWARD);
funding.setUrl(new Url("http://test.orcid.org"));
funding.setVisibility(Visibility.PUBLIC);
return funding;
}
use of org.orcid.jaxb.model.common_rc4.TranslatedTitle in project ORCID-Source by ORCID.
the class WorksTest method getWork.
private Work getWork(String title, boolean randomExtId, String extIdValue) {
Long time = System.currentTimeMillis();
Work work = new Work();
WorkTitle workTitle = new WorkTitle();
Title wTitle = new Title(title);
workTitle.setTranslatedTitle(new TranslatedTitle(title, "en"));
workTitle.setTitle(wTitle);
work.setWorkTitle(workTitle);
work.setWorkType(WorkType.BOOK);
ExternalID extId = new ExternalID();
extId.setRelationship(Relationship.SELF);
if (randomExtId) {
extId.setValue("work-ext-id-" + (Math.random() * 1000) + "-" + time);
} else {
extId.setValue("work-ext-id-" + extIdValue);
}
extId.setType("doi");
ExternalIDs extIds = new ExternalIDs();
extIds.getExternalIdentifier().add(extId);
work.setWorkExternalIdentifiers(extIds);
return work;
}
use of org.orcid.jaxb.model.common_rc4.TranslatedTitle in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegator_ActivitiesSummaryTest method testCleanEmptyFieldsOnActivities.
@Test
public void testCleanEmptyFieldsOnActivities() {
LastModifiedDate lmd = new LastModifiedDate(DateUtils.convertToXMLGregorianCalendar(System.currentTimeMillis()));
Works works = new Works();
works.setLastModifiedDate(lmd);
WorkGroup group = new WorkGroup();
group.setLastModifiedDate(lmd);
for (int i = 0; i < 5; i++) {
WorkSummary summary = new WorkSummary();
summary.setLastModifiedDate(lmd);
WorkTitle title = new WorkTitle();
title.setTitle(new Title("Work " + i));
title.setTranslatedTitle(new TranslatedTitle("", ""));
summary.setTitle(title);
group.getWorkSummary().add(summary);
}
works.getWorkGroup().add(group);
ActivitiesSummary as = new ActivitiesSummary();
as.setWorks(works);
ActivityUtils.cleanEmptyFields(as);
assertNotNull(as);
assertNotNull(as.getWorks());
Utils.verifyLastModified(as.getWorks().getLastModifiedDate());
assertNotNull(as.getWorks().getWorkGroup());
assertEquals(1, as.getWorks().getWorkGroup().size());
assertNotNull(as.getWorks().getWorkGroup().get(0).getWorkSummary());
Utils.verifyLastModified(as.getWorks().getWorkGroup().get(0).getLastModifiedDate());
assertEquals(5, as.getWorks().getWorkGroup().get(0).getWorkSummary().size());
for (WorkSummary summary : as.getWorks().getWorkGroup().get(0).getWorkSummary()) {
Utils.verifyLastModified(summary.getLastModifiedDate());
assertNotNull(summary.getTitle());
assertNotNull(summary.getTitle().getTitle());
assertTrue(summary.getTitle().getTitle().getContent().startsWith("Work "));
assertNull(summary.getTitle().getTranslatedTitle());
}
}
Aggregations