use of org.orcid.core.adapter.jsonidentifier.JSONFundingExternalIdentifiers in project ORCID-Source by ORCID.
the class JSONFundingExternalIdentifiersConverterV3 method convertTo.
@Override
public String convertTo(ExternalIDs source, Type<String> destinationType) {
JSONFundingExternalIdentifiers jsonFundingExternalIdentifiers = new JSONFundingExternalIdentifiers();
for (ExternalID externalID : source.getExternalIdentifier()) {
JSONExternalIdentifier jsonExternalIdentifier = new JSONExternalIdentifier();
if (externalID.getType() != null) {
jsonExternalIdentifier.setType(conv.convertTo(externalID.getType(), null));
}
if (externalID.getUrl() != null) {
jsonExternalIdentifier.setUrl(new JSONUrl(externalID.getUrl().getValue()));
}
if (!PojoUtil.isEmpty(externalID.getValue())) {
jsonExternalIdentifier.setValue(externalID.getValue());
}
if (externalID.getRelationship() != null) {
jsonExternalIdentifier.setRelationship(conv.convertTo(externalID.getRelationship().value(), null));
}
jsonFundingExternalIdentifiers.getFundingExternalIdentifier().add(jsonExternalIdentifier);
}
return JsonUtils.convertToJsonString(jsonFundingExternalIdentifiers);
}
Aggregations