use of org.orcid.jaxb.model.v3.dev1.common.Month in project ORCID-Source by ORCID.
the class MapperFacadeFactory method getPeerReviewMapperFacade.
public MapperFacade getPeerReviewMapperFacade() {
MapperFactory mapperFactory = new DefaultMapperFactory.Builder().build();
ConverterFactory converterFactory = mapperFactory.getConverterFactory();
converterFactory.registerConverter("workExternalIdentifiersConverterId", new JSONWorkExternalIdentifiersConverterV3(norm, localeManager));
converterFactory.registerConverter("workExternalIdentifierConverterId", new JSONPeerReviewWorkExternalIdentifierConverterV3());
// do same as work
ClassMapBuilder<PeerReview, PeerReviewEntity> classMap = mapperFactory.classMap(PeerReview.class, PeerReviewEntity.class);
addV3CommonFields(classMap);
registerSourceConverters(mapperFactory, classMap);
classMap.field("url.value", "url");
classMap.field("organization.name", "org.name");
classMap.field("organization.address.city", "org.city");
classMap.field("organization.address.region", "org.region");
classMap.field("organization.address.country", "org.country");
classMap.field("organization.disambiguatedOrganization.disambiguatedOrganizationIdentifier", "org.orgDisambiguated.sourceId");
classMap.field("organization.disambiguatedOrganization.disambiguationSource", "org.orgDisambiguated.sourceType");
classMap.field("groupId", "groupId");
classMap.field("subjectType", "subjectType");
classMap.field("subjectUrl.value", "subjectUrl");
classMap.field("subjectName.title.content", "subjectName");
classMap.field("subjectName.translatedTitle.content", "subjectTranslatedName");
classMap.field("subjectName.translatedTitle.languageCode", "subjectTranslatedNameLanguageCode");
classMap.field("subjectContainerName.content", "subjectContainerName");
classMap.fieldMap("externalIdentifiers", "externalIdentifiersJson").converter("workExternalIdentifiersConverterId").add();
classMap.fieldMap("subjectExternalIdentifier", "subjectExternalIdentifiersJson").converter("workExternalIdentifierConverterId").add();
classMap.register();
ClassMapBuilder<PeerReviewSummary, PeerReviewEntity> peerReviewSummaryClassMap = mapperFactory.classMap(PeerReviewSummary.class, PeerReviewEntity.class);
addV3CommonFields(peerReviewSummaryClassMap);
registerSourceConverters(mapperFactory, peerReviewSummaryClassMap);
peerReviewSummaryClassMap.fieldMap("externalIdentifiers", "externalIdentifiersJson").converter("workExternalIdentifiersConverterId").add();
peerReviewSummaryClassMap.field("organization.name", "org.name");
peerReviewSummaryClassMap.field("organization.address.city", "org.city");
peerReviewSummaryClassMap.field("organization.address.region", "org.region");
peerReviewSummaryClassMap.field("organization.address.country", "org.country");
peerReviewSummaryClassMap.field("organization.disambiguatedOrganization.disambiguatedOrganizationIdentifier", "org.orgDisambiguated.sourceId");
peerReviewSummaryClassMap.field("organization.disambiguatedOrganization.disambiguationSource", "org.orgDisambiguated.sourceType");
peerReviewSummaryClassMap.register();
mapperFactory.classMap(FuzzyDate.class, CompletionDateEntity.class).field("year.value", "year").field("month.value", "month").field("day.value", "day").register();
return mapperFactory.getMapperFacade();
}
use of org.orcid.jaxb.model.v3.dev1.common.Month in project ORCID-Source by ORCID.
the class AffiliationsManagerTest method fillAffiliation.
private void fillAffiliation(Affiliation aff) {
Organization org = new Organization();
org.setName("org-name");
OrganizationAddress address = new OrganizationAddress();
address.setCity("city");
address.setCountry(Iso3166Country.US);
org.setAddress(address);
DisambiguatedOrganization disambiguatedOrg = new DisambiguatedOrganization();
disambiguatedOrg.setDisambiguatedOrganizationIdentifier("def456");
disambiguatedOrg.setDisambiguationSource("WDB");
org.setDisambiguatedOrganization(disambiguatedOrg);
aff.setOrganization(org);
aff.setStartDate(new FuzzyDate(new Year(2016), new Month(3), new Day(29)));
aff.setVisibility(Visibility.PUBLIC);
}
use of org.orcid.jaxb.model.v3.dev1.common.Month in project ORCID-Source by ORCID.
the class V3WorkToCiteprocTranslator method translateFromWorkMetadata.
/**
* Use the ORCID work metadata to generate a *limited* citation. You'll most
* likely get a title, doi, url, date and author.
*
* Translates type according to https://docs.google.com/spreadsheets/d/
* 1h4nTF6DKNEpWcGNQVMDwt0ea09qmkBnkWisxkJE-li4/edit#gid=754644608
*
* Informed by mendley tranforms at
* http://support.mendeley.com/customer/portal/articles/364144-csl-type-
* mapping
*
* See also:
* http://docs.citationstyles.org/en/stable/specification.html#appendix-iii-
* types http://members.orcid.org/api/supported-work-types datacite and
* crossref mappings here:
* https://github.com/lagotto/lagotto/blob/master/config/initializers/
* constants.rb
* @param creditName
*
* @param worktype
* @return a CSLItemData, default CSLType.ARTICLE if cannot map type
*/
private CSLItemData translateFromWorkMetadata(Work work, String creditName) {
CSLItemDataBuilder builder = new CSLItemDataBuilder();
builder.title((work.getWorkTitle() != null) ? StringUtils.stripAccents(work.getWorkTitle().getTitle().getContent()) : "No Title");
String doi = extractID(work, WorkExternalIdentifierType.DOI);
String url = extractID(work, WorkExternalIdentifierType.URI);
if (doi != null) {
builder.DOI(doi);
}
if (url != null) {
builder.URL(url);
} else if (doi != null) {
builder.URL("http://doi.org/" + doi);
} else {
url = extractID(work, WorkExternalIdentifierType.HANDLE);
if (url != null) {
builder.URL(url);
}
}
if (work.getJournalTitle() != null) {
builder.containerTitle(StringUtils.stripAccents(work.getJournalTitle().getContent()));
}
List<String> names = new ArrayList<String>();
// TODO: Pass in credit name
names.add(creditName);
if (work.getWorkContributors() != null && work.getWorkContributors().getContributor() != null) {
for (Contributor c : work.getWorkContributors().getContributor()) {
if (c.getCreditName() != null && c.getCreditName().getContent() != null) {
names.add(StringUtils.stripAccents(c.getCreditName().getContent()));
}
}
}
CSLNameBuilder name = new CSLNameBuilder();
name.literal(Joiner.on(" and ").skipNulls().join(names));
builder.author(name.build());
// TODO: make it work with "Spring", "August", whatever...
if (work.getPublicationDate() != null) {
int year = 0;
int month = 0;
int day = 0;
try {
year = Integer.parseInt(work.getPublicationDate().getYear().getValue());
month = Integer.parseInt(work.getPublicationDate().getMonth().getValue());
day = Integer.parseInt(work.getPublicationDate().getDay().getValue());
} catch (Exception e) {
}
if (year > 0 && month > 0 && day > 0) {
builder.issued(year, month, day);
} else if (year > 0 && month > 0) {
builder.issued(year, month);
} else if (year > 0) {
builder.issued(year);
}
}
switch(work.getWorkType()) {
case ARTISTIC_PERFORMANCE:
break;
case BOOK:
builder.type(CSLType.BOOK);
break;
case BOOK_CHAPTER:
builder.type(CSLType.CHAPTER);
break;
case BOOK_REVIEW:
builder.type(CSLType.REVIEW_BOOK);
break;
case CONFERENCE_ABSTRACT:
builder.type(CSLType.PAPER_CONFERENCE);
break;
case CONFERENCE_PAPER:
builder.type(CSLType.PAPER_CONFERENCE);
break;
case CONFERENCE_POSTER:
builder.type(CSLType.PAPER_CONFERENCE);
break;
case DATA_SET:
builder.type(CSLType.DATASET);
break;
case DICTIONARY_ENTRY:
builder.type(CSLType.ENTRY_DICTIONARY);
break;
case DISSERTATION:
builder.type(CSLType.THESIS);
break;
case ENCYCLOPEDIA_ENTRY:
builder.type(CSLType.ENTRY_ENCYCLOPEDIA);
break;
case JOURNAL_ARTICLE:
builder.type(CSLType.ARTICLE_JOURNAL);
break;
case MAGAZINE_ARTICLE:
builder.type(CSLType.ARTICLE_MAGAZINE);
break;
case NEWSLETTER_ARTICLE:
builder.type(CSLType.ARTICLE_NEWSPAPER);
break;
case NEWSPAPER_ARTICLE:
builder.type(CSLType.ARTICLE_NEWSPAPER);
break;
case ONLINE_RESOURCE:
builder.type(CSLType.WEBPAGE);
break;
case REPORT:
builder.type(CSLType.REPORT);
break;
case WEBSITE:
builder.type(CSLType.WEBPAGE);
break;
case WORKING_PAPER:
builder.type(CSLType.ARTICLE);
break;
case DISCLOSURE:
case EDITED_BOOK:
case INVENTION:
case JOURNAL_ISSUE:
case LECTURE_SPEECH:
case LICENSE:
case MANUAL:
case OTHER:
case PATENT:
case REGISTERED_COPYRIGHT:
case RESEARCH_TECHNIQUE:
case RESEARCH_TOOL:
case SPIN_OFF_COMPANY:
case STANDARDS_AND_POLICY:
case SUPERVISED_STUDENT_PUBLICATION:
case TECHNICAL_STANDARD:
case TEST:
case TRADEMARK:
case TRANSLATION:
case UNDEFINED:
default:
// builder.type(CSLType.ARTICLE);
break;
}
return builder.build();
}
Aggregations