@KcEventMethod
  public boolean processBudgetPersonnelBusinessRules(BudgetSaveEvent event) {
    boolean valid = true;

    List<BudgetPerson> budgetPersons = event.getBudget().getBudgetPersons();

    // not an error - ProposalHierarchy parents are allowed to have duplicate BudgetPersons
    BudgetParent budgetParent = event.getBudget().getBudgetParent().getDocument().getBudgetParent();
    if (budgetParent instanceof DevelopmentProposal
        && ((DevelopmentProposal) budgetParent).isParent()) {
      KcEventResult result = isNotDuplicateBudgetPersons(budgetPersons);
      GlobalVariables.getMessageMap().merge(result.getMessageMap());
    }
    return valid;
  }
 @KcEventMethod
 public boolean processBudgetFormulatedCostValidations(BudgetSaveEvent event) {
   boolean result = true;
   int budgetPeriodIdx = 0;
   for (BudgetPeriod budgetPeriod : event.getBudget().getBudgetPeriods()) {
     int lineItemIdx = 0;
     for (BudgetLineItem budgetLineItem : budgetPeriod.getBudgetLineItems()) {
       String errorPath =
           "document.budget.budgetPeriod["
               + budgetPeriodIdx
               + "].budgetLineItem["
               + lineItemIdx
               + "].";
       int formulatedCostIdx = 0;
       for (BudgetFormulatedCostDetail budgetFormulatedCost :
           budgetLineItem.getBudgetFormulatedCosts()) {
         result &=
             processBudgetFormulatedCostValidations(
                 budgetFormulatedCost,
                 errorPath + "budgetFormulatedCosts[" + formulatedCostIdx++ + "]");
       }
       lineItemIdx++;
     }
     budgetPeriodIdx++;
   }
   return result;
 }
  @KcEventMethod
  public boolean processCheckBaseSalaryFormat(BudgetSaveEvent event) {
    boolean valid = true;

    MessageMap messageMap = GlobalVariables.getMessageMap();
    int i = 0;
    List<BudgetPerson> budgetPersons = event.getBudget().getBudgetPersons();
    for (BudgetPerson budgetPerson : budgetPersons) {
      if (budgetPerson.getCalculationBase() == null) {
        messageMap.putError(
            BUDGET_PERSONS_FIELD_NAME_START + i + BUDGET_PERSONS_FIELD_NAME_CALC_BASE,
            RiceKeyConstants.ERROR_REQUIRED,
            new String[] {"Base Salary"});
        valid = false;
      } else if (budgetPerson.getCalculationBase().isNegative()) {
        messageMap.putError(
            BUDGET_PERSONS_FIELD_NAME_START + i + BUDGET_PERSONS_FIELD_NAME_CALC_BASE,
            KeyConstants.ERROR_NEGATIVE_AMOUNT,
            new String[] {"Base Salary"});
        valid = false;
      }
      i++;
    }

    return valid;
  }