Beispiel #1
0
  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);
    }
  }
Beispiel #2
0
 protected void reconcileBudgetStatus(BudgetForm budgetForm) {
   BudgetDocument budgetDocument = budgetForm.getDocument();
   Budget budget = budgetDocument.getBudget();
   BudgetParent budgetParent = budgetDocument.getParentDocument().getBudgetParent();
   if (budgetParent instanceof DevelopmentProposal) {
     DevelopmentProposal proposal = (DevelopmentProposal) budgetParent;
     KraServiceLocator.getService(ProposalStatusService.class).loadBudgetStatus(proposal);
   }
   if (budget.getFinalVersionFlag() != null && Boolean.TRUE.equals(budget.getFinalVersionFlag())) {
     budget.setBudgetStatus(budgetParent.getBudgetStatus());
   } else {
     String budgetStatusIncompleteCode =
         this.getParameterService()
             .getParameterValue(BudgetDocument.class, Constants.BUDGET_STATUS_INCOMPLETE_CODE);
     budget.setBudgetStatus(budgetStatusIncompleteCode);
   }
 }
Beispiel #3
0
  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());
        }
      }
    }
  }
Beispiel #4
0
  protected boolean processRunAuditBudgetVersionRule(BudgetParentDocument parentDocument) {
    // audit check for budgetversion with final status
    boolean finalAndCompleteBudgetVersionFound = false;
    boolean budgetVersionsExists = false;
    boolean retval = true;

    List<AuditError> auditErrors = new ArrayList<AuditError>();
    String budgetStatusCompleteCode =
        getParameterService()
            .getParameterValueAsString(BudgetDocument.class, Constants.BUDGET_STATUS_COMPLETE_CODE);
    for (BudgetDocumentVersion budgetDocumentVersion : parentDocument.getBudgetDocumentVersions()) {
      BudgetVersionOverview budgetVersion = budgetDocumentVersion.getBudgetVersionOverview();
      budgetVersionsExists = true;
      if (budgetVersion.isFinalVersionFlag()) {
        BudgetParent budgetParent = parentDocument.getBudgetParent();
        if (budgetParent.getBudgetStatus() != null
            && budgetParent.getBudgetStatus().equals(budgetStatusCompleteCode)) {
          finalAndCompleteBudgetVersionFound = true;
        }
      }
    }
    if (budgetVersionsExists && !finalAndCompleteBudgetVersionFound) {
      auditErrors.add(
          new AuditError(
              "document.parentBudget.budgetVersionOverview",
              KeyConstants.AUDIT_ERROR_NO_BUDGETVERSION_COMPLETE_AND_FINAL,
              Constants.PD_BUDGET_VERSIONS_PAGE + "." + Constants.BUDGET_VERSIONS_PANEL_ANCHOR));
      retval = false;
    }
    if (auditErrors.size() > 0) {
      KNSGlobalVariables.getAuditErrorMap()
          .put(
              "budgetVersionErrors",
              new AuditCluster(
                  Constants.BUDGET_VERSION_PANEL_NAME, auditErrors, Constants.AUDIT_ERRORS));
    }

    return retval;
  }