use of org.orcid.api.common.writer.citeproc.WorkToCiteprocTranslator in project ORCID-Source by ORCID.
the class PublicV2ApiServiceDelegatorImpl method viewWorkCitation.
@Override
public Response viewWorkCitation(String orcid, Long putCode) {
Work w = (Work) this.viewWork(orcid, putCode).getEntity();
ProfileEntity entity = profileEntityManagerReadOnly.findByOrcid(orcid);
String creditName = null;
RecordNameEntity recordNameEntity = entity.getRecordNameEntity();
if (recordNameEntity != null) {
if (!recordNameEntity.getVisibility().isMoreRestrictiveThan(Visibility.PUBLIC)) {
creditName = recordNameEntity.getCreditName();
if (StringUtils.isBlank(creditName)) {
creditName = recordNameEntity.getGivenNames();
String familyName = recordNameEntity.getFamilyName();
if (StringUtils.isNotBlank(familyName)) {
creditName += " " + familyName;
}
}
}
}
WorkToCiteprocTranslator tran = new WorkToCiteprocTranslator();
CSLItemData item = tran.toCiteproc(w, creditName, true);
return Response.ok(item).build();
}
Aggregations