protected void populatePersonnelRoles(BudgetDocument budgetDocument) { BudgetParent budgetParent = budgetDocument.getParentDocument().getBudgetParent(); List<BudgetPerson> budgetPersons = budgetDocument.getBudget().getBudgetPersons(); for (BudgetPerson budgetPerson : budgetPersons) { String roleDesc = ""; if (budgetPerson.getRolodexId() != null) { PersonRolodex person = budgetParent.getProposalNonEmployee(budgetPerson.getRolodexId()); ContactRole role = budgetParent.getProposalNonEmployeeRole(budgetPerson.getRolodexId()); if (role != null) { roleDesc = person.getInvestigatorRoleDescription(); if (person != null && StringUtils.equals(Constants.KEY_PERSON_ROLE, role.getRoleCode()) && StringUtils.isNotEmpty(person.getProjectRole())) { roleDesc = person.getProjectRole(); } } } else if (budgetPerson.getPersonId() != null) { PersonRolodex person = budgetParent.getProposalEmployee(budgetPerson.getPersonId()); ContactRole role = budgetParent.getProposalEmployeeRole(budgetPerson.getPersonId()); if (role != null) { roleDesc = person.getInvestigatorRoleDescription(); if (person != null && StringUtils.equals(Constants.KEY_PERSON_ROLE, role.getRoleCode()) && StringUtils.isNotEmpty(person.getProjectRole())) { roleDesc = person.getProjectRole(); } } } budgetPerson.setRole(roleDesc); } }
public void reconcilePersonnelRoles(BudgetDocument budgetDocument) { // Populate the person's proposal roles, if they exist Budget budget = budgetDocument.getBudget(); BudgetParent budgetParent = budgetDocument.getParentDocument().getBudgetParent(); List<BudgetPerson> budgetPersons = budget.getBudgetPersons(); for (BudgetPerson budgetPerson : budgetPersons) { if (budgetPerson.getRolodexId() != null) { PersonRolodex person = budgetParent.getProposalNonEmployee(budgetPerson.getRolodexId()); if (person != null) { budgetPerson.setRole(person.getInvestigatorRoleDescription()); } } else if (budgetPerson.getPersonId() != null) { PersonRolodex person = budgetParent.getProposalEmployee(budgetPerson.getPersonId()); if (person != null) { budgetPerson.setRole(person.getInvestigatorRoleDescription()); } } } }