List of usage examples for org.apache.commons.collections4 CollectionUtils isEmpty
public static boolean isEmpty(final Collection<?> coll)
From source file:org.finra.herd.service.JobServiceTestHelper.java
/** * Converts the given list of parameters into a map for easy access. * * @param parameters the list of parameters * * @return the map of key-values// ww w . j a v a 2 s . c om */ public Map<String, Parameter> toMap(List<Parameter> parameters) { Map<String, Parameter> map = new HashMap<>(); if (!CollectionUtils.isEmpty(parameters)) { for (Parameter parameter : parameters) { map.put(parameter.getName(), parameter); } } return map; }
From source file:org.finra.herd.service.MessageNotificationEventServiceTest.java
@Test public void testProcessBusinessObjectDataStatusChangeNotificationEventHerdNotificationNotEnabled() throws Exception { // Create a business object data entity. BusinessObjectDataEntity businessObjectDataEntity = businessObjectDataServiceTestHelper .createTestValidBusinessObjectData(); BusinessObjectDataKey businessObjectDataKey = businessObjectDataHelper .getBusinessObjectDataKey(businessObjectDataEntity); // Override configuration. Map<String, Object> overrideMap = new HashMap<>(); overrideMap.put(ConfigurationValue.HERD_NOTIFICATION_ENABLED.getKey(), false); modifyPropertySourceInEnvironment(overrideMap); try {/*from w w w.j a v a2 s .c o m*/ // Trigger the notification. List<NotificationMessage> result = messageNotificationEventService .processBusinessObjectDataStatusChangeNotificationEvent(businessObjectDataKey, BusinessObjectDataStatusEntity.VALID, BusinessObjectDataStatusEntity.UPLOADING); // Validate the results. assertTrue(CollectionUtils.isEmpty(result)); } finally { // Restore the property sources so we don't affect other tests. restorePropertySourceInEnvironment(); } }
From source file:org.finra.herd.service.MessageNotificationEventServiceTest.java
@Test public void testProcessBusinessObjectFormatVersionChangeNotificationEventHerdNotificationNotEnabled() throws Exception { // Create a business object format entity. BusinessObjectDataInvalidateUnregisteredRequest request = new BusinessObjectDataInvalidateUnregisteredRequest( BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, NO_SUBPARTITION_VALUES, StorageEntity.MANAGED_STORAGE); BusinessObjectFormatEntity businessObjectFormatEntity = businessObjectFormatServiceTestHelper .createBusinessObjectFormat(request); // Get a business object data key. BusinessObjectFormatKey businessObjectFormatKey = businessObjectFormatHelper .getBusinessObjectFormatKey(businessObjectFormatEntity); // Override configuration. Map<String, Object> overrideMap = new HashMap<>(); overrideMap.put(ConfigurationValue.HERD_NOTIFICATION_ENABLED.getKey(), false); modifyPropertySourceInEnvironment(overrideMap); try {//w w w. j a v a2 s . c o m // Trigger the notification. List<NotificationMessage> result = messageNotificationEventService .processBusinessObjectFormatVersionChangeNotificationEvent(businessObjectFormatKey, NO_OLD_BUSINESS_OBJECT_FORMAT_VERSION); // Validate the results. assertTrue(CollectionUtils.isEmpty(result)); } finally { // Restore the property sources so we don't affect other tests. restorePropertySourceInEnvironment(); } }
From source file:org.finra.herd.service.MessageNotificationEventServiceTest.java
@Test public void testProcessUserNamespaceAuthorizationChangeNotificationEventHerdNotificationNotEnabled() throws Exception { // Create a user namespace authorization key. UserNamespaceAuthorizationKey userNamespaceAuthorizationKey = new UserNamespaceAuthorizationKey(USER_ID, NAMESPACE);/* ww w.j a v a 2s.c om*/ // Create and persist the relative database entities. namespaceDaoTestHelper.createNamespaceEntity(userNamespaceAuthorizationKey.getNamespace()); userNamespaceAuthorizationDaoTestHelper.createUserNamespaceAuthorizationEntity( userNamespaceAuthorizationKey, SUPPORTED_NAMESPACE_PERMISSIONS); // Override configuration. Map<String, Object> overrideMap = new HashMap<>(); overrideMap.put(ConfigurationValue.HERD_NOTIFICATION_ENABLED.getKey(), false); modifyPropertySourceInEnvironment(overrideMap); try { // Trigger the notification. List<NotificationMessage> result = messageNotificationEventService .processUserNamespaceAuthorizationChangeNotificationEvent(userNamespaceAuthorizationKey); // Validate the results. assertTrue(CollectionUtils.isEmpty(result)); } finally { // Restore the property sources so we don't affect other tests. restorePropertySourceInEnvironment(); } }
From source file:org.finra.herd.service.systemjobs.FileUploadCleanupJob.java
@Override public void validateParameters(List<Parameter> parameters) { // This system job accepts only one optional parameter with an integer value. if (!CollectionUtils.isEmpty(parameters)) { Assert.isTrue(parameters.size() == 1, String.format("Too many parameters are specified for \"%s\" system job.", JOB_NAME)); Assert.isTrue(/*from w w w.j a va 2s .c o m*/ parameters.get(0).getName().equalsIgnoreCase( ConfigurationValue.FILE_UPLOAD_CLEANUP_JOB_THRESHOLD_MINUTES.getKey()), String.format("Parameter \"%s\" is not supported by \"%s\" system job.", parameters.get(0).getName(), FileUploadCleanupJob.JOB_NAME)); parameterHelper.getParameterValueAsInteger(parameters.get(0)); } }
From source file:org.geoserver.qos.QosMainConfigurationWMSValidator.java
@Override public void validateRepresentativeOperation(QosRepresentativeOperation repOp) { super.validateRepresentativeOperation(repOp); // Validate repOp.getGetMapOperations() and repOp.getGetFeatureInfoOperations() if (repOp.getGetMapOperations() != null) repOp.getGetMapOperations().forEach(x -> validateWmsOperation(x, "GetMap Operation")); if (repOp.getGetFeatureInfoOperations() != null) repOp.getGetFeatureInfoOperations().forEach(x -> validateWmsOperation(x, "GetFeatureInfo Operation")); // Validate Statements if (CollectionUtils.isEmpty(repOp.getQualityOfServiceStatements())) { throw new IllegalArgumentException("At least one statement required in Representative Operation"); }//from ww w . j av a 2 s . c o m repOp.getQualityOfServiceStatements().forEach(x -> valid(x)); }
From source file:org.geoserver.qos.web.BaseLimitedConstraintsPanel.java
private void initBoundsComponent() { envelopeModel = new Model<ReferencedEnvelope>() { @Override//from w w w .j av a 2 s. c om public ReferencedEnvelope getObject() { if (mainModel.getObject().getAreaConstraint() == null) { mainModel.getObject().setAreaConstraint(new AreaConstraint()); } AreaConstraint ac = mainModel.getObject().getAreaConstraint(); // if no complete values present, return null // if (ac == null || mainModel.getObject().getCrs() == null) return null; Envelope env; if (ac.getMinX() == null || ac.getMaxX() == null || ac.getMinY() == null || ac.getMaxY() == null) { env = new Envelope(); } else { env = new Envelope(ac.getMinX(), ac.getMaxX(), ac.getMinY(), ac.getMaxY()); } CoordinateReferenceSystem crs = null; if (StringUtils.isNotEmpty(mainModel.getObject().getCrs())) { try { crs = CRS.decode(mainModel.getObject().getCrs()); } catch (FactoryException e) { throw new RuntimeException(e); } } return ReferencedEnvelope.create(env, crs); } @Override public void setObject(ReferencedEnvelope env) { if (env == null) { mainModel.getObject().setAreaConstraint(null); mainModel.getObject().setCrs(null); } mainModel.getObject().setAreaConstraint( new AreaConstraint(env.getMinX(), env.getMinY(), env.getMaxX(), env.getMaxY())); try { mainModel.getObject().setCrs(CRS.lookupIdentifier(env.getCoordinateReferenceSystem(), true)); } catch (FactoryException e) { throw new RuntimeException(e); } } }; envelopePanel = new EnvelopePanel("bounds", envelopeModel); envelopePanel.setRequired(true); envelopePanel.setCRSFieldVisible(true); envelopePanel.setCrsRequired(true); envelopePanel.setOutputMarkupId(true); innerConstraintsDiv.add(envelopePanel); final GeoServerAjaxFormLink generateBoundsLink = new GeoServerAjaxFormLink("generateBounds") { @Override protected void onAfterSubmit(AjaxRequestTarget target, Form<?> form) { super.onAfterSubmit(target, form); if (CollectionUtils.isEmpty(getSelectedLayers())) return; GeoServerApplication gsa = (GeoServerApplication) getApplication(); LayerGroupInfo lg = gsa.getCatalog().getFactory().createLayerGroup(); getSelectedLayers().forEach(l -> { lg.getLayers().add(gsa.getCatalog().getLayerByName(l)); }); try { CoordinateReferenceSystem crs = envelopePanel.getCoordinateReferenceSystem(); // CRS.decode(envelopePanel.getCoordinateReferenceSystem()); if (crs != null) { new CatalogBuilder(gsa.getCatalog()).calculateLayerGroupBounds(lg, crs); } else { // calculate from scratch new CatalogBuilder(gsa.getCatalog()).calculateLayerGroupBounds(lg); } ReferencedEnvelope renv = lg.getBounds(); envelopePanel.setModelObject(renv); } catch (Exception e) { throw new WicketRuntimeException(e); } target.add(mainDiv); } @Override protected void onClick(AjaxRequestTarget target, Form<?> form) { } }; innerConstraintsDiv.add(generateBoundsLink); final GeoServerAjaxFormLink generateBoundsFromCRSLink = new GeoServerAjaxFormLink("generateBoundsFromCRS") { @Override protected void onAfterSubmit(AjaxRequestTarget target, Form<?> form) { super.onAfterSubmit(target, form); try { CoordinateReferenceSystem crs = envelopePanel.getCoordinateReferenceSystem(); if (crs == null) return; ReferencedEnvelope refEnv = new ReferencedEnvelope(CRS.getEnvelope(crs)); envelopePanel.setModelObject(refEnv); envelopePanel.modelChanged(); target.add(envelopePanel); } catch (Exception e) { throw new WicketRuntimeException(e); } } @Override protected void onClick(AjaxRequestTarget target, Form<?> form) { } }; innerConstraintsDiv.add(generateBoundsFromCRSLink); }
From source file:org.kuali.coeus.common.budget.impl.calculator.AbstractBudgetCalculator.java
/** * /* w w w.j a v a2 s . c o m*/ * This method is for populating the calculated amounts by looking at the rate class and rate type for each line item gets applied to. */ @SuppressWarnings("unchecked") protected void updateBudgetLineItemCalculatedAmounts() { List<AbstractBudgetCalculatedAmount> lineItemCalcAmts = budgetLineItem.getBudgetCalculatedAmounts(); List<BreakUpInterval> cvLIBreakupIntervals = getBreakupIntervals(); if (lineItemCalcAmts != null && lineItemCalcAmts.size() > 0 && cvLIBreakupIntervals != null && cvLIBreakupIntervals.size() > 0) { /* * Sum up all the calculated costs for each breakup interval and then update the line item cal amts. */ String rateClassCode = "0"; String rateTypeCode = "0"; ScaleTwoDecimal totalCalculatedCost = ScaleTwoDecimal.ZERO; ScaleTwoDecimal totalCalculatedCostSharing = ScaleTwoDecimal.ZERO; ScaleTwoDecimal totalUnderRecovery = ScaleTwoDecimal.ZERO; ScaleTwoDecimal directCost = ScaleTwoDecimal.ZERO; ScaleTwoDecimal indirectCost = ScaleTwoDecimal.ZERO; Equals equalsRC; Equals equalsRT; And RCandRT = null; QueryList<RateAndCost> cvCombinedAmtDetails = new QueryList<RateAndCost>(); for (BreakUpInterval brkUpInterval : cvLIBreakupIntervals) { cvCombinedAmtDetails.addAll(brkUpInterval.getRateAndCosts()); } for (AbstractBudgetCalculatedAmount calculatedAmount : lineItemCalcAmts) { rateClassCode = calculatedAmount.getRateClassCode(); rateTypeCode = calculatedAmount.getRateTypeCode(); equalsRC = new Equals(RATE_CLASS_CODE, rateClassCode); equalsRT = new Equals(RATE_TYPE_CODE, rateTypeCode); RCandRT = new And(equalsRC, equalsRT); totalCalculatedCost = cvCombinedAmtDetails.sumObjects("calculatedCost", RCandRT); calculatedAmount.setCalculatedCost(totalCalculatedCost); totalCalculatedCostSharing = cvCombinedAmtDetails.sumObjects("calculatedCostSharing", RCandRT); calculatedAmount.setCalculatedCostSharing(totalCalculatedCostSharing); } /* * Sum up all the underRecovery costs for each breakup interval and then update the line item details. */ totalUnderRecovery = new QueryList<BreakUpInterval>(cvLIBreakupIntervals).sumObjects("underRecovery"); budgetLineItem.setUnderrecoveryAmount(totalUnderRecovery); /* * Sum up all direct costs ie, rates for RateClassType <> 'O', for each breakup interval plus the line item cost, and * then update the line item details. */ NotEquals notEqualsOH = new NotEquals("rateClassType", RateClassType.OVERHEAD.getRateClassType()); boolean directCostRolledUp = false; boolean resetTotalUnderRecovery = false; ScaleTwoDecimal newTotalUrAmount = ScaleTwoDecimal.ZERO; ScaleTwoDecimal newTotalCostSharing = ScaleTwoDecimal.ZERO; if (budgetLineItem instanceof BudgetLineItem && CollectionUtils .isNotEmpty(((BudgetLineItem) budgetLineItem).getBudgetPersonnelDetailsList())) { for (BudgetPersonnelDetails budgetPersonnelDetail : ((BudgetLineItem) budgetLineItem) .getBudgetPersonnelDetailsList()) { List<BudgetPersonnelCalculatedAmount> personnelCalAmts = budgetPersonnelDetail .getBudgetCalculatedAmounts(); newTotalUrAmount = newTotalUrAmount.add(budgetPersonnelDetail.getUnderrecoveryAmount()); resetTotalUnderRecovery = true; if (CollectionUtils.isNotEmpty(personnelCalAmts)) { for (BudgetPersonnelCalculatedAmount personnelCalAmt : personnelCalAmts) { if (personnelCalAmt.getRateClass() == null) { personnelCalAmt.refreshReferenceObject("rateClass"); } if (!personnelCalAmt.getRateClass().getRateClassTypeCode().equals("O")) { directCost = directCost.add(personnelCalAmt.getCalculatedCost()); } else { indirectCost = indirectCost.add(personnelCalAmt.getCalculatedCost()); } newTotalCostSharing = newTotalCostSharing .add(personnelCalAmt.getCalculatedCostSharing()); directCostRolledUp = true; } } } } if (resetTotalUnderRecovery) { budgetLineItem.setUnderrecoveryAmount(newTotalUrAmount); } if (!directCostRolledUp) { directCost = cvCombinedAmtDetails.sumObjects("calculatedCost", notEqualsOH); } budgetLineItem.setDirectCost(directCost.add(budgetLineItem.getLineItemCost())); /* * Sum up all Indirect costs ie, rates for RateClassType = 'O', for each breakup interval and then update the line item * details. */ Equals equalsOH = new Equals("rateClassType", RateClassType.OVERHEAD.getRateClassType()); if (!directCostRolledUp) { indirectCost = cvCombinedAmtDetails.sumObjects("calculatedCost", equalsOH); } budgetLineItem.setIndirectCost(indirectCost); /* * Sum up all Cost Sharing amounts ie, rates for RateClassType <> 'O' and set in the calculatedCostSharing field of line * item details */ if (!directCostRolledUp) { totalCalculatedCostSharing = cvCombinedAmtDetails.sumObjects("calculatedCostSharing"); } else { totalCalculatedCostSharing = newTotalCostSharing; } budgetLineItem.setTotalCostSharingAmount( budgetLineItem.getCostSharingAmount() == null ? totalCalculatedCostSharing : budgetLineItem.getCostSharingAmount().add(totalCalculatedCostSharing)); } else if (lineItemCalcAmts != null && lineItemCalcAmts.size() > 0 && (budgetLineItem.getLineItemCost().equals(ScaleTwoDecimal.ZERO) || CollectionUtils.isEmpty(cvLIBreakupIntervals))) { for (AbstractBudgetCalculatedAmount calculatedAmount : lineItemCalcAmts) { calculatedAmount.setCalculatedCost(ScaleTwoDecimal.ZERO); calculatedAmount.setCalculatedCostSharing(ScaleTwoDecimal.ZERO); } } }
From source file:org.kuali.coeus.common.budget.impl.calculator.AbstractBudgetCalculator.java
private void addBudgetLineItemCalculatedAmountsForRateTypes(List<ValidCeRateType> rateTypes) { if (CollectionUtils.isEmpty(rateTypes)) { return;/*from w w w . j a v a 2 s . c o m*/ } for (ValidCeRateType validCeRateType : rateTypes) { String rateClassType = validCeRateType.getRateClass().getRateClassTypeCode(); if (rateClassType.equals(RateClassType.OVERHEAD.getRateClassType()) && !budget.getBudgetParent().isProposalBudget()) { addOHBudgetLineItemCalculatedAmountForAward(validCeRateType.getRateClassCode(), validCeRateType.getRateType(), validCeRateType.getRateClass().getRateClassTypeCode()); } else { addBudgetLineItemCalculatedAmount(validCeRateType.getRateClassCode(), validCeRateType.getRateType(), validCeRateType.getRateClass().getRateClassTypeCode()); } } }
From source file:org.kuali.coeus.common.budget.impl.calculator.BudgetCalculationServiceImpl.java
@Deprecated @Override/*from w ww. j a v a2s . c om*/ public void calculateBudgetSummaryTotals(Budget budget) { calculateBudgetTotals(budget); //Categorize all Object Codes per their Category Type SortedMap<BudgetCategoryType, List<CostElement>> objectCodeListByBudgetCategoryType = categorizeObjectCodesByCategory( budget); SortedMap<CostElement, List<BudgetPersonnelDetails>> objectCodeUniquePersonnelList = new TreeMap<>(); SortedMap<String, List<ScaleTwoDecimal>> objectCodePersonnelSalaryTotals = new TreeMap<>(); SortedMap<String, List<ScaleTwoDecimal>> objectCodePersonnelFringeTotals = new TreeMap<>(); //Temp collections for maintaining Sub Section Totals SortedSet<String> objectCodePersonnelSalaryTotalsByPeriod = new TreeSet<>(); SortedSet<String> objectCodePersonnelFringeTotalsByPeriod = new TreeSet<>(); SortedMap<RateType, List<ScaleTwoDecimal>> personnelCalculatedExpenseTotals = new TreeMap<>(); SortedMap<RateType, List<ScaleTwoDecimal>> nonPersonnelCalculatedExpenseTotals = new TreeMap<>(); List<ScaleTwoDecimal> periodSummarySalaryTotals = new ArrayList<>(); for (int i = 0; i < budget.getBudgetPeriods().size(); i++) { periodSummarySalaryTotals.add(i, ScaleTwoDecimal.ZERO); } List<ScaleTwoDecimal> periodSummaryFringeTotals = new ArrayList<>(); for (int i = 0; i < budget.getBudgetPeriods().size(); i++) { periodSummaryFringeTotals.add(i, ScaleTwoDecimal.ZERO); } SortedMap<String, List<ScaleTwoDecimal>> subTotalsBySubSection = new TreeMap<>(); subTotalsBySubSection.put("personnelSalaryTotals", periodSummarySalaryTotals); subTotalsBySubSection.put("personnelFringeTotals", periodSummaryFringeTotals); //Loop thru the Personnel Object Codes - to calculate Salary, Fringe Totals etc.. per person BudgetCategoryType personnelCategory = getPersonnelCategoryType(); List<CostElement> personnelObjectCodes = objectCodeListByBudgetCategoryType.get(personnelCategory); if (CollectionUtils.isNotEmpty(personnelObjectCodes)) { for (CostElement personnelCostElement : personnelObjectCodes) { if (!objectCodeUniquePersonnelList.containsKey(personnelCostElement)) { objectCodeUniquePersonnelList.put(personnelCostElement, new ArrayList<BudgetPersonnelDetails>()); } for (BudgetPeriod budgetPeriod : budget.getBudgetPeriods()) { budgetPeriod.setBudget(budget); QueryList<BudgetLineItem> lineItemQueryList = new QueryList<>(); lineItemQueryList.addAll(budgetPeriod.getBudgetLineItems()); Equals objectCodeEquals = new Equals("costElement", personnelCostElement.getCostElement()); QueryList<BudgetLineItem> filteredLineItems = lineItemQueryList.filter(objectCodeEquals); QueryList<BudgetPersonnelDetails> personnelQueryList = new QueryList<>(); //Loop thru the matching Line Items to gather personnel info for (BudgetLineItem matchingLineItem : filteredLineItems) { personnelQueryList.addAll(matchingLineItem.getBudgetPersonnelDetailsList()); } for (BudgetLineItem matchingLineItem : filteredLineItems) { for (BudgetPersonnelDetails budgetPersonnelDetails : matchingLineItem .getBudgetPersonnelDetailsList()) { Equals personIdEquals = new Equals("personId", budgetPersonnelDetails.getPersonId()); QueryList personOccurrencesForSameObjectCode = personnelQueryList .filter(personIdEquals); //Calculate the Salary Totals for each Person ScaleTwoDecimal personSalaryTotalsForCurrentPeriod = personOccurrencesForSameObjectCode .sumObjects("salaryRequested"); if (!objectCodePersonnelSalaryTotals.containsKey(matchingLineItem.getCostElement() + "," + budgetPersonnelDetails.getPersonId())) { objectCodeUniquePersonnelList.get(matchingLineItem.getCostElementBO()) .add(budgetPersonnelDetails); // set up for all periods and put into map List<ScaleTwoDecimal> periodTotals = new ArrayList<>(); for (int i = 0; i < budget.getBudgetPeriods().size(); i++) { periodTotals.add(i, ScaleTwoDecimal.ZERO); } objectCodePersonnelSalaryTotals.put(matchingLineItem.getCostElement() + "," + budgetPersonnelDetails.getPersonId(), periodTotals); } //Setting the total lines here - so that they'll be set just once for a unique person within an Object Code objectCodePersonnelSalaryTotals .get(matchingLineItem.getCostElement() + "," + budgetPersonnelDetails.getPersonId()) .set(budgetPeriod.getBudgetPeriod() - 1, personSalaryTotalsForCurrentPeriod); if (objectCodePersonnelSalaryTotalsByPeriod .add(budgetPeriod.getBudgetPeriod().toString() + "," + matchingLineItem.getCostElement() + "," + budgetPersonnelDetails.getPersonId())) { subTotalsBySubSection.get("personnelSalaryTotals").set( budgetPeriod.getBudgetPeriod() - 1, ((subTotalsBySubSection.get("personnelSalaryTotals") .get(budgetPeriod.getBudgetPeriod() - 1))) .add(personSalaryTotalsForCurrentPeriod)); } //Calculate the Fringe Totals for each Person if (!objectCodePersonnelFringeTotals.containsKey(matchingLineItem.getCostElement() + "," + budgetPersonnelDetails.getPersonId())) { // set up for all periods and put into map List<ScaleTwoDecimal> periodFringeTotals = new ArrayList<>(); for (int i = 0; i < budget.getBudgetPeriods().size(); i++) { periodFringeTotals.add(i, ScaleTwoDecimal.ZERO); } objectCodePersonnelFringeTotals.put(matchingLineItem.getCostElement() + "," + budgetPersonnelDetails.getPersonId(), periodFringeTotals); } ScaleTwoDecimal personFringeTotalsForCurrentPeriod = ScaleTwoDecimal.ZERO; //Calculate the Fringe Totals for that Person (cumulative fringe for all occurrences of the person) for (Object person : personOccurrencesForSameObjectCode) { BudgetPersonnelDetails personOccurrence = (BudgetPersonnelDetails) person; for (BudgetPersonnelCalculatedAmount calcExpenseAmount : personOccurrence .getBudgetPersonnelCalculatedAmounts()) { calcExpenseAmount.refreshReferenceObject("rateClass"); //Check for Employee Benefits RateClassType if (calcExpenseAmount.getRateClass().getRateClassTypeCode() .equalsIgnoreCase("E")) { personFringeTotalsForCurrentPeriod = personFringeTotalsForCurrentPeriod .add(calcExpenseAmount.getCalculatedCost()); } } } objectCodePersonnelFringeTotals .get(matchingLineItem.getCostElement() + "," + budgetPersonnelDetails.getPersonId()) .set(budgetPeriod.getBudgetPeriod() - 1, personFringeTotalsForCurrentPeriod); if (objectCodePersonnelFringeTotalsByPeriod .add(budgetPeriod.getBudgetPeriod().toString() + "," + matchingLineItem.getCostElement() + "," + budgetPersonnelDetails.getPersonId())) { subTotalsBySubSection.get("personnelFringeTotals").set( budgetPeriod.getBudgetPeriod() - 1, ((subTotalsBySubSection.get("personnelFringeTotals") .get(budgetPeriod.getBudgetPeriod() - 1))) .add(personFringeTotalsForCurrentPeriod)); } } //Need to handle the Summary Items - if any if (CollectionUtils.isEmpty(matchingLineItem.getBudgetPersonnelDetailsList())) { //Include Summary Item Salary (Line Item Cost) if (!objectCodePersonnelSalaryTotals.containsKey(matchingLineItem.getCostElement())) { // set up for all periods and put into map List<ScaleTwoDecimal> periodTotals = new ArrayList<>(); for (int i = 0; i < budget.getBudgetPeriods().size(); i++) { periodTotals.add(i, ScaleTwoDecimal.ZERO); } objectCodePersonnelSalaryTotals.put(matchingLineItem.getCostElement(), periodTotals); } objectCodePersonnelSalaryTotals.get(matchingLineItem.getCostElement()).set( budgetPeriod.getBudgetPeriod() - 1, (objectCodePersonnelSalaryTotals.get(matchingLineItem.getCostElement()) .get(budgetPeriod.getBudgetPeriod() - 1)) .add(matchingLineItem.getLineItemCost())); //Include Summary Item Fringe Amt ScaleTwoDecimal summaryFringeTotalsForCurrentPeriod = ScaleTwoDecimal.ZERO; if (!objectCodePersonnelFringeTotals.containsKey(matchingLineItem.getCostElement())) { // set up for all periods and put into map List<ScaleTwoDecimal> periodFringeTotals = new ArrayList<>(); for (int i = 0; i < budget.getBudgetPeriods().size(); i++) { periodFringeTotals.add(i, ScaleTwoDecimal.ZERO); } objectCodePersonnelFringeTotals.put(matchingLineItem.getCostElement(), periodFringeTotals); } for (BudgetLineItemCalculatedAmount lineItemCalculatedAmount : matchingLineItem .getBudgetLineItemCalculatedAmounts()) { lineItemCalculatedAmount.refreshReferenceObject("rateClass"); //Check for Employee Benefits RateClassType if (lineItemCalculatedAmount.getRateClass().getRateClassTypeCode() .equalsIgnoreCase("E")) { summaryFringeTotalsForCurrentPeriod = summaryFringeTotalsForCurrentPeriod .add(lineItemCalculatedAmount.getCalculatedCost()); } } objectCodePersonnelFringeTotals.get(matchingLineItem.getCostElement()).set( budgetPeriod.getBudgetPeriod() - 1, (objectCodePersonnelFringeTotals.get(matchingLineItem.getCostElement()) .get(budgetPeriod.getBudgetPeriod() - 1)) .add(summaryFringeTotalsForCurrentPeriod)); subTotalsBySubSection.get("personnelSalaryTotals").set( budgetPeriod.getBudgetPeriod() - 1, ((subTotalsBySubSection.get("personnelSalaryTotals") .get(budgetPeriod.getBudgetPeriod() - 1))) .add((objectCodePersonnelSalaryTotals .get(matchingLineItem.getCostElement()) .get(budgetPeriod.getBudgetPeriod() - 1)))); subTotalsBySubSection.get("personnelFringeTotals").set( budgetPeriod.getBudgetPeriod() - 1, ((subTotalsBySubSection.get("personnelFringeTotals") .get(budgetPeriod.getBudgetPeriod() - 1))) .add((objectCodePersonnelFringeTotals .get(matchingLineItem.getCostElement()) .get(budgetPeriod.getBudgetPeriod() - 1)))); } } } //Budget Period Looping Ends here } //Personnel Object Code Looping Ends here } budget.setBudgetSummaryTotals(subTotalsBySubSection); personnelCalculatedExpenseTotals = calculateExpenseTotals(budget, true); nonPersonnelCalculatedExpenseTotals = calculateExpenseTotals(budget, false); budget.setObjectCodeListByBudgetCategoryType(objectCodeListByBudgetCategoryType); budget.setObjectCodePersonnelList(objectCodeUniquePersonnelList); budget.setObjectCodePersonnelSalaryTotals(objectCodePersonnelSalaryTotals); budget.setObjectCodePersonnelFringeTotals(objectCodePersonnelFringeTotals); budget.setPersonnelCalculatedExpenseTotals(personnelCalculatedExpenseTotals); budget.setNonPersonnelCalculatedExpenseTotals(nonPersonnelCalculatedExpenseTotals); calculateNonPersonnelSummaryTotals(budget); populateBudgetPeriodSummaryCalcAmounts(budget); }