Search in sources :

Example 1 with PurApArrayList

use of org.kuali.kfs.module.purap.util.PurApArrayList 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);
}
Also used : KualiRuleService(org.kuali.kfs.krad.service.KualiRuleService) PurapService(org.kuali.kfs.module.purap.document.service.PurapService) PurApArrayList(org.kuali.kfs.module.purap.util.PurApArrayList) PurchasingDocument(org.kuali.kfs.module.purap.document.PurchasingDocument) AttributedUpdateCamsViewPurapEvent(org.kuali.kfs.module.purap.document.validation.event.AttributedUpdateCamsViewPurapEvent) PurchasingService(org.kuali.kfs.module.purap.document.service.PurchasingService)

Aggregations

KualiRuleService (org.kuali.kfs.krad.service.KualiRuleService)1 PurchasingDocument (org.kuali.kfs.module.purap.document.PurchasingDocument)1 PurapService (org.kuali.kfs.module.purap.document.service.PurapService)1 PurchasingService (org.kuali.kfs.module.purap.document.service.PurchasingService)1 AttributedUpdateCamsViewPurapEvent (org.kuali.kfs.module.purap.document.validation.event.AttributedUpdateCamsViewPurapEvent)1 PurApArrayList (org.kuali.kfs.module.purap.util.PurApArrayList)1