use of org.kuali.kfs.module.ar.businessobject.InvoiceDetailAccountObjectCode in project cu-kfs by CU-CommunityApps.
the class ContractsGrantsInvoiceCreateDocumentServiceImpl method mapInvoiceDetailAccountObjectCodesByCategoryCode.
/**
* Converts a List of InvoiceDetailAccountObjectCodes into a map where the key is the category code
*
* @param invoiceDetailAccountObjectCodes a List of InvoiceDetailAccountObjectCodes
* @return that List converted to a Map, keyed by category code
*/
protected Map<String, List<InvoiceDetailAccountObjectCode>> mapInvoiceDetailAccountObjectCodesByCategoryCode(List<InvoiceDetailAccountObjectCode> invoiceDetailAccountObjectCodes) {
Map<String, List<InvoiceDetailAccountObjectCode>> invoiceDetailAccountObjectCodesMap = new HashMap<>();
for (InvoiceDetailAccountObjectCode invoiceDetailAccountObjectCode : invoiceDetailAccountObjectCodes) {
List<InvoiceDetailAccountObjectCode> invoiceDetailAccountObjectCodesForCategory = invoiceDetailAccountObjectCodesMap.get(invoiceDetailAccountObjectCode.getCategoryCode());
if (invoiceDetailAccountObjectCodesForCategory == null) {
invoiceDetailAccountObjectCodesForCategory = new ArrayList<>();
}
invoiceDetailAccountObjectCodesForCategory.add(invoiceDetailAccountObjectCode);
invoiceDetailAccountObjectCodesMap.put(invoiceDetailAccountObjectCode.getCategoryCode(), invoiceDetailAccountObjectCodesForCategory);
}
return invoiceDetailAccountObjectCodesMap;
}
Aggregations