use of org.orcid.jaxb.model.v3.dev1.record.WorkTitle 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.v3.dev1.record.WorkTitle 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.record.WorkTitle in project ORCID-Source by ORCID.
the class WorkForm method toWork.
public Work toWork() {
Work work = new Work();
// Set work id
if (!PojoUtil.isEmpty(this.getPutCode())) {
work.setPutCode(Long.valueOf(this.getPutCode().getValue()));
}
// Set language
if (!PojoUtil.isEmpty(this.getLanguageCode())) {
work.setLanguageCode(this.getLanguageCode().getValue());
}
// Set type
if (!PojoUtil.isEmpty(this.getWorkType())) {
work.setWorkType(WorkType.fromValue(this.getWorkType().getValue()));
}
org.orcid.jaxb.model.v3.dev1.record.WorkTitle workTitle = new org.orcid.jaxb.model.v3.dev1.record.WorkTitle();
// Set title
if (!PojoUtil.isEmpty(this.getTitle())) {
workTitle.setTitle(new org.orcid.jaxb.model.v3.dev1.common.Title(this.getTitle().getValue()));
}
// Set translated title
if (this.getTranslatedTitle() != null && !PojoUtil.isEmpty(this.getTranslatedTitle().getContent())) {
org.orcid.jaxb.model.v3.dev1.common.TranslatedTitle translatedTitle = new org.orcid.jaxb.model.v3.dev1.common.TranslatedTitle();
translatedTitle.setContent(this.getTranslatedTitle().getContent());
translatedTitle.setLanguageCode(this.getTranslatedTitle().getLanguageCode());
workTitle.setTranslatedTitle(translatedTitle);
}
// Set subtitle
if (!PojoUtil.isEmpty(this.getSubtitle())) {
org.orcid.jaxb.model.v3.dev1.common.Subtitle subtitle = new org.orcid.jaxb.model.v3.dev1.common.Subtitle();
subtitle.setContent(this.getSubtitle().getValue());
workTitle.setSubtitle(subtitle);
}
work.setWorkTitle(workTitle);
// Set journal title
if (!PojoUtil.isEmpty(this.getJournalTitle())) {
work.setJournalTitle(new org.orcid.jaxb.model.v3.dev1.common.Title(this.getJournalTitle().getValue()));
}
// Set description
if (!PojoUtil.isEmpty(this.getShortDescription())) {
work.setShortDescription(this.getShortDescription().getValue());
}
// Set url
if (!PojoUtil.isEmpty(this.getUrl())) {
work.setUrl(new Url(this.getUrl().getValue()));
} else {
work.setUrl(new Url());
}
// Set visibility
if (this.getVisibility() != null && this.getVisibility().getVisibility() != null) {
work.setVisibility(org.orcid.jaxb.model.v3.dev1.common.Visibility.fromValue(this.getVisibility().getVisibility().value()));
}
// Set country
if (!PojoUtil.isEmpty(this.getCountryCode())) {
work.setCountry(new org.orcid.jaxb.model.v3.dev1.common.Country(org.orcid.jaxb.model.v3.dev1.common.Iso3166Country.fromValue(this.getCountryCode().getValue())));
}
// Set publication date
if (this.getPublicationDate() != null) {
Integer yearInteger = PojoUtil.isEmpty(this.getPublicationDate().getYear()) ? null : Integer.valueOf(this.getPublicationDate().getYear());
Integer monthInteger = PojoUtil.isEmpty(this.getPublicationDate().getMonth()) ? null : Integer.valueOf(this.getPublicationDate().getMonth());
Integer dayInteger = PojoUtil.isEmpty(this.getPublicationDate().getDay()) ? null : Integer.valueOf(this.getPublicationDate().getDay());
org.orcid.jaxb.model.v3.dev1.common.Year year = null;
org.orcid.jaxb.model.v3.dev1.common.Month month = null;
org.orcid.jaxb.model.v3.dev1.common.Day day = null;
if (yearInteger != null) {
year = new org.orcid.jaxb.model.v3.dev1.common.Year(yearInteger);
}
if (monthInteger != null) {
month = new org.orcid.jaxb.model.v3.dev1.common.Month(monthInteger);
}
if (dayInteger != null) {
day = new org.orcid.jaxb.model.v3.dev1.common.Day(dayInteger);
}
work.setPublicationDate(new org.orcid.jaxb.model.v3.dev1.common.PublicationDate(year, month, day));
}
// Set citation
if (this.getCitation() != null) {
org.orcid.jaxb.model.v3.dev1.record.Citation citation = new org.orcid.jaxb.model.v3.dev1.record.Citation();
if (!PojoUtil.isEmpty(this.getCitation().getCitation())) {
citation.setCitation(this.getCitation().getCitation().getValue());
}
if (!PojoUtil.isEmpty(this.getCitation().getCitationType())) {
citation.setWorkCitationType(CitationType.fromValue(this.getCitation().getCitationType().getValue()));
}
work.setWorkCitation(citation);
}
// Set contributors
populateContributors(this, work);
// Set external identifiers
populateExternalIdentifiers(this, work);
// Set created date
if (!PojoUtil.isEmpty(this.getCreatedDate())) {
CreatedDate createdDate = new CreatedDate();
createdDate.setValue(DateUtils.convertToXMLGregorianCalendar(this.getCreatedDate().toJavaDate()));
work.setCreatedDate(createdDate);
}
// Set last modified
if (!PojoUtil.isEmpty(this.getLastModified())) {
org.orcid.jaxb.model.v3.dev1.common.LastModifiedDate lastModified = new org.orcid.jaxb.model.v3.dev1.common.LastModifiedDate();
lastModified.setValue(DateUtils.convertToXMLGregorianCalendar(this.getLastModified().toJavaDate()));
work.setLastModifiedDate(lastModified);
}
if (!PojoUtil.isEmpty(this.getSource())) {
org.orcid.jaxb.model.v3.dev1.common.Source source = new org.orcid.jaxb.model.v3.dev1.common.Source();
if (OrcidStringUtils.isClientId(this.getSource())) {
source.setSourceClientId(new SourceClientId(this.getSource()));
} else {
source.setSourceOrcid(new SourceOrcid(this.getSource()));
}
work.setSource(source);
}
return work;
}
use of org.orcid.jaxb.model.v3.dev1.record.WorkTitle in project ORCID-Source by ORCID.
the class PeerReviewForm method toPeerReview.
public PeerReview toPeerReview() {
PeerReview peerReview = new PeerReview();
// Put Code
if (!PojoUtil.isEmpty(putCode)) {
peerReview.setPutCode(Long.valueOf(putCode.getValue()));
}
// Visibility
if (visibility != null && visibility.getVisibility() != null) {
peerReview.setVisibility(org.orcid.jaxb.model.v3.dev1.common.Visibility.fromValue(visibility.getVisibility().value()));
}
// Completion date
if (completionDate != null) {
peerReview.setCompletionDate(new FuzzyDate(completionDate.toFuzzyDate()));
}
// External identifiers
if (externalIdentifiers != null && !externalIdentifiers.isEmpty()) {
peerReview.setExternalIdentifiers(new ExternalIDs());
for (WorkExternalIdentifier extId : externalIdentifiers) {
peerReview.getExternalIdentifiers().getExternalIdentifier().add(extId.toRecordWorkExternalIdentifier());
}
}
// Set Organization
Organization organization = new Organization();
OrganizationAddress organizationAddress = new OrganizationAddress();
organization.setAddress(organizationAddress);
if (!PojoUtil.isEmpty(orgName)) {
organization.setName(orgName.getValue());
}
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(disambiguatedOrganizationSourceId)) {
organization.setDisambiguatedOrganization(new DisambiguatedOrganization());
organization.getDisambiguatedOrganization().setDisambiguatedOrganizationIdentifier(disambiguatedOrganizationSourceId.getValue());
organization.getDisambiguatedOrganization().setDisambiguationSource(disambiguationSource.getValue());
}
peerReview.setOrganization(organization);
// Role
if (!PojoUtil.isEmpty(role)) {
peerReview.setRole(Role.fromValue(role.getValue()));
}
// Type
if (!PojoUtil.isEmpty(type)) {
peerReview.setType(PeerReviewType.fromValue(type.getValue()));
}
// Url
if (!PojoUtil.isEmpty(url)) {
peerReview.setUrl(new Url(url.getValue()));
}
// Group id
if (!PojoUtil.isEmpty(groupId)) {
peerReview.setGroupId(groupId.getValue());
}
// Subject external id
if (!PojoUtil.isEmpty(subjectExternalIdentifier)) {
ExternalID subjectExtId = new ExternalID();
if (!PojoUtil.isEmpty(subjectExternalIdentifier.getRelationship())) {
subjectExtId.setRelationship(Relationship.fromValue(subjectExternalIdentifier.getRelationship().getValue()));
}
if (!PojoUtil.isEmpty(subjectExternalIdentifier.getUrl())) {
subjectExtId.setUrl(new Url(subjectExternalIdentifier.getUrl().getValue()));
}
if (!PojoUtil.isEmpty(subjectExternalIdentifier.getWorkExternalIdentifierId())) {
subjectExtId.setValue(subjectExternalIdentifier.getWorkExternalIdentifierId().getValue());
}
if (!PojoUtil.isEmpty(subjectExternalIdentifier.getWorkExternalIdentifierType())) {
subjectExtId.setType(subjectExternalIdentifier.getWorkExternalIdentifierType().getValue());
}
peerReview.setSubjectExternalIdentifier(subjectExtId);
}
// Subject container name
if (!PojoUtil.isEmpty(subjectContainerName)) {
Title containerName = new Title(subjectContainerName.getValue());
peerReview.setSubjectContainerName(containerName);
}
// Subject type
if (!PojoUtil.isEmpty(subjectType)) {
peerReview.setSubjectType(WorkType.fromValue(subjectType.getValue()));
}
// Subject name and subject translated name
if (!PojoUtil.isEmpty(subjectName) || !PojoUtil.isEmpty(translatedSubjectName)) {
WorkTitle workTitle = new WorkTitle();
if (!PojoUtil.isEmpty(subjectName)) {
workTitle.setTitle(new Title(subjectName.getValue()));
}
if (translatedSubjectName != null) {
org.orcid.jaxb.model.v3.dev1.common.TranslatedTitle tTitle = new org.orcid.jaxb.model.v3.dev1.common.TranslatedTitle();
if (!PojoUtil.isEmpty(translatedSubjectName.getContent())) {
tTitle.setContent(translatedSubjectName.getContent());
}
if (!PojoUtil.isEmpty(translatedSubjectName.getLanguageCode())) {
tTitle.setLanguageCode(translatedSubjectName.getLanguageCode());
}
workTitle.setTranslatedTitle(tTitle);
}
peerReview.setSubjectName(workTitle);
}
// Subject url
if (!PojoUtil.isEmpty(subjectUrl)) {
peerReview.setSubjectUrl(new Url(subjectUrl.getValue()));
}
return peerReview;
}
use of org.orcid.jaxb.model.v3.dev1.record.WorkTitle 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;
}
Aggregations