Esempio n. 1
0
  /**
   * This method is to check the existence of budgetcategorycode in table.
   *
   * @param maintenanceDocument
   * @return
   */
  private boolean checkExistence(MaintenanceDocument maintenanceDocument) {

    boolean valid = true;
    if (LOG.isDebugEnabled()) {
      LOG.debug(
          "new maintainable is: " + maintenanceDocument.getNewMaintainableObject().getClass());
    }
    // shared by budgetcategorymapping & costelement
    // TODO : refactoring this - must have a better way to handle this sharing
    String budgetCategoryCode;
    if (maintenanceDocument.getNewMaintainableObject().getDataObject()
        instanceof BudgetCategoryMapping) {
      BudgetCategoryMapping budgetCategoryMapping =
          (BudgetCategoryMapping) maintenanceDocument.getNewMaintainableObject().getDataObject();
      budgetCategoryCode = budgetCategoryMapping.getBudgetCategoryCode();
    } else {
      CostElement costElement =
          (CostElement) maintenanceDocument.getNewMaintainableObject().getDataObject();
      budgetCategoryCode = costElement.getBudgetCategoryCode();
    }
    Map pkMap = new HashMap();
    pkMap.put("code", budgetCategoryCode);
    valid = checkExistenceFromTable(BudgetCategory.class, pkMap, "code", "Budget Category");

    return valid;
  }
  /**
   * @see
   *     org.kuali.kra.proposaldevelopment.service.ObjectCodeToBudgetCategoryCodeService#getBudgetCategoryCodeForCostElment(java.lang.String)
   */
  public String getBudgetCategoryCodeForCostElment(String objectCode) {
    String budgetCategoryCode = null;

    Map<String, String> primaryKeys = new HashMap<String, String>();
    if (StringUtils.isNotEmpty(objectCode)) {
      primaryKeys.put("costElement", objectCode);
      CostElement costElement =
          (CostElement) businessObjectService.findByPrimaryKey(CostElement.class, primaryKeys);
      if (costElement != null) {
        budgetCategoryCode = costElement.getBudgetCategoryCode();
      }
    }

    return budgetCategoryCode;
  }
 private void addSalaryDataForCostElement(
     CostElement costElement, List<SalaryTypeVO> salaryTypeVoList) {
   SalaryTypeVO groupVO = new SalaryTypeVO();
   groupVO.setCostElement(costElement.getDescription());
   salaryTypeVoList.add(groupVO);
   for (BudgetPersonnelDetails details : budget.getObjectCodePersonnelList().get(costElement)) {
     SalaryTypeVO salaryTypeVoPerPerson = new SalaryTypeVO();
     salaryTypeVoPerPerson.setName(details.getBudgetPerson().getPersonName());
     salaryTypeVoPerPerson.setBudgetPeriodVOs(
         getBudgetPeriodData(
             budget
                 .getObjectCodePersonnelSalaryTotals()
                 .get(costElement.getCostElement() + "," + details.getPersonId())));
     salaryTypeVoList.add(salaryTypeVoPerPerson);
   }
   if (budget.getObjectCodePersonnelSalaryTotals().get(costElement.getCostElement()) != null) {
     SalaryTypeVO salaryTypeVoPerPerson = new SalaryTypeVO();
     salaryTypeVoPerPerson.setName("Summary Line Item");
     salaryTypeVoPerPerson.setBudgetPeriodVOs(
         getBudgetPeriodData(
             budget.getObjectCodePersonnelSalaryTotals().get(costElement.getCostElement())));
     salaryTypeVoList.add(salaryTypeVoPerPerson);
   }
 }