01: /*
02: * Copyright 2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: /*
17: * Created on Oct 5, 2004
18: *
19: */
20: package org.kuali.module.pdp.action.paymentdetail;
21:
22: import javax.servlet.http.HttpServletRequest;
23: import javax.servlet.http.HttpServletResponse;
24:
25: import org.apache.struts.action.ActionForm;
26: import org.apache.struts.action.ActionForward;
27: import org.apache.struts.action.ActionMapping;
28: import org.kuali.kfs.context.SpringContext;
29: import org.kuali.module.pdp.action.BaseAction;
30: import org.kuali.module.pdp.bo.PaymentDetail;
31: import org.kuali.module.pdp.service.PaymentGroupService;
32: import org.kuali.module.pdp.service.SecurityRecord;
33: import org.kuali.module.pdp.utilities.GeneralUtilities;
34:
35: /**
36: * @author delyea
37: */
38: public class PaymentDetailListAction extends BaseAction {
39: private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
40: .getLogger(PaymentDetailListAction.class);
41: private PaymentGroupService paymentGroupService;
42:
43: public PaymentDetailListAction() {
44: setPaymentGroupService(SpringContext
45: .getBean(PaymentGroupService.class));
46: }
47:
48: protected boolean isAuthorized(ActionMapping mapping,
49: ActionForm form, HttpServletRequest request,
50: HttpServletResponse response) {
51: SecurityRecord sr = getSecurityRecord(request);
52: return sr.isLimitedViewRole() || sr.isViewAllRole()
53: || sr.isViewIdRole() || sr.isViewBankRole();
54: }
55:
56: protected ActionForward executeLogic(ActionMapping mapping,
57: ActionForm form, HttpServletRequest request,
58: HttpServletResponse response) throws Exception {
59:
60: PaymentDetail pd = (PaymentDetail) request.getSession()
61: .getAttribute("PaymentDetail");
62: String listType = request.getParameter("listType");
63:
64: if (pd == null) {
65: // Handle Session expiration
66: LOG
67: .info("executeLogic() Payment Detail object 'pd' is null");
68: return mapping.findForward("pdp_session_timeout");
69: } else if (GeneralUtilities.isStringEmpty(listType)) {
70: // Invalid call to Action
71: return mapping.findForward("pdp_system_error");
72: } else {
73: if ((!("disbursement".equals(listType)))
74: && (!("group".equals(listType)))) {
75: // Invalid List Type
76: return mapping.findForward("pdp_system_error");
77: }
78: }
79: return mapping.findForward("display");
80: }
81:
82: public void setPaymentGroupService(PaymentGroupService p) {
83: paymentGroupService = p;
84: }
85:
86: }
|