Search in sources :

Example 6 with JSONUrl

use of org.orcid.core.adapter.jsonidentifier.JSONUrl in project ORCID-Source by ORCID.

the class JSONWorkExternalIdentifiersConverterV2 method convertTo.

@Override
public String convertTo(ExternalIDs source, Type<String> destinationType) {
    JSONWorkExternalIdentifiers jsonWorkExternalIdentifiers = new JSONWorkExternalIdentifiers();
    for (ExternalID externalID : source.getExternalIdentifier()) {
        JSONWorkExternalIdentifier jsonWorkExternalIdentifier = new JSONWorkExternalIdentifier();
        if (externalID.getType() != null) {
            jsonWorkExternalIdentifier.setWorkExternalIdentifierType(conv.convertTo(externalID.getType(), null));
        }
        if (externalID.getUrl() != null) {
            jsonWorkExternalIdentifier.setUrl(new JSONUrl(externalID.getUrl().getValue()));
        }
        if (!PojoUtil.isEmpty(externalID.getValue())) {
            jsonWorkExternalIdentifier.setWorkExternalIdentifierId(new WorkExternalIdentifierId(externalID.getValue()));
        }
        if (externalID.getRelationship() != null) {
            jsonWorkExternalIdentifier.setRelationship(conv.convertTo(externalID.getRelationship().value(), null));
        }
        jsonWorkExternalIdentifiers.getWorkExternalIdentifier().add(jsonWorkExternalIdentifier);
    }
    return JsonUtils.convertToJsonString(jsonWorkExternalIdentifiers);
}
Also used : JSONWorkExternalIdentifiers(org.orcid.core.adapter.jsonidentifier.JSONWorkExternalIdentifiers) ExternalID(org.orcid.jaxb.model.record_v2.ExternalID) WorkExternalIdentifierId(org.orcid.core.adapter.jsonidentifier.JSONWorkExternalIdentifier.WorkExternalIdentifierId) JSONUrl(org.orcid.core.adapter.jsonidentifier.JSONUrl) JSONWorkExternalIdentifier(org.orcid.core.adapter.jsonidentifier.JSONWorkExternalIdentifier)

Aggregations

JSONUrl (org.orcid.core.adapter.jsonidentifier.JSONUrl)6 JSONExternalIdentifier (org.orcid.core.adapter.jsonidentifier.JSONExternalIdentifier)4 JSONFundingExternalIdentifiers (org.orcid.core.adapter.jsonidentifier.JSONFundingExternalIdentifiers)3 ExternalID (org.orcid.jaxb.model.v3.dev1.record.ExternalID)3 JSONWorkExternalIdentifier (org.orcid.core.adapter.jsonidentifier.JSONWorkExternalIdentifier)2 WorkExternalIdentifierId (org.orcid.core.adapter.jsonidentifier.JSONWorkExternalIdentifier.WorkExternalIdentifierId)2 JSONWorkExternalIdentifiers (org.orcid.core.adapter.jsonidentifier.JSONWorkExternalIdentifiers)2 ExternalID (org.orcid.jaxb.model.record_v2.ExternalID)2 JSONExternalIdentifiers (org.orcid.core.adapter.jsonidentifier.JSONExternalIdentifiers)1 FundingExternalIdentifier (org.orcid.jaxb.model.message.FundingExternalIdentifier)1