Esempio n. 1
0
 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;
 }
  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 "";
  }