use of org.kuali.kfs.module.purap.document.validation.event.AttributedUpdateCamsViewPurapEvent in project cu-kfs by CU-CommunityApps.
the class PurchasingActionBase method deleteItem.
/**
* Delete an item from the document.
*
* @param mapping An ActionMapping
* @param form An ActionForm
* @param request The HttpServletRequest
* @param response The HttpServletResponse
* @return An ActionForward
* @throws Exception
*/
public ActionForward deleteItem(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
PurchasingAccountsPayableFormBase purchasingForm = (PurchasingAccountsPayableFormBase) form;
PurchasingDocument purDocument = (PurchasingDocument) purchasingForm.getDocument();
if (!purDocument.getPurchasingCapitalAssetItems().isEmpty()) {
purDocument.setPurchasingCapitalAssetItems(new PurApArrayList(purDocument.getPurchasingCapitalAssetItemClass()));
SpringContext.getBean(PurapService.class).saveDocumentNoValidation(purDocument);
}
purDocument.deleteItem(getSelectedLine(request));
if (StringUtils.isNotBlank(purDocument.getCapitalAssetSystemTypeCode())) {
boolean rulePassed = SpringContext.getBean(KualiRuleService.class).applyRules(new AttributedUpdateCamsViewPurapEvent(purDocument));
if (rulePassed) {
SpringContext.getBean(PurchasingService.class).setupCapitalAssetItems(purDocument);
}
}
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
Aggregations