use of org.kuali.kfs.module.purap.document.validation.event.AttributedAddPurchasingCapitalAssetLocationEvent in project cu-kfs by CU-CommunityApps.
the class PurchasingActionBase method addCapitalAssetLocationByItem.
public ActionForward addCapitalAssetLocationByItem(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
PurchasingFormBase purchasingForm = (PurchasingFormBase) form;
PurchasingDocument purDocument = (PurchasingDocument) purchasingForm.getDocument();
CapitalAssetLocation location = purDocument.getPurchasingCapitalAssetItems().get(getSelectedLine(request)).getPurchasingCapitalAssetSystem().getNewPurchasingCapitalAssetLocationLine();
boolean rulePassed = SpringContext.getBean(KualiRuleService.class).applyRules(new AttributedAddPurchasingCapitalAssetLocationEvent("", purDocument, location));
if (rulePassed) {
// get specific asset item and grab system as well and attach asset location
PurchasingCapitalAssetItem assetItem = purDocument.getPurchasingCapitalAssetItems().get(getSelectedLine(request));
CapitalAssetSystem system = assetItem.getPurchasingCapitalAssetSystem();
location.setCapitalAssetSystemIdentifier(system.getCapitalAssetSystemIdentifier());
system.getCapitalAssetLocations().add(location);
// now reset the location as all the rules are passed successfully
purDocument.getPurchasingCapitalAssetItems().get(getSelectedLine(request)).getPurchasingCapitalAssetSystem().resetNewPurchasingCapitalAssetLocationLine();
}
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
use of org.kuali.kfs.module.purap.document.validation.event.AttributedAddPurchasingCapitalAssetLocationEvent in project cu-kfs by CU-CommunityApps.
the class PurchasingActionBase method addCapitalAssetLocationByDocument.
public ActionForward addCapitalAssetLocationByDocument(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
PurchasingFormBase purchasingForm = (PurchasingFormBase) form;
CapitalAssetLocation location = purchasingForm.getAndResetNewPurchasingCapitalAssetLocationLine();
PurchasingDocument purDocument = (PurchasingDocument) purchasingForm.getDocument();
boolean rulePassed = SpringContext.getBean(KualiRuleService.class).applyRules(new AttributedAddPurchasingCapitalAssetLocationEvent("", purDocument, location));
rulePassed = rulePassed && SpringContext.getBean(PurchasingService.class).checkCapitalAssetLocation(location);
if (rulePassed) {
// get specific asset item and grab system as well and attach asset number
CapitalAssetSystem system = purDocument.getPurchasingCapitalAssetSystems().get(getSelectedLine(request));
location.setCapitalAssetSystemIdentifier(system.getCapitalAssetSystemIdentifier());
system.getCapitalAssetLocations().add(location);
}
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
Aggregations