use of org.kuali.kfs.module.purap.businessobject.LineItemReceivingView 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;
}
Aggregations