use of org.folio.rest.acq.model.finance.Fund in project mod-invoice by folio-org.
the class InvoiceHelper method mapExternalAcctNoToFundDistros.
private Map<FundExtNoExpenseClassExtNoPair, List<FundDistribution>> mapExternalAcctNoToFundDistros(Map<String, Map<String, List<FundDistribution>>> fundDistrosGroupedByFundIdAndExpenseClassExtNo, Map<String, List<Fund>> fundsGroupedByExternalAccountNo) {
Map<FundExtNoExpenseClassExtNoPair, List<FundDistribution>> groupedFundDistribution = new HashMap<>();
for (Map.Entry<String, List<Fund>> fundExternalAccountNoPair : fundsGroupedByExternalAccountNo.entrySet()) {
String fundExternalAccountNo = fundExternalAccountNoPair.getKey();
for (Fund fund : fundExternalAccountNoPair.getValue()) {
Map<String, List<FundDistribution>> fundDistrsExpenseClassExtNo = fundDistrosGroupedByFundIdAndExpenseClassExtNo.get(fund.getId());
for (Map.Entry<String, List<FundDistribution>> fundDistrs : fundDistrsExpenseClassExtNo.entrySet()) {
String expenseClassExtAccountNo = fundDistrs.getKey();
FundExtNoExpenseClassExtNoPair key = new FundExtNoExpenseClassExtNoPair(fundExternalAccountNo, expenseClassExtAccountNo);
List<FundDistribution> fundDistributions = fundDistrs.getValue();
updateFundDistributionsWithExpenseClassCode(fund, fundDistributions);
Optional.ofNullable(groupedFundDistribution.get(key)).ifPresentOrElse(value -> value.addAll(fundDistributions), () -> groupedFundDistribution.put(key, fundDistributions));
}
}
}
return groupedFundDistribution;
}
use of org.folio.rest.acq.model.finance.Fund in project mod-invoice by folio-org.
the class BudgetExpenseClassService method getFundIdExpenseClassIdParameters.
private List<Parameter> getFundIdExpenseClassIdParameters(InvoiceWorkflowDataHolder holder) {
Fund fund = holder.getFund();
ExpenseClass expenseClass = holder.getExpenseClass();
return Arrays.asList(new Parameter().withKey(FUND_CODE).withValue(fund.getCode()), new Parameter().withKey(EXPENSE_CLASS_NAME).withValue(expenseClass.getName()));
}
Aggregations