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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations