use of org.orcid.jaxb.model.v3.dev1.common.Contributor in project ORCID-Source by ORCID.
the class WorkFormTest method getWork.
private Work getWork() {
Work work = new Work();
work.setCountry(new Country(Iso3166Country.US));
work.setJournalTitle(new Title("Journal title"));
work.setLanguageCode("en");
work.setPutCode(Long.valueOf("1"));
work.setShortDescription("Short description");
work.setSource(new org.orcid.jaxb.model.v3.dev1.common.Source("0000-0000-0000-0000"));
work.setUrl(new Url("http://myurl.com"));
work.setVisibility(org.orcid.jaxb.model.v3.dev1.common.Visibility.PUBLIC);
org.orcid.jaxb.model.v3.dev1.record.Citation citation = new org.orcid.jaxb.model.v3.dev1.record.Citation();
citation.setCitation("Citation");
citation.setWorkCitationType(CitationType.FORMATTED_UNSPECIFIED);
work.setWorkCitation(citation);
WorkTitle title = new WorkTitle();
title.setTitle(new Title("Title"));
title.setTranslatedTitle(new org.orcid.jaxb.model.v3.dev1.common.TranslatedTitle("Translated Title", "es"));
title.setSubtitle(new Subtitle("Subtitle"));
work.setWorkTitle(title);
work.setWorkType(WorkType.ARTISTIC_PERFORMANCE);
Date date = new Date();
date.setDay("1");
date.setMonth("1");
date.setYear("2015");
GregorianCalendar calendar = date.toCalendar();
work.setCreatedDate(new CreatedDate(datatypeFactory.newXMLGregorianCalendar(calendar)));
date = new Date();
date.setDay("2");
date.setMonth("2");
date.setYear("2015");
calendar = date.toCalendar();
work.setLastModifiedDate(new LastModifiedDate(datatypeFactory.newXMLGregorianCalendar(calendar)));
work.setPublicationDate(new PublicationDate(new Year(2015), new Month(3), new Day(3)));
org.orcid.jaxb.model.v3.dev1.record.WorkContributors contributors = new org.orcid.jaxb.model.v3.dev1.record.WorkContributors();
org.orcid.jaxb.model.v3.dev1.common.Contributor contributor = new org.orcid.jaxb.model.v3.dev1.common.Contributor();
org.orcid.jaxb.model.v3.dev1.common.ContributorAttributes attributes = new org.orcid.jaxb.model.v3.dev1.common.ContributorAttributes();
attributes.setContributorRole(org.orcid.jaxb.model.v3.dev1.common.ContributorRole.CO_INVENTOR);
attributes.setContributorSequence(org.orcid.jaxb.model.v3.dev1.record.SequenceType.FIRST);
contributor.setContributorAttributes(attributes);
contributor.setContributorEmail(null);
ContributorOrcid contributorOrcid = new ContributorOrcid("Contributor orcid");
contributorOrcid.setUri("Contributor uri");
contributor.setContributorOrcid(contributorOrcid);
CreditName creditName = new CreditName("Contributor credit name");
contributor.setCreditName(creditName);
contributors.getContributor().add(contributor);
work.setWorkContributors(contributors);
ExternalIDs externalIdentifiers = new ExternalIDs();
ExternalID extId = new ExternalID();
extId.setValue("External Identifier ID");
extId.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.ASIN.value());
extId.setRelationship(Relationship.SELF);
externalIdentifiers.getExternalIdentifier().add(extId);
work.setWorkExternalIdentifiers(externalIdentifiers);
return work;
}
use of org.orcid.jaxb.model.v3.dev1.common.Contributor 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.Contributor in project ORCID-Source by ORCID.
the class Contributor method valueOf.
public static Contributor valueOf(FundingContributor contributor) {
Contributor c = new Contributor();
if (contributor != null) {
if (contributor.getContributorAttributes() != null) {
contributor.getContributorAttributes();
if (contributor.getContributorAttributes().getContributorRole() != null)
c.setContributorRole(Text.valueOf(contributor.getContributorAttributes().getContributorRole().value()));
}
if (contributor.getContributorOrcid() != null) {
c.setOrcid(Text.valueOf(contributor.getContributorOrcid().getPath()));
c.setUri(Text.valueOf(contributor.getContributorOrcid().getUri()));
}
if (contributor.getCreditName() != null) {
c.setCreditName(Text.valueOf(contributor.getCreditName().getContent()));
}
}
return c;
}
use of org.orcid.jaxb.model.v3.dev1.common.Contributor in project ORCID-Source by ORCID.
the class FundingForm method toFunding.
public Funding toFunding() {
Funding result = new Funding();
Amount orcidAmount = new Amount();
if (!PojoUtil.isEmpty(amount))
orcidAmount.setContent(amount.getValue());
if (!PojoUtil.isEmpty(currencyCode))
orcidAmount.setCurrencyCode(currencyCode.getValue());
result.setAmount(orcidAmount);
if (!PojoUtil.isEmpty(description))
result.setDescription(description.getValue());
if (!PojoUtil.isEmpty(startDate))
result.setStartDate(new FuzzyDate(startDate.toFuzzyDate()));
if (!PojoUtil.isEmpty(endDate))
result.setEndDate(new FuzzyDate(endDate.toFuzzyDate()));
if (!PojoUtil.isEmpty(putCode))
result.setPutCode(Long.valueOf(putCode.getValue()));
if (fundingTitle != null) {
result.setTitle(fundingTitle.toFundingTitle());
}
if (!PojoUtil.isEmpty(fundingType))
result.setType(FundingType.fromValue(fundingType.getValue()));
if (organizationDefinedFundingSubType != null && !PojoUtil.isEmpty(organizationDefinedFundingSubType.getSubtype()))
result.setOrganizationDefinedType(new OrganizationDefinedFundingSubType(organizationDefinedFundingSubType.getSubtype().getValue()));
if (!PojoUtil.isEmpty(url))
result.setUrl(new Url(url.getValue()));
else
result.setUrl(new Url());
if (visibility != null)
result.setVisibility(org.orcid.jaxb.model.v3.dev1.common.Visibility.fromValue(visibility.getVisibility().value()));
// Set Organization
Organization organization = new Organization();
if (!PojoUtil.isEmpty(fundingName))
organization.setName(fundingName.getValue());
OrganizationAddress organizationAddress = new OrganizationAddress();
organization.setAddress(organizationAddress);
if (!PojoUtil.isEmpty(city))
organizationAddress.setCity(city.getValue());
if (!PojoUtil.isEmpty(region)) {
organizationAddress.setRegion(region.getValue());
}
if (!PojoUtil.isEmpty(country)) {
organizationAddress.setCountry(Iso3166Country.fromValue(country.getValue()));
}
if (!PojoUtil.isEmpty(disambiguatedFundingSourceId)) {
organization.setDisambiguatedOrganization(new DisambiguatedOrganization());
organization.getDisambiguatedOrganization().setDisambiguatedOrganizationIdentifier(disambiguatedFundingSourceId.getValue());
organization.getDisambiguatedOrganization().setDisambiguationSource(disambiguationSource.getValue());
}
result.setOrganization(organization);
// Set contributors
if (contributors != null && !contributors.isEmpty()) {
FundingContributors fContributors = new FundingContributors();
for (Contributor contributor : contributors) {
if (!PojoUtil.isEmtpy(contributor))
fContributors.getContributor().add(contributor.toFundingContributor());
}
result.setContributors(fContributors);
}
// Set external identifiers
if (externalIdentifiers != null && !externalIdentifiers.isEmpty()) {
ExternalIDs fExternalIdentifiers = new ExternalIDs();
for (FundingExternalIdentifierForm fExternalIdentifier : externalIdentifiers) {
if (!PojoUtil.isEmtpy(fExternalIdentifier))
fExternalIdentifiers.getExternalIdentifier().add(fExternalIdentifier.toFundingExternalIdentifier());
}
result.setExternalIdentifiers(fExternalIdentifiers);
}
return result;
}
use of org.orcid.jaxb.model.v3.dev1.common.Contributor in project ORCID-Source by ORCID.
the class WorksController method getWorkInfo.
/**
* Returns a blank work
*/
@RequestMapping(value = "/getWorkInfo.json", method = RequestMethod.GET)
@ResponseBody
public WorkForm getWorkInfo(@RequestParam(value = "workId") Long workId) {
Map<String, String> countries = retrieveIsoCountries();
Map<String, String> languages = lm.buildLanguageMap(localeManager.getLocale(), false);
if (workId == null)
return null;
Work work = workManager.getWork(this.getEffectiveUserOrcid(), workId);
if (work != null) {
WorkForm workForm = WorkForm.valueOf(work);
if (workForm.getPublicationDate() == null) {
initializePublicationDate(workForm);
} else {
if (workForm.getPublicationDate().getDay() == null) {
workForm.getPublicationDate().setDay(new String());
}
if (workForm.getPublicationDate().getMonth() == null) {
workForm.getPublicationDate().setMonth(new String());
}
if (workForm.getPublicationDate().getYear() == null) {
workForm.getPublicationDate().setYear(new String());
}
}
// Set country name
if (!PojoUtil.isEmpty(workForm.getCountryCode())) {
Text countryName = Text.valueOf(countries.get(workForm.getCountryCode().getValue()));
workForm.setCountryName(countryName);
}
// Set language name
if (!PojoUtil.isEmpty(workForm.getLanguageCode())) {
Text languageName = Text.valueOf(languages.get(workForm.getLanguageCode().getValue()));
workForm.setLanguageName(languageName);
}
// Set translated title language name
if (!(workForm.getTranslatedTitle() == null) && !StringUtils.isEmpty(workForm.getTranslatedTitle().getLanguageCode())) {
String languageName = languages.get(workForm.getTranslatedTitle().getLanguageCode());
workForm.getTranslatedTitle().setLanguageName(languageName);
}
if (workForm.getContributors() != null) {
for (Contributor contributor : workForm.getContributors()) {
if (!PojoUtil.isEmpty(contributor.getOrcid())) {
String contributorOrcid = contributor.getOrcid().getValue();
if (profileEntityManager.orcidExists(contributorOrcid)) {
// contributor is an ORCID user - visibility of user's name in record must be taken into account
ProfileEntity profileEntity = profileEntityCacheManager.retrieve(contributorOrcid);
String publicContributorCreditName = activityManager.getPublicCreditName(profileEntity);
contributor.setCreditName(Text.valueOf(publicContributorCreditName));
}
}
}
}
return workForm;
}
return null;
}
Aggregations