Source Code Cross Referenced for PaymentMaintenanceAction.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » module » pdp » action » paymentmaintenance » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » ERP CRM Financial » Kuali Financial System » org.kuali.module.pdp.action.paymentmaintenance 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2007 The Kuali Foundation.
003:         * 
004:         * Licensed under the Educational Community License, Version 1.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         * 
008:         * http://www.opensource.org/licenses/ecl1.php
009:         * 
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:        /*
017:         * Created on Aug 24, 2004
018:         */
019:        package org.kuali.module.pdp.action.paymentmaintenance;
020:
021:        import java.util.List;
022:
023:        import javax.servlet.http.HttpServletRequest;
024:        import javax.servlet.http.HttpServletResponse;
025:
026:        import org.apache.struts.action.ActionErrors;
027:        import org.apache.struts.action.ActionForm;
028:        import org.apache.struts.action.ActionForward;
029:        import org.apache.struts.action.ActionMapping;
030:        import org.apache.struts.action.ActionMessage;
031:        import org.kuali.kfs.context.SpringContext;
032:        import org.kuali.module.pdp.action.BaseAction;
033:        import org.kuali.module.pdp.bo.Batch;
034:        import org.kuali.module.pdp.bo.PaymentDetail;
035:        import org.kuali.module.pdp.form.paymentmaintenance.PaymentMaintenanceForm;
036:        import org.kuali.module.pdp.service.BatchMaintenanceService;
037:        import org.kuali.module.pdp.service.PaymentMaintenanceService;
038:        import org.kuali.module.pdp.service.SecurityRecord;
039:        import org.kuali.module.pdp.utilities.GeneralUtilities;
040:
041:        /**
042:         * @author delyea
043:         */
044:        public class PaymentMaintenanceAction extends BaseAction {
045:            private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
046:                    .getLogger(PaymentMaintenanceAction.class);
047:            private PaymentMaintenanceService paymentMaintenanceService;
048:            private BatchMaintenanceService batchMaintenanceService;
049:
050:            public PaymentMaintenanceAction() {
051:                setPaymentMaintenanceService(SpringContext
052:                        .getBean(PaymentMaintenanceService.class));
053:                setBatchMaintenanceService(SpringContext
054:                        .getBean(BatchMaintenanceService.class));
055:            }
056:
057:            public void setPaymentMaintenanceService(PaymentMaintenanceService p) {
058:                this .paymentMaintenanceService = p;
059:            }
060:
061:            public void setBatchMaintenanceService(BatchMaintenanceService p) {
062:                this .batchMaintenanceService = p;
063:            }
064:
065:            protected boolean isAuthorized(ActionMapping mapping,
066:                    ActionForm form, HttpServletRequest request,
067:                    HttpServletResponse response) {
068:                SecurityRecord sr = getSecurityRecord(request);
069:                return sr.isLimitedViewRole() || sr.isViewAllRole()
070:                        || sr.isViewIdRole() || sr.isViewBankRole()
071:                        || sr.isTaxHoldersRole();
072:            }
073:
074:            protected ActionForward executeLogic(ActionMapping mapping,
075:                    ActionForm form, HttpServletRequest request,
076:                    HttpServletResponse response) throws Exception {
077:                LOG.debug("executeLogic() started");
078:
079:                PaymentDetail pd = (PaymentDetail) request.getSession()
080:                        .getAttribute("PaymentDetail");
081:                List batchSearchList = (List) request.getSession()
082:                        .getAttribute("batchIndivSearchResults");
083:                SecurityRecord sr = (SecurityRecord) request.getSession()
084:                        .getAttribute("SecurityRecord");
085:                PaymentMaintenanceForm pmf = (PaymentMaintenanceForm) form;
086:                String forward = "update";
087:
088:                ActionErrors actionErrors = new ActionErrors();
089:                String buttonPressed = GeneralUtilities
090:                        .whichButtonWasPressed(request);
091:
092:                LOG
093:                        .debug("executeLogic() PaymentMaintenanceAction ButtonPressed was "
094:                                + buttonPressed);
095:                if (buttonPressed != null) {
096:                    if (buttonPressed.startsWith("btnBatch")) {
097:                        Batch b = (Batch) request.getSession().getAttribute(
098:                                "BatchDetail");
099:                        if (b != null) {
100:                            // Action Originated from BatchDetail Screen
101:                            if (buttonPressed.startsWith("btnBatchHold")) {
102:                                pmf.setAction("batchHold");
103:                                if (batchMaintenanceService
104:                                        .doBatchPaymentsHaveOpenStatus(b
105:                                                .getId())) {
106:                                    pmf.setChangeId(b.getId());
107:                                } else {
108:                                    actionErrors
109:                                            .add(
110:                                                    "errors",
111:                                                    new ActionMessage(
112:                                                            "paymentMaintenanceAction.batchStatus.notAllOpen"));
113:                                }
114:                            } else if (buttonPressed
115:                                    .startsWith("btnBatchCancel")) {
116:                                pmf.setAction("batchCancel");
117:                                if (batchMaintenanceService
118:                                        .doBatchPaymentsHaveOpenOrHeldStatus(b
119:                                                .getId())) {
120:                                    pmf.setChangeId(b.getId());
121:                                } else {
122:                                    actionErrors
123:                                            .add(
124:                                                    "errors",
125:                                                    new ActionMessage(
126:                                                            "paymentMaintenanceAction.batchStatus.notAllOpenOrHeld"));
127:                                }
128:                            } else if (buttonPressed
129:                                    .startsWith("btnBatchRemoveHold")) {
130:                                pmf.setAction("batchRemoveHold");
131:                                if (batchMaintenanceService
132:                                        .doBatchPaymentsHaveHeldStatus(b
133:                                                .getId())) {
134:                                    pmf.setChangeId(b.getId());
135:                                } else {
136:                                    actionErrors
137:                                            .add(
138:                                                    "errors",
139:                                                    new ActionMessage(
140:                                                            "paymentMaintenanceAction.batchStatus.notAllHeld"));
141:                                }
142:                            } else {
143:                                // Invalid Button was Pressed
144:                                return mapping.findForward("pdp_system_error");
145:                            }
146:                            if (!actionErrors.isEmpty()) {
147:                                forward = "batch";
148:                            }
149:                        } else {
150:                            LOG
151:                                    .info("executeLogic() Batch object 'b' from session is null");
152:                            forward = "pdp_session_timeout";
153:                        }
154:                    } else if ((pd == null) && (batchSearchList == null)) {
155:                        LOG
156:                                .info("executeLogic() PaymentDetail object 'pd' or 'batchSearchList' variable is null");
157:                        forward = "pdp_session_timeout";
158:
159:                    } else if (buttonPressed.startsWith("btnUpdate")) {
160:                        // Action Originated from Update page
161:                        if (buttonPressed.startsWith("btnUpdateSave")) {
162:                            String action = pmf.getAction();
163:                            LOG.debug("executeLogic() string 'action' is "
164:                                    + action);
165:
166:                            // All Actions must be performed on Payment Group that Payment Detail is a member of
167:                            if (action.equals("Hold")) {
168:                                if (sr.isHoldRole()) {
169:                                    LOG
170:                                            .debug("executeLogic() running holdPendingPayment now");
171:                                    // ChangeID was previous set to PaymentGroupID
172:                                    paymentMaintenanceService
173:                                            .holdPendingPayment(pmf
174:                                                    .getChangeId(), pmf
175:                                                    .getChangeText(),
176:                                                    getUser(request));
177:                                    actionErrors
178:                                            .add(
179:                                                    "success",
180:                                                    new ActionMessage(
181:                                                            "success.paymentUpdate.saved"));
182:                                } else {
183:                                    actionErrors
184:                                            .add(
185:                                                    "error",
186:                                                    new ActionMessage(
187:                                                            "paymentMaintenanceAction.paymentUpdate.notAuthorized"));
188:                                }
189:                            } else if (action.equals("RemoveHold")) {
190:                                if (sr.isHoldRole() || sr.isTaxHoldersRole()
191:                                        || sr.isSysAdminRole()) {
192:                                    LOG
193:                                            .debug("executeLogic() running removeHoldPendingPayment now");
194:                                    // ChangeID was previous set to PaymentGroupID
195:                                    paymentMaintenanceService
196:                                            .removeHoldPendingPayment(pmf
197:                                                    .getChangeId(), pmf
198:                                                    .getChangeText(),
199:                                                    getUser(request), sr);
200:                                    actionErrors
201:                                            .add(
202:                                                    "success",
203:                                                    new ActionMessage(
204:                                                            "success.paymentUpdate.saved"));
205:                                } else {
206:                                    actionErrors
207:                                            .add(
208:                                                    "error",
209:                                                    new ActionMessage(
210:                                                            "paymentMaintenanceAction.paymentUpdate.notAuthorized"));
211:                                }
212:                            } else if (action.equals("batchHold")) {
213:                                if (sr.isHoldRole()) {
214:                                    LOG
215:                                            .debug("executeLogic() running holdPendingBatch now");
216:                                    // ChangeID was previous set to BatchID
217:                                    batchMaintenanceService.holdPendingBatch(
218:                                            pmf.getChangeId(), pmf
219:                                                    .getChangeText(),
220:                                            getUser(request));
221:                                    actionErrors
222:                                            .add(
223:                                                    "success",
224:                                                    new ActionMessage(
225:                                                            "success.paymentUpdate.saved"));
226:                                } else {
227:                                    actionErrors
228:                                            .add(
229:                                                    "error",
230:                                                    new ActionMessage(
231:                                                            "paymentMaintenanceAction.paymentUpdate.notAuthorized"));
232:                                }
233:                            } else if (action.equals("batchRemoveHold")) {
234:                                if (sr.isHoldRole()) {
235:                                    LOG
236:                                            .debug("executeLogic() running removeBatchHold now");
237:                                    // ChangeID was previous set to BatchID
238:                                    batchMaintenanceService.removeBatchHold(pmf
239:                                            .getChangeId(),
240:                                            pmf.getChangeText(),
241:                                            getUser(request));
242:                                    actionErrors
243:                                            .add(
244:                                                    "success",
245:                                                    new ActionMessage(
246:                                                            "success.paymentUpdate.saved"));
247:                                } else {
248:                                    actionErrors
249:                                            .add(
250:                                                    "error",
251:                                                    new ActionMessage(
252:                                                            "paymentMaintenanceAction.paymentUpdate.notAuthorized"));
253:                                }
254:                            } else if (action.equals("Cancel")) {
255:                                if (sr.isCancelRole() || sr.isTaxHoldersRole()
256:                                        || sr.isSysAdminRole()) {
257:                                    LOG
258:                                            .debug("executeLogic() running cancelPendingPayment now");
259:                                    // ChangeID was previous set to PaymentGroupID
260:                                    paymentMaintenanceService
261:                                            .cancelPendingPayment(pmf
262:                                                    .getChangeId(), pmf
263:                                                    .getPaymentDetailId(), pmf
264:                                                    .getChangeText(),
265:                                                    getUser(request), sr);
266:                                    actionErrors
267:                                            .add(
268:                                                    "success",
269:                                                    new ActionMessage(
270:                                                            "success.paymentUpdate.saved"));
271:                                } else {
272:                                    actionErrors
273:                                            .add(
274:                                                    "error",
275:                                                    new ActionMessage(
276:                                                            "paymentMaintenanceAction.paymentUpdate.notAuthorized"));
277:                                }
278:                            } else if (action.equals("batchCancel")) {
279:                                if (sr.isCancelRole()) {
280:                                    LOG
281:                                            .debug("executeLogic() running cancelPendingBatch now");
282:                                    // ChangeID was previous set to BatchID
283:                                    batchMaintenanceService.cancelPendingBatch(
284:                                            pmf.getChangeId(), pmf
285:                                                    .getChangeText(),
286:                                            getUser(request));
287:                                    actionErrors
288:                                            .add(
289:                                                    "success",
290:                                                    new ActionMessage(
291:                                                            "success.paymentUpdate.saved"));
292:                                } else {
293:                                    actionErrors
294:                                            .add(
295:                                                    "error",
296:                                                    new ActionMessage(
297:                                                            "paymentMaintenanceAction.paymentUpdate.notAuthorized"));
298:                                }
299:                            } else if (action.equals("ChangeImmediate")) {
300:                                if (sr.isProcessRole()) {
301:                                    LOG
302:                                            .debug("executeLogic() running changeImmediate now");
303:                                    // ChangeID was previous set to PaymentGroupID
304:                                    paymentMaintenanceService
305:                                            .changeImmediateFlag(pmf
306:                                                    .getChangeId(), pmf
307:                                                    .getChangeText(),
308:                                                    getUser(request));
309:                                    actionErrors
310:                                            .add(
311:                                                    "success",
312:                                                    new ActionMessage(
313:                                                            "success.paymentUpdate.saved"));
314:                                } else {
315:                                    actionErrors
316:                                            .add(
317:                                                    "error",
318:                                                    new ActionMessage(
319:                                                            "paymentMaintenanceAction.paymentUpdate.notAuthorized"));
320:                                }
321:                            } else if (action.equals("DisbursementCancel")) {
322:                                if (sr.isCancelRole()) {
323:                                    LOG
324:                                            .debug("executeLogic() running disbursementCancel now");
325:                                    // ChangeID was previous set to PaymentGroupID
326:                                    paymentMaintenanceService
327:                                            .cancelDisbursement(pmf
328:                                                    .getChangeId(), pmf
329:                                                    .getPaymentDetailId(), pmf
330:                                                    .getChangeText(),
331:                                                    getUser(request));
332:                                    actionErrors
333:                                            .add(
334:                                                    "success",
335:                                                    new ActionMessage(
336:                                                            "success.paymentUpdate.saved"));
337:                                } else {
338:                                    actionErrors
339:                                            .add(
340:                                                    "error",
341:                                                    new ActionMessage(
342:                                                            "paymentMaintenanceAction.paymentUpdate.notAuthorized"));
343:                                }
344:                            } else if (action.equals("ReIssueCancel")) {
345:                                if (sr.isCancelRole()) {
346:                                    LOG
347:                                            .debug("executeLogic() running cancelReissueDisbursement now");
348:                                    // ChangeID was previous set to PaymentGroupID
349:                                    paymentMaintenanceService
350:                                            .cancelReissueDisbursement(pmf
351:                                                    .getChangeId(), pmf
352:                                                    .getChangeText(),
353:                                                    getUser(request));
354:                                    actionErrors
355:                                            .add(
356:                                                    "success",
357:                                                    new ActionMessage(
358:                                                            "success.paymentUpdate.saved"));
359:                                } else {
360:                                    actionErrors
361:                                            .add(
362:                                                    "error",
363:                                                    new ActionMessage(
364:                                                            "paymentMaintenanceAction.paymentUpdate.notAuthorized"));
365:                                }
366:                            }
367:
368:                            if (pmf.getAction() != null) {
369:                                if (pmf.getAction().indexOf("batch") >= 0) {
370:                                    forward = "batch";
371:                                } else if (pmf.getAction().indexOf("batch") < 0) {
372:                                    forward = "individual";
373:                                }
374:                            }
375:                        } else if (buttonPressed.startsWith("btnUpdateClear")) {
376:                            pmf.setChangeText(null);
377:                        } else if (buttonPressed.startsWith("btnUpdateCancel")) {
378:                            if (pmf.getAction() != null) {
379:                                LOG
380:                                        .debug("executeLogic() Form field holding Action is "
381:                                                + pmf.getAction());
382:                                LOG.debug("executeLogic() Index is "
383:                                        + pmf.getAction().indexOf("batch"));
384:                                if (pmf.getAction().indexOf("batch") >= 0) {
385:                                    forward = "batch";
386:                                } else if (pmf.getAction().indexOf("batch") < 0) {
387:                                    forward = "detail";
388:                                    // forward = "individual";
389:                                }
390:                            }
391:                        }
392:                    } else {
393:                        // Action Originated from PaymentDetail Screen
394:                        // ChangeID is set to the Payment Group ID that the payment detail belongs to
395:                        // Only Payment Groups have actions go against them... a payment detail may not be changed
396:                        // Payment Detail ID is stored for any EPIC payments/disbursements that might be cancelled
397:                        pmf.setChangeId(pd.getPaymentGroup().getId());
398:                        pmf.setPaymentDetailId(pd.getId());
399:                        if (buttonPressed.startsWith("btnCancel")) {
400:                            pmf.setAction("Cancel");
401:                        } else if (buttonPressed.startsWith("btnHold")) {
402:                            pmf.setAction("Hold");
403:                        } else if (buttonPressed.startsWith("btnRemoveHold")) {
404:                            pmf.setAction("RemoveHold");
405:                        } else if (buttonPressed
406:                                .startsWith("btnChangeImmediate")) {
407:                            pmf.setAction("ChangeImmediate");
408:                        } else if (buttonPressed.startsWith("btnReIssueCancel")) {
409:                            pmf.setAction("ReIssueCancel");
410:                        } else if (buttonPressed
411:                                .startsWith("btnDisbursementCancel")) {
412:                            pmf.setAction("DisbursementCancel");
413:                        } else {
414:                            // Invalid Button was Pressed
415:                            return mapping.findForward("pdp_system_error");
416:                        }
417:                    }
418:                }
419:
420:                // If we had errors, save them
421:                if (!actionErrors.isEmpty()) {
422:                    saveErrors(request, actionErrors);
423:                }
424:
425:                request.setAttribute("PaymentMaintenanceForm", pmf);
426:                return mapping.findForward(forward);
427:            }
428:
429:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.