use of org.orcid.jaxb.model.message.Delegation in project ORCID-Source by ORCID.
the class AddDelegateForm method getOrcidProfile.
public OrcidProfile getOrcidProfile(String orcid) {
OrcidProfile orcidProfile = new OrcidProfile();
orcidProfile.setOrcidIdentifier(orcid);
OrcidBio orcidBio = new OrcidBio();
orcidProfile.setOrcidBio(orcidBio);
Delegation delegation = new Delegation();
orcidBio.setDelegation(delegation);
GivenPermissionTo givenPermissionTo = new GivenPermissionTo();
delegation.setGivenPermissionTo(givenPermissionTo);
DelegationDetails delegationDetails = new DelegationDetails();
givenPermissionTo.getDelegationDetails().add(delegationDetails);
DelegateSummary delegateSummary = new DelegateSummary(new OrcidIdentifier(delegateOrcid));
delegationDetails.setDelegateSummary(delegateSummary);
return orcidProfile;
}
use of org.orcid.jaxb.model.message.Delegation in project ORCID-Source by ORCID.
the class OrcidProfileManagerImplTest method testRevokeDelegate.
@Test
@Transactional
@Rollback(true)
public void testRevokeDelegate() {
OrcidProfile profile1 = createBasicProfile();
Delegation delegation = new Delegation();
profile1.getOrcidBio().setDelegation(delegation);
GivenPermissionTo givenPermissionTo = new GivenPermissionTo();
delegation.setGivenPermissionTo(givenPermissionTo);
DelegationDetails delegationDetails = new DelegationDetails();
delegationDetails.setApprovalDate(new ApprovalDate(DateUtils.convertToXMLGregorianCalendar("2011-03-14T02:34:16")));
DelegateSummary profileSummary = new DelegateSummary(new OrcidIdentifier(DELEGATE_ORCID));
delegationDetails.setDelegateSummary(profileSummary);
givenPermissionTo.getDelegationDetails().add(delegationDetails);
orcidProfileManager.createOrcidProfile(profile1, false, false);
orcidProfileManager.revokeDelegate(TEST_ORCID, DELEGATE_ORCID);
OrcidProfile retrievedProfile = orcidProfileManager.retrieveOrcidProfile(TEST_ORCID);
assertNull(retrievedProfile.getOrcidBio().getDelegation());
}
use of org.orcid.jaxb.model.message.Delegation in project ORCID-Source by ORCID.
the class ManageDelegatorsController method getDelegatesJson.
@RequestMapping(value = "/delegation.json", method = RequestMethod.GET)
@ResponseBody
public Delegation getDelegatesJson() throws NoSuchRequestHandlingMethodException {
OrcidProfile realProfile = getRealProfile();
Delegation delegation = realProfile.getOrcidBio().getDelegation();
return delegation;
}
use of org.orcid.jaxb.model.message.Delegation in project ORCID-Source by ORCID.
the class NotificationManagerImpl method extractAmenderName.
private String extractAmenderName(OrcidProfile orcidProfile, String amenderId) {
Delegation delegation = orcidProfile.getOrcidBio().getDelegation();
if (delegation != null && delegation.getGivenPermissionTo() != null && !delegation.getGivenPermissionTo().getDelegationDetails().isEmpty()) {
for (DelegationDetails delegationDetails : delegation.getGivenPermissionTo().getDelegationDetails()) {
if (amenderId.equals(delegationDetails.getDelegateSummary().getOrcidIdentifier().getPath())) {
return delegationDetails.getDelegateSummary().getCreditName().getContent();
}
}
}
ClientDetailsEntity clientDetailsEntity = clientDetailsEntityCacheManager.retrieve(amenderId);
if (clientDetailsEntity != null) {
return clientDetailsEntity.getClientName();
}
return "";
}
Aggregations