Search in sources :

Example 1 with JSONUrl

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

the class JSONExternalIdentifiersConverterV3 method convertTo.

@Override
public String convertTo(ExternalIDs source, Type<String> destinationType) {
    JSONExternalIdentifiers jsonExternalIdentifiers = new JSONExternalIdentifiers();
    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));
        }
        jsonExternalIdentifiers.getExternalIdentifier().add(jsonExternalIdentifier);
    }
    return JsonUtils.convertToJsonString(jsonExternalIdentifiers);
}
Also used : JSONExternalIdentifier(org.orcid.core.adapter.jsonidentifier.JSONExternalIdentifier) ExternalID(org.orcid.jaxb.model.v3.dev1.record.ExternalID) JSONUrl(org.orcid.core.adapter.jsonidentifier.JSONUrl) JSONExternalIdentifiers(org.orcid.core.adapter.jsonidentifier.JSONExternalIdentifiers)

Example 2 with JSONUrl

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

the class JSONFundingExternalIdentifiersConverterV2 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);
}
Also used : JSONExternalIdentifier(org.orcid.core.adapter.jsonidentifier.JSONExternalIdentifier) ExternalID(org.orcid.jaxb.model.record_v2.ExternalID) JSONFundingExternalIdentifiers(org.orcid.core.adapter.jsonidentifier.JSONFundingExternalIdentifiers) JSONUrl(org.orcid.core.adapter.jsonidentifier.JSONUrl)

Example 3 with JSONUrl

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

the class JSONWorkExternalIdentifiersConverterV3 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.v3.dev1.record.ExternalID) WorkExternalIdentifierId(org.orcid.core.adapter.jsonidentifier.JSONWorkExternalIdentifier.WorkExternalIdentifierId) JSONUrl(org.orcid.core.adapter.jsonidentifier.JSONUrl) JSONWorkExternalIdentifier(org.orcid.core.adapter.jsonidentifier.JSONWorkExternalIdentifier)

Example 4 with JSONUrl

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

the class JSONFundingExternalIdentifiersConverterV1 method convertTo.

public String convertTo(FundingExternalIdentifiers messagePojo) {
    JSONFundingExternalIdentifiers fundingExternalIdentifiers = new JSONFundingExternalIdentifiers();
    if (messagePojo != null) {
        for (FundingExternalIdentifier fundingExternalIdentifier : messagePojo.getFundingExternalIdentifier()) {
            JSONExternalIdentifier jsonExternalIdentifier = new JSONExternalIdentifier();
            if (fundingExternalIdentifier.getType() != null) {
                jsonExternalIdentifier.setType(fundingExternalIdentifier.getType().value());
            }
            if (fundingExternalIdentifier.getUrl() != null) {
                jsonExternalIdentifier.setUrl(new JSONUrl(fundingExternalIdentifier.getUrl().getValue()));
            }
            if (!PojoUtil.isEmpty(fundingExternalIdentifier.getValue())) {
                jsonExternalIdentifier.setValue(fundingExternalIdentifier.getValue());
            }
            jsonExternalIdentifier.setRelationship(Relationship.SELF.value());
            fundingExternalIdentifiers.getFundingExternalIdentifier().add(jsonExternalIdentifier);
        }
    }
    return JsonUtils.convertToJsonString(fundingExternalIdentifiers);
}
Also used : JSONExternalIdentifier(org.orcid.core.adapter.jsonidentifier.JSONExternalIdentifier) JSONFundingExternalIdentifiers(org.orcid.core.adapter.jsonidentifier.JSONFundingExternalIdentifiers) JSONUrl(org.orcid.core.adapter.jsonidentifier.JSONUrl) FundingExternalIdentifier(org.orcid.jaxb.model.message.FundingExternalIdentifier)

Example 5 with JSONUrl

use of org.orcid.core.adapter.jsonidentifier.JSONUrl 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);
}
Also used : JSONExternalIdentifier(org.orcid.core.adapter.jsonidentifier.JSONExternalIdentifier) ExternalID(org.orcid.jaxb.model.v3.dev1.record.ExternalID) JSONFundingExternalIdentifiers(org.orcid.core.adapter.jsonidentifier.JSONFundingExternalIdentifiers) JSONUrl(org.orcid.core.adapter.jsonidentifier.JSONUrl)

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