Exemplo n.º 1
0
 /**
  * This method is used to get details of Principal Investigator for Organization Contact
  *
  * @return OrganizationContactPersonDataType Principal investigator details.
  */
 private OrganizationContactPersonDataType getPDPI() {
   OrganizationContactPersonDataType PDPI =
       OrganizationContactPersonDataType.Factory.newInstance();
   ProposalPerson PI = null;
   for (ProposalPerson proposalPerson : pdDoc.getDevelopmentProposal().getProposalPersons()) {
     if (PRINCIPAL_INVESTIGATOR.equals(proposalPerson.getProposalPersonRoleId())) {
       PI = proposalPerson;
       ProposalSite applicantOrganization =
           pdDoc.getDevelopmentProposal().getApplicantOrganization();
       PDPI.setName(globLibV20Generator.getHumanNameDataType(PI));
       PDPI.setPhone(PI.getOfficePhone());
       PDPI.setEmail(PI.getEmailAddress());
       if (PI.getFaxNumber() != null) {
         PDPI.setFax(PI.getFaxNumber());
       }
       PDPI.setAddress(globLibV20Generator.getAddressDataType(PI));
       if (PI.getDirectoryTitle() != null) {
         if (PI.getDirectoryTitle().length() > DIRECTORY_TITLE_MAX_LENGTH) {
           PDPI.setTitle(PI.getDirectoryTitle().substring(0, DIRECTORY_TITLE_MAX_LENGTH));
         } else {
           PDPI.setTitle(PI.getDirectoryTitle());
         }
       }
       if (PI.getHomeUnit() != null) {
         KcPerson kcPerson = PI.getPerson();
         String departmentName = kcPerson.getOrganizationIdentifier();
         PDPI.setDepartmentName(departmentName);
       } else {
         DevelopmentProposal developmentProposal = pdDoc.getDevelopmentProposal();
         PDPI.setDepartmentName(developmentProposal.getOwnedByUnit().getUnitName());
       }
       // divisionName
       String divisionName = proposalPerson.getDivision();
       if (divisionName != null) {
         PDPI.setDivisionName(divisionName);
       }
       if (applicantOrganization != null) {
         PDPI.setOrganizationName(applicantOrganization.getLocationName());
       }
     }
   }
   return PDPI;
 }