/** * 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; }