Search in sources :

Example 1 with CorrectionReceivingView

use of org.kuali.kfs.module.purap.businessobject.CorrectionReceivingView in project cu-kfs by CU-CommunityApps.

the class PurApRelatedViews method getGroupedRelatedReceivingViews.

/**
 * Groups related LineItemReceivingView and its CorrectionReceivingViews, with more recent receiving groups in the front;
 * and within each group, with more recent corrections in the front.
 *
 * @return  A list of ReceivingCorrectionViewGroups.
 */
public List<ReceivingViewGroup> getGroupedRelatedReceivingViews() {
    if (groupedRelatedReceivingViews != null) {
        return groupedRelatedReceivingViews;
    }
    groupedRelatedReceivingViews = new ArrayList<ReceivingViewGroup>();
    PurapService purapService = SpringContext.getBean(PurapService.class);
    List<LineItemReceivingView> liviews = purapService.getRelatedViews(LineItemReceivingView.class, accountsPayablePurchasingDocumentLinkIdentifier);
    List<CorrectionReceivingView> crviews = purapService.getRelatedViews(CorrectionReceivingView.class, accountsPayablePurchasingDocumentLinkIdentifier);
    // both LineItemReceivingViews and CorrectionReceivingViews are already in order with most recent first, so no need to sort
    for (LineItemReceivingView liview : liviews) {
        ReceivingViewGroup group = new ReceivingViewGroup();
        // could be current document
        group.lineItemView = liview;
        for (CorrectionReceivingView crview : crviews) {
            if (StringUtils.equals(crview.getLineItemReceivingDocumentNumber(), liview.getDocumentNumber()) && !documentNumber.equals(crview.getDocumentNumber())) {
                // exclude current document
                group.addCorrectionView(crview);
            }
        }
        groupedRelatedReceivingViews.add(group);
    }
    return groupedRelatedReceivingViews;
}
Also used : PurapService(org.kuali.kfs.module.purap.document.service.PurapService) CorrectionReceivingView(org.kuali.kfs.module.purap.businessobject.CorrectionReceivingView) LineItemReceivingView(org.kuali.kfs.module.purap.businessobject.LineItemReceivingView)

Aggregations

CorrectionReceivingView (org.kuali.kfs.module.purap.businessobject.CorrectionReceivingView)1 LineItemReceivingView (org.kuali.kfs.module.purap.businessobject.LineItemReceivingView)1 PurapService (org.kuali.kfs.module.purap.document.service.PurapService)1