/*
  * This method get CumulativeBudgetLAExclusions for a BudgetPeriod. It first
  * check size of BudgetProposalLARates if it's it create ReportTypeList with
  * sortId 1,2,3,4
  */
 private SubReportType getCumulativeBudgetLAExclusions() {
   List<ReportType> reportTypeList = new ArrayList<ReportType>();
   SubReportType subReportType = SubReportType.Factory.newInstance();
   int sortId;
   String categoryDesc = null;
   ScaleTwoDecimal calculatedCost = ScaleTwoDecimal.ZERO;
   if (budget.getBudgetLaRates().size() > 0) {
     sortId = 1;
     categoryDesc = ALLOCATED_ADMINISTRATIVE_SUPPORT;
     calculatedCost = getCalculatedCostForBudgetExclusionsSortId1ForCumulativeReport();
     ReportType reportTypeForSortId1 =
         getReportTypeForExclusions(sortId, categoryDesc, calculatedCost);
     reportTypeList.add(reportTypeForSortId1);
     sortId = 2;
     categoryDesc = TOTAL_EMPLOYEE_BENEFITS;
     calculatedCost = getCalculatedCostForBudgetLAExclusionsSortId2ForCumulativeReport();
     ReportType reportTypeForSortId2 =
         getReportTypeForExclusions(sortId, categoryDesc, calculatedCost);
     reportTypeList.add(reportTypeForSortId2);
     setReportTypeForBudgetLAExclusionsSortId3ForCumulativeReport(reportTypeList);
     sortId = 4;
     categoryDesc = ALLOCATED_LAB_EXPENSE;
     calculatedCost = getCalculatedCostForBudgetExclusionsSortId4ForCumulativeReport();
     ReportType reportTypeForSortId4 =
         getReportTypeForExclusions(sortId, categoryDesc, calculatedCost);
     if (calculatedCost.doubleValue() > 0.0d) {
       reportTypeList.add(reportTypeForSortId4);
     }
   }
   subReportType.setGroupArray(getGroupsType(reportTypeList));
   return subReportType;
 }
 /*
  * This method gets SubreportType for BudgetCumulativeSummaryNonPersonnel
  * from List of BudgetLineItem by checking unitUmber
  */
 private SubReportType getBudgetCumulativeSummaryNonPersonnel() {
   SubReportType subReportType = SubReportType.Factory.newInstance();
   List<ReportType> reportTypeList = new ArrayList<ReportType>();
   ScaleTwoDecimal calculatedCost = ScaleTwoDecimal.ZERO;
   String categoryDesc = OTHER_DIRECT_COSTS;
   String costElementDesc = ALLOCATED_LAB_EXPENSE;
   for (BudgetPeriod budgetPeriod : budget.getBudgetPeriods()) {
     this.budgetPeriod = budgetPeriod;
     if (getUnitNumber() > 0) {
       for (BudgetLineItem budgetLineItem : budgetPeriod.getBudgetLineItems()) {
         calculatedCost =
             calculatedCost.add(
                 getTotalCalculatedCostByRateClassTypeFromLineItem(
                     RateClassType.LAB_ALLOCATION.getRateClassType(), budgetLineItem));
       }
     }
   }
   ReportType reportType =
       getReportTypeForNonPersonnel(categoryDesc, costElementDesc, calculatedCost, null);
   if (calculatedCost.doubleValue() > 0.0) {
     reportTypeList.add(reportType);
   }
   setReportTypeForBudgetCumulativeNonPersonnel(reportTypeList);
   Collections.sort(
       reportTypeList,
       new Comparator<ReportType>() {
         public int compare(ReportType reportType1, ReportType reportType2) {
           return reportType1
               .getBudgetCategoryDescription()
               .compareTo(reportType2.getBudgetCategoryDescription());
         }
       });
   subReportType.setGroupArray(getGroupsType(reportTypeList, category));
   return subReportType;
 }
 /*
  * This method gets subReportType for BudgetCumulativeIDCForReport by
  * BudgetPeriod. It get the sum of calculatedCost based on BudgetLineItem
  * OnOffCampusFlag and RateClassType
  */
 private SubReportType getBudgetCumulativeIDCForReport() {
   SubReportType subReportType = SubReportType.Factory.newInstance();
   List<ReportType> reportTypeList = new ArrayList<ReportType>();
   ScaleTwoDecimal calculatedCostForOn = ScaleTwoDecimal.ZERO;
   ScaleTwoDecimal calculatedCostForOff = ScaleTwoDecimal.ZERO;
   for (BudgetPeriod budgetPeriod : budget.getBudgetPeriods()) {
     for (BudgetLineItem budgetLineItem : budgetPeriod.getBudgetLineItems()) {
       if (budgetLineItem.getOnOffCampusFlag().booleanValue()) {
         calculatedCostForOn =
             calculatedCostForOn.add(
                 getTotalCalculatedCostByRateClassTypeFromLineItem(
                     RateClassType.OVERHEAD.getRateClassType(), budgetLineItem));
       } else {
         calculatedCostForOff =
             calculatedCostForOff.add(
                 getTotalCalculatedCostByRateClassTypeFromLineItem(
                     RateClassType.OVERHEAD.getRateClassType(), budgetLineItem));
       }
     }
   }
   if (!calculatedCostForOn.equals(ScaleTwoDecimal.ZERO)) {
     ReportType reportTypeForOn =
         getReportTypeForBudgetIndirectCostsForReport(Boolean.TRUE, calculatedCostForOn, null);
     reportTypeList.add(reportTypeForOn);
   }
   if (!calculatedCostForOff.equals(ScaleTwoDecimal.ZERO)) {
     ReportType reportTypeForOff =
         getReportTypeForBudgetIndirectCostsForReport(Boolean.FALSE, calculatedCostForOff, null);
     reportTypeList.add(reportTypeForOff);
   }
   subReportType.setGroupArray(getGroupsType(reportTypeList));
   return subReportType;
 }
  /*
   * This method gets subReportType for CumulativeSalarySummary by
   * BudgetPeriod. Here CumulativeBudgetSalary,
   * LaSalaryForBudgetPersonnelRateAndBase and LaSalaryBudgetRateAndBase are
   * set to reportTypeList
   */
  private SubReportType getCumulativeSalarySummary() {

    SubReportType subReportType = SubReportType.Factory.newInstance();
    List<ReportType> reportTypeList = new ArrayList<ReportType>();
    setReportTypeForCumulativeBudgetSalary(reportTypeList);
    setBudgetLASalaryForBudgetRateAndBaseForCumulativeReport(reportTypeList);
    subReportType.setGroupArray(getGroupsType(reportTypeList, category));
    return subReportType;
  }
 /*
  * This method gets subReportType for CumulativeBudgetLARateBase by
  * BudgetPeriod for RateClassType LAB_ALLOCATION
  */
 private SubReportType getCumulativeBudgetLARateBase() {
   SubReportType subReportType = SubReportType.Factory.newInstance();
   String rateClassType = RateClassType.LAB_ALLOCATION.getRateClassType();
   List<ReportTypeVO> tempReportTypeVOList = new ArrayList<ReportTypeVO>();
   Map<String, ReportType> reportTypeMap = new HashMap<String, ReportType>();
   for (BudgetPeriod budgetPeriod : budget.getBudgetPeriods()) {
     for (BudgetLineItem budgetLineItem : budgetPeriod.getBudgetLineItems()) {
       setBudgetPersRateAndBaseListForBudgetLARateAndBase(tempReportTypeVOList, budgetLineItem);
       if (!isBudgetCategoryPersonnel(budgetLineItem)) {
         setBudgetRateAndBaseListForBudgetLARateAndBase(tempReportTypeVOList, budgetLineItem);
       }
     }
   }
   setReportTypeMapFromReportTypeVOList(tempReportTypeVOList, reportTypeMap);
   List<ReportType> reportTypeList = new ArrayList<ReportType>(reportTypeMap.values());
   subReportType.setGroupArray(getGroupsType(reportTypeList, rateClassRateType));
   return subReportType;
 }