@SuppressWarnings("unchecked")
  private List<ValidCeJobCode> getApplicableCostElements(
      Budget budget, BudgetPersonnelDetails newBudgetPersonnelDetails, boolean save) {
    List<ValidCeJobCode> validCostElements = null;

    if (save) {
      String jobCodeValidationEnabledInd =
          this.paramService.getParameterValueAsString(
              Budget.class, Constants.BUDGET_JOBCODE_VALIDATION_ENABLED);

      Map<String, Object> fieldValues = new HashMap<String, Object>();
      BudgetPerson budgetPerson = null;

      if (StringUtils.isNotEmpty(jobCodeValidationEnabledInd)
          && jobCodeValidationEnabledInd.equals("Y")) {

        List<BudgetPerson> budgetPersons = budget.getBudgetPersons();
        for (BudgetPerson tmpBudgetPerson : budgetPersons) {
          if (tmpBudgetPerson.getPersonSequenceNumber().intValue()
              == newBudgetPersonnelDetails.getPersonSequenceNumber().intValue()) {
            budgetPerson = tmpBudgetPerson;
            break;
          }
        }
        if (budgetPerson != null && StringUtils.isNotEmpty(budgetPerson.getJobCode())) {
          fieldValues.put("jobCode", budgetPerson.getJobCode().toUpperCase());
          validCostElements =
              (List<ValidCeJobCode>) this.boService.findMatching(ValidCeJobCode.class, fieldValues);
        }
      }

    } else {
      validCostElements =
          budgetPersonService.getApplicableCostElements(
              budget, newBudgetPersonnelDetails.getPersonSequenceNumber().toString());
    }

    return validCostElements;
  }
 private Collection<ValidCeJobCode> getMappedCostElements(BudgetPerson person) {
   return budgetPersonService.getApplicableCostElements(
       person.getBudget(), person.getPersonSequenceNumber().toString());
 }