/*
  * This method will get the budget data periods . For a given cost element
  * description from budget get list of budget periods , iterate over budget
  * periods and get list of budget line items ,iterate over budget line items
  * compare with the cost element description which ever matches add line
  * item cost to period cost.finally set period cost to BudgetDataPeriodVO
  *
  */
 private List<BudgetDataPeriodVO> getBudgetDataPeriodVOsForCostElement(String costElementDesc) {
   List<BudgetDataPeriodVO> budgetPeriodDataList = new ArrayList<BudgetDataPeriodVO>();
   int budgetPeriodDataId = 0;
   for (BudgetPeriod budgetPeriod : budget.getBudgetPeriods()) {
     BudgetDataPeriodVO budgetDataPeriodVO = new BudgetDataPeriodVO();
     budgetDataPeriodVO.setBudgetPeriodId(++budgetPeriodDataId);
     ScaleTwoDecimal periodCost = ScaleTwoDecimal.ZERO;
     for (BudgetLineItem lineItem : budgetPeriod.getBudgetLineItems()) {
       if (lineItem.getCostElementBO() != null
           && lineItem.getCostElementBO().getDescription() != null
           && lineItem.getCostElementBO().getDescription().equals(costElementDesc)) {
         periodCost = periodCost.add(lineItem.getLineItemCost());
       }
     }
     budgetDataPeriodVO.setPeriodCost(periodCost);
     budgetPeriodDataList.add(budgetDataPeriodVO);
   }
   return budgetPeriodDataList;
 }
 /*
  * This method will get the unique list of cost element description.Iterate
  * over budget periods and budget line items check's with map whether that
  * cost element is available in map , if not found add cost element
  * description to map.
  */
 private Map<String, String> getListOfCostElementDescription(
     List<List<BudgetLineItemCalculatedAmount>> budgetLineItemCalcAmountsList) {
   Map<String, String> lineItems = new HashMap<String, String>();
   for (BudgetPeriod budgetPeriod : budget.getBudgetPeriods()) {
     List<BudgetLineItemCalculatedAmount> budgetLineItemCalcAmounts =
         new ArrayList<BudgetLineItemCalculatedAmount>();
     for (BudgetLineItem budgetLineItem : budgetPeriod.getBudgetLineItems()) {
       budgetLineItemCalcAmounts = budgetLineItem.getBudgetLineItemCalculatedAmounts();
       budgetLineItemCalcAmountsList.add(budgetLineItemCalcAmounts);
       if (budgetLineItem.getCostElementBO() != null) {
         String costElementDesc = budgetLineItem.getCostElementBO().getDescription();
         if (costElementDesc != null
             && !lineItems.containsKey(costElementDesc)
             && budgetLineItem.getCostElementBO().getCostElement() != null) {
           lineItems.put(costElementDesc, budgetLineItem.getCostElementBO().getCostElement());
         }
       }
     }
   }
   return lineItems;
 }