1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.vnd.web.struts;
17
18 import java.util.HashMap;
19 import java.util.Map;
20
21 import javax.servlet.http.HttpServletRequest;
22 import javax.servlet.http.HttpServletResponse;
23
24 import org.apache.struts.action.ActionForm;
25 import org.apache.struts.action.ActionForward;
26 import org.apache.struts.action.ActionMapping;
27 import org.kuali.ole.sys.context.SpringContext;
28 import org.kuali.ole.vnd.batch.service.VendorExcludeService;
29 import org.kuali.rice.kns.web.struts.action.KualiAction;
30 import org.kuali.rice.krad.exception.AuthorizationException;
31
32 public class VendorExclusionAction extends KualiAction {
33
34 public ActionForward confirmDebarredVendor(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
35 VendorExclusionForm vendorExclusionForm = (VendorExclusionForm) form;
36
37 Map<String, String> fields = new HashMap<String, String>();
38 fields.put("confirmStatusCode", vendorExclusionForm.getConfirmStatusCode());
39 fields.put("vendorExclusionStatus", vendorExclusionForm.getVendorExclusionStatus());
40 fields.put("vendorType", vendorExclusionForm.getVendorType());
41 vendorExclusionForm.setFields(fields);
42 SpringContext.getBean(VendorExcludeService.class).confirmDebarredVendor(Integer.parseInt(vendorExclusionForm.getDebarredVendorId()));
43 return new ActionForward(getBackUrl(vendorExclusionForm), true);
44 }
45
46 public ActionForward denyDebarredVendor(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
47 VendorExclusionForm vendorExclusionForm = (VendorExclusionForm) form;
48
49 Map<String, String> fields = new HashMap<String, String>();
50 fields.put("confirmStatusCode", vendorExclusionForm.getConfirmStatusCode());
51 fields.put("vendorExclusionStatus", vendorExclusionForm.getVendorExclusionStatus());
52 fields.put("vendorType", vendorExclusionForm.getVendorType());
53 vendorExclusionForm.setFields(fields);
54 SpringContext.getBean(VendorExcludeService.class).denyDebarredVendor(Integer.parseInt(vendorExclusionForm.getDebarredVendorId()));
55 return new ActionForward(getBackUrl(vendorExclusionForm), true);
56 }
57
58 protected String getBackUrl(VendorExclusionForm form) {
59 return form.getBackLocation() + "?methodToCall=search&docFormKey=88888888&businessObjectClassName=" + form.getBusinessObjectClassName()+ "&confirmStatusCode=" + form.getConfirmStatusCode()
60 + "&vendorExclusionStatus=" + form.getVendorExclusionStatus() + "&vendorType=" + form.getVendorType() + "&suppressActions=No&showMaintenanceLinks=Yes";
61 }
62
63 @Override
64 protected void checkAuthorization(ActionForm form, String methodToCall) throws AuthorizationException {
65 }
66
67 }