Search in sources :

Example 1 with PurapAccountingLineComparator

use of org.kuali.kfs.module.purap.util.PurapAccountingLineComparator in project cu-kfs by CU-CommunityApps.

the class PurchasingAccountsPayableDocumentBase method getIndexedErrorPathPrefix.

private String getIndexedErrorPathPrefix(String errorPathPrefix, AccountingLine currentLine) {
    int idx = 0;
    int i = 0;
    for (PurApItem item : (List<PurApItem>) this.getItems()) {
        int j = 0;
        // the error icon may be placed in wrong line.
        if (CollectionUtils.isNotEmpty(item.getSourceAccountingLines())) {
            Collections.sort(item.getSourceAccountingLines(), new PurapAccountingLineComparator());
        }
        for (PurApAccountingLine acctLine : item.getSourceAccountingLines()) {
            if (acctLine == currentLine) {
                return errorPathPrefix + i + "]." + KFSConstants.EXISTING_SOURCE_ACCT_LINE_PROPERTY_NAME + "[" + j + "]";
            } else {
                j++;
            }
        }
        i++;
    }
    return errorPathPrefix + 0 + "]." + KFSConstants.EXISTING_SOURCE_ACCT_LINE_PROPERTY_NAME + "[" + 0 + "]";
}
Also used : PurApItem(org.kuali.kfs.module.purap.businessobject.PurApItem) PurApAccountingLine(org.kuali.kfs.module.purap.businessobject.PurApAccountingLine) List(java.util.List) ArrayList(java.util.ArrayList) PurapAccountingLineComparator(org.kuali.kfs.module.purap.util.PurapAccountingLineComparator)

Aggregations

ArrayList (java.util.ArrayList)1 List (java.util.List)1 PurApAccountingLine (org.kuali.kfs.module.purap.businessobject.PurApAccountingLine)1 PurApItem (org.kuali.kfs.module.purap.businessobject.PurApItem)1 PurapAccountingLineComparator (org.kuali.kfs.module.purap.util.PurapAccountingLineComparator)1