use of org.orcid.pojo.DelegateForm in project ORCID-Source by ORCID.
the class NotificationManagerImpl method extractAmenderName.
private String extractAmenderName(String userOrcid, String amenderId) {
DelegateForm delegateForm = givenPermissionToManagerReadOnly.findByGiverAndReceiverOrcid(userOrcid, amenderId);
if (delegateForm != null && !PojoUtil.isEmpty(delegateForm.getReceiverName())) {
return delegateForm.getReceiverName().getValue();
}
ClientDetailsEntity clientDetailsEntity = clientDetailsEntityCacheManager.retrieve(amenderId);
if (clientDetailsEntity != null) {
return clientDetailsEntity.getClientName();
}
return "";
}
use of org.orcid.pojo.DelegateForm in project ORCID-Source by ORCID.
the class GivenPermissionToManagerReadOnlyImpl method findByGiverAndReceiverOrcid.
@Override
public DelegateForm findByGiverAndReceiverOrcid(String giverOrcid, String receiverOrcid) {
GivenPermissionToEntity entity = givenPermissionToDaoReadOnly.findByGiverAndReceiverOrcid(giverOrcid, receiverOrcid);
if (entity != null) {
DelegateForm form = new DelegateForm();
form.setApprovalDate(DateUtils.convertToXMLGregorianCalendar(entity.getApprovalDate()));
form.setGiverOrcid(orcidIdentifierUtils.buildOrcidIdentifier(entity.getGiver()));
form.setReceiverOrcid(orcidIdentifierUtils.buildOrcidIdentifier(entity.getReceiver().getId()));
form.setReceiverName(Text.valueOf(entity.getReceiver().getDisplayName()));
return form;
}
return null;
}
use of org.orcid.pojo.DelegateForm in project ORCID-Source by ORCID.
the class ManageProfileController method getDelegates.
@RequestMapping(value = "/delegates.json", method = RequestMethod.GET)
@ResponseBody
public List<DelegateForm> getDelegates() {
String currentOrcid = getCurrentUserOrcid();
ProfileEntity currentProfile = profileEntityCacheManager.retrieve(currentOrcid);
List<DelegateForm> list = new ArrayList<DelegateForm>();
if (currentProfile.getGivenPermissionTo() != null && !currentProfile.getGivenPermissionTo().isEmpty()) {
for (GivenPermissionToEntity entity : currentProfile.getGivenPermissionTo()) {
DelegateForm form = new DelegateForm();
form.setGiverOrcid(Text.valueOf(currentOrcid));
form.setReceiverOrcid(Text.valueOf(entity.getReceiver().getId()));
form.setReceiverName(Text.valueOf(entity.getReceiver().getDisplayName()));
form.setApprovalDate(DateUtils.convertToXMLGregorianCalendar(entity.getApprovalDate()));
list.add(form);
}
}
return list;
}
use of org.orcid.pojo.DelegateForm in project ORCID-Source by ORCID.
the class NotificationManagerImpl method extractAmenderName.
private String extractAmenderName(String userOrcid, String amenderId) {
DelegateForm delegateForm = givenPermissionToManagerReadOnly.findByGiverAndReceiverOrcid(userOrcid, amenderId);
if (delegateForm != null && !PojoUtil.isEmpty(delegateForm.getReceiverName())) {
return delegateForm.getReceiverName().getValue();
}
ClientDetailsEntity clientDetailsEntity = clientDetailsEntityCacheManager.retrieve(amenderId);
if (clientDetailsEntity != null) {
return clientDetailsEntity.getClientName();
}
return "";
}
use of org.orcid.pojo.DelegateForm in project ORCID-Source by ORCID.
the class GivenPermissionToManagerReadOnlyImpl method findByReceiver.
@Override
@Cacheable(value = "delegates-by-receiver", key = "#receiverOrcid.concat('-').concat(#lastModified)")
public List<DelegateForm> findByReceiver(String receiverOrcid, long lastModified) {
List<DelegateForm> delegates = new ArrayList<DelegateForm>();
List<GivenPermissionByEntity> list = givenPermissionToDaoReadOnly.findByReceiver(receiverOrcid);
for (GivenPermissionByEntity element : list) {
DelegateForm form = new DelegateForm();
form.setApprovalDate(DateUtils.convertToXMLGregorianCalendar(element.getApprovalDate()));
form.setLastModifiedDate(DateUtils.convertToXMLGregorianCalendar(element.getGiver().getLastModified()));
form.setGiverName(Text.valueOf(element.getGiver().getDisplayName()));
form.setGiverOrcid(orcidIdentifierUtils.buildOrcidIdentifier(element.getGiver().getId()));
form.setReceiverOrcid(orcidIdentifierUtils.buildOrcidIdentifier(element.getReceiver()));
delegates.add(form);
}
return delegates;
}
Aggregations