@Override
  public void populateProposalPerson(ProposalPerson person, ProposalDevelopmentDocument document) {
    /* populate certification questions for new person */
    person = getYnqService().getPersonYNQ(person, document);

    if (person.isInvestigator()) {
      if (!document.getDevelopmentProposal().getInvestigators().contains(person)) {
        document.getDevelopmentProposal().getInvestigators().add(person);
      }
      populateCreditTypes(person);
    }

    person.setRoleChanged(false);

    try {
      if (person.getPersonId() != null && person.getPerson().getExtendedAttributes() != null) {
        KcPerson origPerson = person.getPerson();
        for (PersonDegree degree : origPerson.getExtendedAttributes().getPersonDegrees()) {
          ProposalPersonDegree newDegree = new ProposalPersonDegree();
          newDegree.setDegree(degree.getDegree());
          newDegree.setDegreeCode(degree.getDegreeCode());
          newDegree.setFieldOfStudy(degree.getFieldOfStudy());
          newDegree.setGraduationYear(degree.getGraduationYear());
          newDegree.setSchool(degree.getSchool());
          newDegree.setSchoolId(degree.getSchoolId());
          newDegree.setSchoolIdCode(degree.getSchoolIdCode());
          newDegree.setDegreeSequenceNumber(
              document.getDocumentNextValue(Constants.PROPOSAL_PERSON_DEGREE_SEQUENCE_NUMBER));
          person.addDegree(newDegree);
        }
        if (origPerson.getExtendedAttributes().getAttachments() != null) {
          for (PersonBiosketch attachment : origPerson.getExtendedAttributes().getAttachments()) {
            ProposalPersonBiography bio = new ProposalPersonBiography();
            bio.setProposalPersonNumber(person.getProposalPersonNumber());
            bio.setDocumentTypeCode(getDefaultPersonAttachmentDocType());
            bio.setDescription(attachment.getDescription());
            bio.setName(attachment.getFileName());
            bio.setType(attachment.getContentType());

            ProposalPersonBiographyAttachment personnelAttachment =
                new ProposalPersonBiographyAttachment();
            personnelAttachment.setName(attachment.getFileName());
            personnelAttachment.setProposalNumber(
                document.getDevelopmentProposal().getProposalNumber());
            personnelAttachment.setProposalPersonNumber(person.getProposalPersonNumber());
            personnelAttachment.setData(attachment.getAttachmentContent());
            personnelAttachment.setType(attachment.getContentType());
            bio.setPersonnelAttachment(personnelAttachment);

            document.getDevelopmentProposal().addProposalPersonBiography(bio);
          }
        }
      }
    } catch (IllegalArgumentException e) {
      // catching the possibility that person.getPerson can not
      // find a EntityContract for this person id.
    }
  }
示例#2
0
 public void setPreparer(KcPerson preparer) {
   this.preparer = preparer;
   if (preparer != null) {
     preparerId = preparer.getPersonId();
     preparerName = preparer.getFullName();
   } else {
     preparerId = null;
     preparerName = null;
   }
 }
 @Test
 public void testAddBudgetPersonWithAppointments() throws Exception {
   assertTrue(budget.getBudgetPersons().isEmpty());
   BudgetPerson testPerson = new BudgetPerson();
   KcPerson person = kcPersonService.getKcPersonByPersonId(testAppointmentPersonId);
   testPerson.setPersonId(testAppointmentPersonId);
   budgetPersonService.addBudgetPerson(budget, testPerson);
   assertFalse(person.getExtendedAttributes().getPersonAppointments().isEmpty());
   assertTrue(
       person.getExtendedAttributes().getPersonAppointments().size()
           == budget.getBudgetPersons().size());
 }
  @Override
  protected List<KcPerson> getPersonsInRole(String roleName) {
    KcAuthorizationService kraAuthorizationService =
        KcServiceLocator.getService(KcAuthorizationService.class);
    KcPersonService kcPersonService = KcServiceLocator.getService(KcPersonService.class);
    List<String> users = kraAuthorizationService.getPrincipalsInRole(roleName, getProtocol());

    final List<KcPerson> persons = new ArrayList<KcPerson>();
    for (String userId : users) {
      KcPerson person = kcPersonService.getKcPersonByPersonId(userId);
      if (person != null && person.getActive()) {
        persons.add(person);
      }
    }

    return persons;
  }
示例#5
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;
 }
  /*
   * We want to allow users to query on principal name instead of person id,
   * so we need to translate before performing the lookup.
   */
  @SuppressWarnings("unchecked")
  @Override
  public Collection performLookup(LookupForm lookupForm, Collection resultTable, boolean bounded) {
    String userName = (String) lookupForm.getFieldsForLookup().get(USERNAME_FIELD);
    lookupForm.getFieldsForLookup().remove(FOR_INSTITUTIONAL_PROPOSAL);

    if (!StringUtils.isBlank(userName)) {
      KcPerson person = getKcPersonService().getKcPersonByUserName(userName);
      if (person != null) {
        lookupForm.getFieldsForLookup().put(PI_ID, person.getPersonId());
      }
      lookupForm.getFieldsForLookup().remove(USERNAME_FIELD);
    }
    List<ProposalLog> results =
        (List<ProposalLog>) super.performLookup(lookupForm, resultTable, bounded);
    if (StringUtils.containsIgnoreCase(lookupForm.getBackLocation(), NEGOTIATION_NEGOTIATION)) {
      return cleanSearchResultsForNegotiationLookup(results);
    } else {
      return results;
    }
  }
 public String getLastModifiedUserFullName() {
   KcPerson user = getLastModifiedUser();
   return user == null ? "" : user.getFullName();
 }
 private boolean hasPermission(String nameSpace, String permissionName) {
   KcPerson person = getKcPersonService().getKcPersonByUserName(getUserName());
   return getUnitAuthorizationService()
       .hasPermission(person.getPersonId(), nameSpace, permissionName);
 }