use of org.orcid.jaxb.model.v3.dev1.common.Url in project ORCID-Source by ORCID.
the class MapperFacadeFactory method getFundingMapperFacade.
public MapperFacade getFundingMapperFacade() {
MapperFactory mapperFactory = new DefaultMapperFactory.Builder().build();
ConverterFactory converterFactory = mapperFactory.getConverterFactory();
converterFactory.registerConverter("fundingExternalIdentifiersConverterId", new JSONFundingExternalIdentifiersConverterV3());
converterFactory.registerConverter("fundingContributorsConverterId", new JsonOrikaConverter<FundingContributors>());
ClassMapBuilder<Funding, ProfileFundingEntity> fundingClassMap = mapperFactory.classMap(Funding.class, ProfileFundingEntity.class);
addV3CommonFields(fundingClassMap);
registerSourceConverters(mapperFactory, fundingClassMap);
fundingClassMap.field("type", "type");
fundingClassMap.field("organizationDefinedType.content", "organizationDefinedType");
fundingClassMap.field("title.title.content", "title");
fundingClassMap.field("title.translatedTitle.content", "translatedTitle");
fundingClassMap.field("title.translatedTitle.languageCode", "translatedTitleLanguageCode");
fundingClassMap.field("description", "description");
fundingClassMap.field("amount.content", "numericAmount");
fundingClassMap.field("amount.currencyCode", "currencyCode");
fundingClassMap.field("url.value", "url");
fundingClassMap.fieldBToA("org.name", "organization.name");
fundingClassMap.fieldBToA("org.city", "organization.address.city");
fundingClassMap.fieldBToA("org.region", "organization.address.region");
fundingClassMap.fieldBToA("org.country", "organization.address.country");
fundingClassMap.fieldBToA("org.orgDisambiguated.sourceId", "organization.disambiguatedOrganization.disambiguatedOrganizationIdentifier");
fundingClassMap.fieldBToA("org.orgDisambiguated.sourceType", "organization.disambiguatedOrganization.disambiguationSource");
fundingClassMap.fieldBToA("org.orgDisambiguated.id", "organization.disambiguatedOrganization.id");
fundingClassMap.fieldMap("externalIdentifiers", "externalIdentifiersJson").converter("fundingExternalIdentifiersConverterId").add();
fundingClassMap.fieldMap("contributors", "contributorsJson").converter("fundingContributorsConverterId").add();
fundingClassMap.register();
ClassMapBuilder<FundingSummary, ProfileFundingEntity> fundingSummaryClassMap = mapperFactory.classMap(FundingSummary.class, ProfileFundingEntity.class);
addV3CommonFields(fundingSummaryClassMap);
registerSourceConverters(mapperFactory, fundingSummaryClassMap);
fundingSummaryClassMap.field("type", "type");
fundingSummaryClassMap.field("title.title.content", "title");
fundingSummaryClassMap.field("title.translatedTitle.content", "translatedTitle");
fundingSummaryClassMap.field("title.translatedTitle.languageCode", "translatedTitleLanguageCode");
fundingSummaryClassMap.fieldMap("externalIdentifiers", "externalIdentifiersJson").converter("fundingExternalIdentifiersConverterId").add();
fundingSummaryClassMap.fieldBToA("org.name", "organization.name");
fundingSummaryClassMap.fieldBToA("org.city", "organization.address.city");
fundingSummaryClassMap.fieldBToA("org.region", "organization.address.region");
fundingSummaryClassMap.fieldBToA("org.country", "organization.address.country");
fundingSummaryClassMap.fieldBToA("org.orgDisambiguated.sourceId", "organization.disambiguatedOrganization.disambiguatedOrganizationIdentifier");
fundingSummaryClassMap.fieldBToA("org.orgDisambiguated.sourceType", "organization.disambiguatedOrganization.disambiguationSource");
fundingSummaryClassMap.fieldBToA("org.orgDisambiguated.id", "organization.disambiguatedOrganization.id");
fundingSummaryClassMap.register();
mapperFactory.classMap(FuzzyDate.class, StartDateEntity.class).field("year.value", "year").field("month.value", "month").field("day.value", "day").register();
mapperFactory.classMap(FuzzyDate.class, EndDateEntity.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.Url in project ORCID-Source by ORCID.
the class MapperFacadeFactory method getResearcherUrlMapperFacade.
public MapperFacade getResearcherUrlMapperFacade() {
MapperFactory mapperFactory = new DefaultMapperFactory.Builder().build();
ClassMapBuilder<ResearcherUrl, ResearcherUrlEntity> researcherUrlClassMap = mapperFactory.classMap(ResearcherUrl.class, ResearcherUrlEntity.class);
addV3DateFields(researcherUrlClassMap);
registerSourceConverters(mapperFactory, researcherUrlClassMap);
researcherUrlClassMap.field("putCode", "id");
researcherUrlClassMap.field("url.value", "url");
researcherUrlClassMap.field("urlName", "urlName");
researcherUrlClassMap.fieldBToA("displayIndex", "displayIndex");
researcherUrlClassMap.byDefault();
researcherUrlClassMap.register();
return mapperFactory.getMapperFacade();
}
use of org.orcid.jaxb.model.v3.dev1.common.Url 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.Url in project ORCID-Source by ORCID.
the class JSONFundingExternalIdentifiersConverterV3 method convertFrom.
@Override
public ExternalIDs convertFrom(String source, Type<ExternalIDs> destinationType) {
JSONFundingExternalIdentifiers fundingExternalIdentifiers = JsonUtils.readObjectFromJsonString(source, JSONFundingExternalIdentifiers.class);
ExternalIDs externalIDs = new ExternalIDs();
for (JSONExternalIdentifier externalIdentifier : fundingExternalIdentifiers.getFundingExternalIdentifier()) {
ExternalID id = new ExternalID();
if (externalIdentifier.getType() == null) {
id.setType(FundingExternalIdentifierType.GRANT_NUMBER.value());
} else {
id.setType(externalIdentifier.getType().toLowerCase());
}
if (externalIdentifier.getUrl() != null && !PojoUtil.isEmpty(externalIdentifier.getUrl().getValue())) {
Url url = new Url(externalIdentifier.getUrl().getValue());
id.setUrl(url);
}
if (!PojoUtil.isEmpty(externalIdentifier.getValue())) {
id.setValue(externalIdentifier.getValue());
}
if (externalIdentifier.getRelationship() != null) {
id.setRelationship(Relationship.fromValue(conv.convertFrom(externalIdentifier.getRelationship(), null)));
}
externalIDs.getExternalIdentifier().add(id);
}
return externalIDs;
}
use of org.orcid.jaxb.model.v3.dev1.common.Url in project ORCID-Source by ORCID.
the class JSONPeerReviewWorkExternalIdentifierConverterV3 method convertFrom.
@Override
public ExternalID convertFrom(String source, Type<ExternalID> destinationType) {
JSONWorkExternalIdentifier workExternalIdentifier = JsonUtils.readObjectFromJsonString(source, JSONWorkExternalIdentifier.class);
ExternalID id = new ExternalID();
if (workExternalIdentifier.getWorkExternalIdentifierType() == null) {
id.setType(WorkExternalIdentifierType.OTHER_ID.value());
} else {
id.setType(conv.convertFrom(workExternalIdentifier.getWorkExternalIdentifierType(), null));
}
if (workExternalIdentifier.getWorkExternalIdentifierId() != null) {
id.setValue(workExternalIdentifier.getWorkExternalIdentifierId().content);
}
if (workExternalIdentifier.getUrl() != null) {
id.setUrl(new Url(workExternalIdentifier.getUrl().getValue()));
}
if (workExternalIdentifier.getRelationship() != null) {
id.setRelationship(Relationship.fromValue(conv.convertFrom(workExternalIdentifier.getRelationship(), null)));
}
return id;
}
Aggregations