use of org.orcid.core.adapter.impl.jsonidentifiers.PeerReviewWorkExternalIDConverter 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 WorkExternalIDsConverter());
converterFactory.registerConverter("workExternalIdentifierConverterId", new PeerReviewWorkExternalIDConverter());
//do same as work
ClassMapBuilder<PeerReview, PeerReviewEntity> classMap = mapperFactory.classMap(PeerReview.class, PeerReviewEntity.class);
addV2CommonFields(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);
addV2CommonFields(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.core.adapter.impl.jsonidentifiers.PeerReviewWorkExternalIDConverter in project ORCID-Source by ORCID.
the class WorkExternalIdentifiersConversionsTest method testConvertToExternalID.
@Test
public void testConvertToExternalID() {
PeerReviewWorkExternalIDConverter conv = new PeerReviewWorkExternalIDConverter();
ExternalID id = new ExternalID();
id.setRelationship(Relationship.SELF);
id.setType("doi");
id.setUrl(new Url("http://what.com"));
id.setValue("value");
String externalIdentifiersAsString = conv.convertTo(id, null);
assertEquals(expected, externalIdentifiersAsString);
}
use of org.orcid.core.adapter.impl.jsonidentifiers.PeerReviewWorkExternalIDConverter in project ORCID-Source by ORCID.
the class WorkExternalIdentifiersConversionsTest method testConvertFromExternalID.
@Test
public void testConvertFromExternalID() {
PeerReviewWorkExternalIDConverter conv = new PeerReviewWorkExternalIDConverter();
String externalIdentifiersAsString = expected;
ExternalID id = conv.convertFrom(externalIdentifiersAsString, null);
assertEquals(Relationship.SELF, id.getRelationship());
assertEquals(new Url("http://what.com"), id.getUrl());
assertEquals("doi", id.getType());
assertEquals("value", id.getValue());
}
Aggregations