private BudgetCategories getBudgetCategories() {
        ScaleTwoDecimal constructionCost = ScaleTwoDecimal.ZERO;
        ScaleTwoDecimal contractualCost = ScaleTwoDecimal.ZERO;
        ScaleTwoDecimal equipmentCost = ScaleTwoDecimal.ZERO;
        ScaleTwoDecimal personnelCost = ScaleTwoDecimal.ZERO;
        ScaleTwoDecimal suppliesCost = ScaleTwoDecimal.ZERO;
        ScaleTwoDecimal otherCost = ScaleTwoDecimal.ZERO;
        ScaleTwoDecimal travelCost = ScaleTwoDecimal.ZERO;
        ScaleTwoDecimal programIncome = ScaleTwoDecimal.ZERO;
        ScaleTwoDecimal calculatedCost = ScaleTwoDecimal.ZERO;
        ScaleTwoDecimal laSalaries = ScaleTwoDecimal.ZERO;
        ScaleTwoDecimal labAllocation = ScaleTwoDecimal.ZERO;

        BudgetCategories budgetCategories = BudgetCategories.Factory.newInstance();
        CategoryTotals categoryTotals = CategoryTotals.Factory.newInstance();
        if (budget == null) {
            return budgetCategories;
        }

        CategorySet[] categorySetArray = new CategorySet[1];
        CategorySet categorySet = CategorySet.Factory.newInstance();
        if (pdDoc.getDevelopmentProposal().getS2sOpportunity() != null && pdDoc.getDevelopmentProposal().getS2sOpportunity().getS2sSubmissionType() != null) {
            categorySet.setActivityTitle(pdDoc.getDevelopmentProposal().getS2sOpportunity().getOpportunityTitle());
        }

        List<? extends BudgetCategoryMapContract> budgetCategoryMapList = s2sBudgetCalculatorService.getBudgetCategoryMapList(
                new ArrayList<>(), new ArrayList<>());
        for (BudgetPeriodContract budgetPeriod : budget.getBudgetPeriods()) {
            for (BudgetLineItemContract budgetLineItem : budgetPeriod.getBudgetLineItems()) {
                for (BudgetCategoryMapContract budgetCategoryMap : budgetCategoryMapList) {
                    for (BudgetCategoryMappingContract budgetCategoryMapping : budgetCategoryMap.getBudgetCategoryMappings()) {
                        if (budgetLineItem.getBudgetCategory().getCode().equals(budgetCategoryMapping.getBudgetCategoryCode())) {
                            if (budgetCategoryMap.getTargetCategoryCode().equals(TARGET_CATEGORY_CODE_CONSTRUCTION)) {
                                constructionCost = constructionCost.add(budgetLineItem.getLineItemCost());
                            } else if (budgetCategoryMap.getTargetCategoryCode().equals(TARGET_CATEGORY_CODE_CONTRACTUAL)) {
                                contractualCost = contractualCost.add(budgetLineItem.getLineItemCost());
                            } else if (budgetCategoryMap.getTargetCategoryCode().equals(TARGET_CATEGORY_CODE_EQUIPMENT)) {
                                equipmentCost = equipmentCost.add(budgetLineItem.getLineItemCost());
                            } else if (budgetCategoryMap.getCategoryType().equals(TARGET_CATEGORY_TYPE_CODE_PERSONNEL)) {
                                personnelCost = personnelCost.add(budgetLineItem.getLineItemCost());
                            } else if (budgetCategoryMap.getTargetCategoryCode().equals(TARGET_CATEGORY_CODE_SUPPLIES)) {
                                suppliesCost = suppliesCost.add(budgetLineItem.getLineItemCost());
                            } else if (budgetCategoryMap.getTargetCategoryCode().equals(TARGET_CATEGORY_CODE_TRAVEL)
                                    || budgetCategoryMap.getTargetCategoryCode().equals(TARGET_CATEGORY_CODE_FOREIGN_TRAVEL)) {
                                travelCost = travelCost.add(budgetLineItem.getLineItemCost());
                            } else {
                                otherCost = otherCost.add(budgetLineItem.getLineItemCost());
                            }
                        }
                    }
                }

                for (BudgetLineItemCalculatedAmountContract budgetLineItemCalculatedAmount : budgetLineItem.getBudgetLineItemCalculatedAmounts()) {
                    if (budgetLineItemCalculatedAmount.getRateClass().getRateClassType().getCode().equals(RATE_CLASS_TYPE_EMPLOYEE_BENEFITS)
                            || budgetLineItemCalculatedAmount.getRateClass().getRateClassType().getCode().equals(RATE_CLASS_TYPE_VACATION)) {
                        calculatedCost = calculatedCost.add(budgetLineItemCalculatedAmount.getCalculatedCost());
                    }
                    if (budgetLineItemCalculatedAmount.getRateClass().getRateClassType().getCode().equals(RATE_CLASS_TYPE_LA_SALARIES)) {
                        laSalaries = laSalaries.add(budgetLineItemCalculatedAmount.getCalculatedCost());
                    }
                    if (budgetLineItemCalculatedAmount.getRateClass().getRateClassType().getCode().equals(RATE_CLASS_TYPE_LAB_ALLOCATION)) {
                        labAllocation = labAllocation.add(budgetLineItemCalculatedAmount.getCalculatedCost());
                    }
                }
            }
        }

        for (BudgetProjectIncomeContract budgetProjectIncome : budget.getBudgetProjectIncomes()) {
            programIncome = programIncome.add(new ScaleTwoDecimal(budgetProjectIncome.getProjectIncome().bigDecimalValue()));
        }

        BigDecimal otherCostWithLA = labAllocation.bigDecimalValue().add(otherCost.bigDecimalValue());
        BigDecimal salariesWithLA = personnelCost.bigDecimalValue().add(laSalaries.bigDecimalValue());

        categorySet.setBudgetConstructionRequestedAmount(constructionCost.bigDecimalValue());
        categoryTotals.setBudgetConstructionRequestedAmount(constructionCost.bigDecimalValue());
        categorySet.setBudgetContractualRequestedAmount(contractualCost.bigDecimalValue());
        categoryTotals.setBudgetContractualRequestedAmount(contractualCost.bigDecimalValue());
        categorySet.setBudgetEquipmentRequestedAmount(equipmentCost.bigDecimalValue());
        categoryTotals.setBudgetEquipmentRequestedAmount(equipmentCost.bigDecimalValue());
        categorySet.setBudgetFringeBenefitsRequestedAmount(calculatedCost.bigDecimalValue());
        categoryTotals.setBudgetFringeBenefitsRequestedAmount(calculatedCost.bigDecimalValue());
        categorySet.setBudgetIndirectChargesAmount(budget.getTotalIndirectCost().bigDecimalValue());
        categoryTotals.setBudgetIndirectChargesAmount(budget.getTotalIndirectCost().bigDecimalValue());
        categorySet.setBudgetOtherRequestedAmount(otherCostWithLA);
        categoryTotals.setBudgetOtherRequestedAmount(otherCostWithLA);
        categorySet.setBudgetPersonnelRequestedAmount(salariesWithLA);
        categoryTotals.setBudgetPersonnelRequestedAmount(salariesWithLA);
        categorySet.setBudgetSuppliesRequestedAmount(suppliesCost.bigDecimalValue());
        categoryTotals.setBudgetSuppliesRequestedAmount(suppliesCost.bigDecimalValue());
        categorySet.setBudgetTotalAmount(budget.getTotalCost().bigDecimalValue());
        categorySet.setBudgetTotalDirectChargesAmount(budget.getTotalDirectCost().bigDecimalValue());
        categorySet.setBudgetTravelRequestedAmount(travelCost.bigDecimalValue());
        categoryTotals.setBudgetTravelRequestedAmount(travelCost.bigDecimalValue());
        categorySet.setProgramIncomeAmount(programIncome.bigDecimalValue());
        categoryTotals.setProgramIncomeAmount(programIncome.bigDecimalValue());
        categoryTotals.setBudgetTotalAmount(budget.getTotalCost().bigDecimalValue());
        categoryTotals.setBudgetTotalDirectChargesAmount(budget.getTotalDirectCost().bigDecimalValue());

        categorySetArray[0] = categorySet;
        budgetCategories.setCategorySetArray(categorySetArray);
        budgetCategories.setCategoryTotals(categoryTotals);
        return budgetCategories;
    }
private BudgetCategories getBudgetCategories ( ) { ScaleTwoDecimal constructionCost = ScaleTwoDecimal . ZERO ; ScaleTwoDecimal contractualCost = ScaleTwoDecimal . ZERO ; ScaleTwoDecimal equipmentCost = ScaleTwoDecimal . ZERO ; ScaleTwoDecimal personnelCost = ScaleTwoDecimal . ZERO ; ScaleTwoDecimal suppliesCost = ScaleTwoDecimal . ZERO ; ScaleTwoDecimal otherCost = ScaleTwoDecimal . ZERO ; ScaleTwoDecimal travelCost = ScaleTwoDecimal . ZERO ; ScaleTwoDecimal programIncome = ScaleTwoDecimal . ZERO ; ScaleTwoDecimal calculatedCost = ScaleTwoDecimal . ZERO ; ScaleTwoDecimal laSalaries = ScaleTwoDecimal . ZERO ; ScaleTwoDecimal labAllocation = ScaleTwoDecimal . ZERO ; BudgetCategories budgetCategories = BudgetCategories . Factory . newInstance ( ) ; CategoryTotals categoryTotals = CategoryTotals . Factory . newInstance ( ) ; if ( budget == null ) { return budgetCategories ; } CategorySet [ ] categorySetArray = new CategorySet [ 1 ] ; CategorySet categorySet = CategorySet . Factory . newInstance ( ) ; if ( pdDoc . getDevelopmentProposal ( ) . getS2sOpportunity ( ) != null && pdDoc . getDevelopmentProposal ( ) . getS2sOpportunity ( ) . getS2sSubmissionType ( ) != null ) { categorySet . setActivityTitle ( pdDoc . getDevelopmentProposal ( ) . getS2sOpportunity ( ) . getOpportunityTitle ( ) ) ; } List < ? extends BudgetCategoryMapContract > budgetCategoryMapList = s2sBudgetCalculatorService . getBudgetCategoryMapList ( new ArrayList < > ( ) , new ArrayList < > ( ) ) ; for ( BudgetPeriodContract budgetPeriod : budget . getBudgetPeriods ( ) ) { for ( BudgetLineItemContract budgetLineItem : budgetPeriod . getBudgetLineItems ( ) ) { for ( BudgetCategoryMapContract budgetCategoryMap : budgetCategoryMapList ) { for ( BudgetCategoryMappingContract budgetCategoryMapping : budgetCategoryMap . getBudgetCategoryMappings ( ) ) { if ( budgetLineItem . getBudgetCategory ( ) . getCode ( ) . equals ( budgetCategoryMapping . getBudgetCategoryCode ( ) ) ) { if ( budgetCategoryMap . getTargetCategoryCode ( ) . equals ( TARGET_CATEGORY_CODE_CONSTRUCTION ) ) { constructionCost = constructionCost . add ( budgetLineItem . getLineItemCost ( ) ) ; } else if ( budgetCategoryMap . getTargetCategoryCode ( ) . equals ( TARGET_CATEGORY_CODE_CONTRACTUAL ) ) { contractualCost = contractualCost . add ( budgetLineItem . getLineItemCost ( ) ) ; } else if ( budgetCategoryMap . getTargetCategoryCode ( ) . equals ( TARGET_CATEGORY_CODE_EQUIPMENT ) ) { equipmentCost = equipmentCost . add ( budgetLineItem . getLineItemCost ( ) ) ; } else if ( budgetCategoryMap . getCategoryType ( ) . equals ( TARGET_CATEGORY_TYPE_CODE_PERSONNEL ) ) { personnelCost = personnelCost . add ( budgetLineItem . getLineItemCost ( ) ) ; } else if ( budgetCategoryMap . getTargetCategoryCode ( ) . equals ( TARGET_CATEGORY_CODE_SUPPLIES ) ) { suppliesCost = suppliesCost . add ( budgetLineItem . getLineItemCost ( ) ) ; } else if ( budgetCategoryMap . getTargetCategoryCode ( ) . equals ( TARGET_CATEGORY_CODE_TRAVEL ) || budgetCategoryMap . getTargetCategoryCode ( ) . equals ( TARGET_CATEGORY_CODE_FOREIGN_TRAVEL ) ) { travelCost = travelCost . add ( budgetLineItem . getLineItemCost ( ) ) ; } else { otherCost = otherCost . add ( budgetLineItem . getLineItemCost ( ) ) ; } } } } for ( BudgetLineItemCalculatedAmountContract budgetLineItemCalculatedAmount : budgetLineItem . getBudgetLineItemCalculatedAmounts ( ) ) { if ( budgetLineItemCalculatedAmount . getRateClass ( ) . getRateClassType ( ) . getCode ( ) . equals ( RATE_CLASS_TYPE_EMPLOYEE_BENEFITS ) || budgetLineItemCalculatedAmount . getRateClass ( ) . getRateClassType ( ) . getCode ( ) . equals ( RATE_CLASS_TYPE_VACATION ) ) { calculatedCost = calculatedCost . add ( budgetLineItemCalculatedAmount . getCalculatedCost ( ) ) ; } if ( budgetLineItemCalculatedAmount . getRateClass ( ) . getRateClassType ( ) . getCode ( ) . equals ( RATE_CLASS_TYPE_LA_SALARIES ) ) { laSalaries = laSalaries . add ( budgetLineItemCalculatedAmount . getCalculatedCost ( ) ) ; } if ( budgetLineItemCalculatedAmount . getRateClass ( ) . getRateClassType ( ) . getCode ( ) . equals ( RATE_CLASS_TYPE_LAB_ALLOCATION ) ) { labAllocation = labAllocation . add ( budgetLineItemCalculatedAmount . getCalculatedCost ( ) ) ; } } } } for ( BudgetProjectIncomeContract budgetProjectIncome : budget . getBudgetProjectIncomes ( ) ) { programIncome = programIncome . add ( new ScaleTwoDecimal ( budgetProjectIncome . getProjectIncome ( ) . bigDecimalValue ( ) ) ) ; } BigDecimal otherCostWithLA = labAllocation . bigDecimalValue ( ) . add ( otherCost . bigDecimalValue ( ) ) ; BigDecimal salariesWithLA = personnelCost . bigDecimalValue ( ) . add ( laSalaries . bigDecimalValue ( ) ) ; categorySet . setBudgetConstructionRequestedAmount ( constructionCost . bigDecimalValue ( ) ) ; categoryTotals . setBudgetConstructionRequestedAmount ( constructionCost . bigDecimalValue ( ) ) ; categorySet . setBudgetContractualRequestedAmount ( contractualCost . bigDecimalValue ( ) ) ; categoryTotals . setBudgetContractualRequestedAmount ( contractualCost . bigDecimalValue ( ) ) ; categorySet . setBudgetEquipmentRequestedAmount ( equipmentCost . bigDecimalValue ( ) ) ; categoryTotals . setBudgetEquipmentRequestedAmount ( equipmentCost . bigDecimalValue ( ) ) ; categorySet . setBudgetFringeBenefitsRequestedAmount ( calculatedCost . bigDecimalValue ( ) ) ; categoryTotals . setBudgetFringeBenefitsRequestedAmount ( calculatedCost . bigDecimalValue ( ) ) ; categorySet . setBudgetIndirectChargesAmount ( budget . getTotalIndirectCost ( ) . bigDecimalValue ( ) ) ; categoryTotals . setBudgetIndirectChargesAmount ( budget . getTotalIndirectCost ( ) . bigDecimalValue ( ) ) ; categorySet . setBudgetOtherRequestedAmount ( otherCostWithLA ) ; categoryTotals . setBudgetOtherRequestedAmount ( otherCostWithLA ) ; categorySet . setBudgetPersonnelRequestedAmount ( salariesWithLA ) ; categoryTotals . setBudgetPersonnelRequestedAmount ( salariesWithLA ) ; categorySet . setBudgetSuppliesRequestedAmount ( suppliesCost . bigDecimalValue ( ) ) ; categoryTotals . setBudgetSuppliesRequestedAmount ( suppliesCost . bigDecimalValue ( ) ) ; categorySet . setBudgetTotalAmount ( budget . getTotalCost ( ) . bigDecimalValue ( ) ) ; categorySet . setBudgetTotalDirectChargesAmount ( budget . getTotalDirectCost ( ) . bigDecimalValue ( ) ) ; categorySet . setBudgetTravelRequestedAmount ( travelCost . bigDecimalValue ( ) ) ; categoryTotals . setBudgetTravelRequestedAmount ( travelCost . bigDecimalValue ( ) ) ; categorySet . setProgramIncomeAmount ( programIncome . bigDecimalValue ( ) ) ; categoryTotals . setProgramIncomeAmount ( programIncome . bigDecimalValue ( ) ) ; categoryTotals . setBudgetTotalAmount ( budget . getTotalCost ( ) . bigDecimalValue ( ) ) ; categoryTotals . setBudgetTotalDirectChargesAmount ( budget . getTotalDirectCost ( ) . bigDecimalValue ( ) ) ; categorySetArray [ 0 ] = categorySet ; budgetCategories . setCategorySetArray ( categorySetArray ) ; budgetCategories . setCategoryTotals ( categoryTotals ) ; return budgetCategories ; }
This method gives the information of BudgetCategories like CategorySet, CategoryTotals

@return BudgetCategories budget categories total amount.