Exemplo n.º 1
0
 protected void verifyJobCode(BudgetSaveProjectPersonnelEvent event, KcEventResult result) {
   List<BudgetLineItem> budgetLineItems = getBudgetLineItems(event);
   BudgetPerson budgetPerson = event.getBudgetPerson();
   if (isJobCodeChanged(budgetPerson) && isNewJobCodeValid(budgetPerson, result)) {
     if (isBudgetPersonExistsInPersonnelDetails(budgetLineItems, budgetPerson)) {
       if (isJobCodeValid(budgetPerson)) {
         updateJobCodeOnDetailsFromPerson(budgetLineItems, budgetPerson);
       } else {
         result.setSuccess(false);
       }
     }
   }
 }
Exemplo n.º 2
0
  protected KcEventResult isNotDuplicateBudgetPersons(List<BudgetPerson> budgetPersons) {
    KcEventResult result = new KcEventResult();
    MessageMap messages = new MessageMap();
    result.setSuccess(true);

    for (int i = 0; i < budgetPersons.size(); i++) {
      BudgetPerson budgetPerson = budgetPersons.get(i);
      for (int j = i + 1; j < budgetPersons.size(); j++) {
        BudgetPerson budgetPersonCompare = budgetPersons.get(j);
        if (budgetPerson.isDuplicatePerson(budgetPersonCompare)) {
          messages.putError(
              "budgetPersons[" + j + "].personName",
              KeyConstants.ERROR_DUPLICATE_BUDGET_PERSON,
              budgetPerson.getPersonName());
          result.setSuccess(false);
        }
      }
    }

    result.setMessageMap(messages);
    return result;
  }
Exemplo n.º 3
0
 protected boolean isNewJobCodeValid(BudgetPerson budgetPerson, KcEventResult result) {
   JobCode jobCode = getJobCodeService().findJobCodeRef(budgetPerson.getJobCode());
   String jobCodeValidationEnabledInd =
       this.paramService.getParameterValueAsString(
           Budget.class, Constants.BUDGET_JOBCODE_VALIDATION_ENABLED);
   if (jobCodeValidationEnabledInd.equals("Y")) {
     if (jobCode == null) {
       result.getMessageMap().putError("jobCode", KeyConstants.ERROR_PERSON_INVALID_JOBCODE_VALUE);
       result.setSuccess(false);
       return false;
     } else {
       return true;
     }
   } else {
     return true;
   }
 }