use of org.orcid.core.adapter.jsonidentifier.JSONWorkExternalIdentifier.WorkExternalIdentifierId in project ORCID-Source by ORCID.
the class JSONWorkExternalIdentifiersConverterV1 method convertTo.
public String convertTo(WorkExternalIdentifiers messagePojo, WorkType workType) {
JSONWorkExternalIdentifiers workExternalIdentifiers = new JSONWorkExternalIdentifiers();
for (WorkExternalIdentifier workExternalIdentifier : messagePojo.getWorkExternalIdentifier()) {
JSONWorkExternalIdentifier jsonWorkExternalIdentifier = new JSONWorkExternalIdentifier();
if (workExternalIdentifier.getWorkExternalIdentifierType() != null) {
jsonWorkExternalIdentifier.setWorkExternalIdentifierType(workExternalIdentifier.getWorkExternalIdentifierType().value());
}
if (workExternalIdentifier.getWorkExternalIdentifierId() != null && !PojoUtil.isEmpty(workExternalIdentifier.getWorkExternalIdentifierId().getContent())) {
jsonWorkExternalIdentifier.setWorkExternalIdentifierId(new WorkExternalIdentifierId(workExternalIdentifier.getWorkExternalIdentifierId().getContent()));
}
WorkExternalIdentifierType type = WorkExternalIdentifierType.valueOf(conv.convertTo(jsonWorkExternalIdentifier.getWorkExternalIdentifierType(), null));
if (org.orcid.jaxb.model.message.WorkExternalIdentifierType.ISSN.equals(type)) {
if (!workType.equals(org.orcid.jaxb.model.message.WorkType.BOOK)) {
jsonWorkExternalIdentifier.setRelationship(org.orcid.jaxb.model.record_rc1.Relationship.PART_OF.value());
} else {
jsonWorkExternalIdentifier.setRelationship(org.orcid.jaxb.model.record_rc1.Relationship.SELF.value());
}
} else if (org.orcid.jaxb.model.message.WorkExternalIdentifierType.ISBN.equals(type)) {
if (workType.equals(org.orcid.jaxb.model.message.WorkType.BOOK_CHAPTER) || workType.equals(org.orcid.jaxb.model.message.WorkType.CONFERENCE_PAPER)) {
jsonWorkExternalIdentifier.setRelationship(org.orcid.jaxb.model.record_rc1.Relationship.PART_OF.value());
} else {
jsonWorkExternalIdentifier.setRelationship(org.orcid.jaxb.model.record_rc1.Relationship.SELF.value());
}
} else {
jsonWorkExternalIdentifier.setRelationship(org.orcid.jaxb.model.record_rc1.Relationship.SELF.value());
}
workExternalIdentifiers.getWorkExternalIdentifier().add(jsonWorkExternalIdentifier);
}
return JsonUtils.convertToJsonString(workExternalIdentifiers);
}
use of org.orcid.core.adapter.jsonidentifier.JSONWorkExternalIdentifier.WorkExternalIdentifierId 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.JSONWorkExternalIdentifier.WorkExternalIdentifierId 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);
}
Aggregations