Source Code Cross Referenced for ProcurementCardAction.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » module » financial » web » struts » action » 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.financial.web.struts.action 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2006-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:        package org.kuali.module.financial.web.struts.action;
017:
018:        import javax.servlet.http.HttpServletRequest;
019:        import javax.servlet.http.HttpServletResponse;
020:
021:        import org.apache.struts.action.ActionForm;
022:        import org.apache.struts.action.ActionForward;
023:        import org.apache.struts.action.ActionMapping;
024:        import org.kuali.core.service.KualiRuleService;
025:        import org.kuali.core.service.PersistenceService;
026:        import org.kuali.core.util.TypedArrayList;
027:        import org.kuali.kfs.KFSConstants;
028:        import org.kuali.kfs.bo.AccountingLine;
029:        import org.kuali.kfs.bo.TargetAccountingLine;
030:        import org.kuali.kfs.context.SpringContext;
031:        import org.kuali.kfs.document.AccountingDocument;
032:        import org.kuali.kfs.rule.event.AddAccountingLineEvent;
033:        import org.kuali.kfs.web.struts.action.KualiAccountingDocumentActionBase;
034:        import org.kuali.kfs.web.struts.form.KualiAccountingDocumentFormBase;
035:        import org.kuali.kfs.web.ui.AccountingLineDecorator;
036:        import org.kuali.module.financial.bo.ProcurementCardTargetAccountingLine;
037:        import org.kuali.module.financial.document.ProcurementCardDocument;
038:        import org.kuali.module.financial.web.struts.form.ProcurementCardForm;
039:
040:        /**
041:         * This class handles specific Actions requests for the ProcurementCard.
042:         */
043:        public class ProcurementCardAction extends
044:                KualiAccountingDocumentActionBase {
045:            private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
046:                    .getLogger(ProcurementCardAction.class);
047:
048:            /**
049:             * Override to accomodate multiple target lines.
050:             * 
051:             * @param transForm
052:             */
053:            @Override
054:            protected void processAccountingLineOverrides(
055:                    KualiAccountingDocumentFormBase transForm) {
056:                ProcurementCardForm procurementCardForm = (ProcurementCardForm) transForm;
057:
058:                processAccountingLineOverrides(procurementCardForm
059:                        .getNewSourceLine());
060:                processAccountingLineOverrides(procurementCardForm
061:                        .getNewTargetLines());
062:                if (procurementCardForm.hasDocumentId()) {
063:                    AccountingDocument financialDocument = (AccountingDocument) procurementCardForm
064:                            .getDocument();
065:
066:                    processAccountingLineOverrides(financialDocument
067:                            .getSourceAccountingLines());
068:                    processAccountingLineOverrides(financialDocument
069:                            .getTargetAccountingLines());
070:                }
071:            }
072:
073:            /**
074:             * Override to add the new accounting line to the correct transaction
075:             * 
076:             * @see org.kuali.module.financial.web.struts.action.KualiFinancialDocumentActionBase#insertTargetLine(org.apache.struts.action.ActionMapping,
077:             *      org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
078:             */
079:            @Override
080:            public ActionForward insertTargetLine(ActionMapping mapping,
081:                    ActionForm form, HttpServletRequest request,
082:                    HttpServletResponse response) throws Exception {
083:                ProcurementCardForm procurementCardForm = (ProcurementCardForm) form;
084:
085:                // get index of new target line
086:                int newTargetIndex = super .getSelectedLine(request);
087:
088:                ProcurementCardTargetAccountingLine line = (ProcurementCardTargetAccountingLine) procurementCardForm
089:                        .getNewTargetLines().get(newTargetIndex);
090:
091:                // check any business rules
092:                boolean rulePassed = SpringContext
093:                        .getBean(KualiRuleService.class)
094:                        .applyRules(
095:                                new AddAccountingLineEvent(
096:                                        KFSConstants.NEW_TARGET_ACCT_LINES_PROPERTY_NAME
097:                                                + "["
098:                                                + Integer
099:                                                        .toString(newTargetIndex)
100:                                                + "]", procurementCardForm
101:                                                .getDocument(),
102:                                        (AccountingLine) line));
103:
104:                if (rulePassed) {
105:                    // add accountingLine
106:                    SpringContext.getBean(PersistenceService.class)
107:                            .retrieveNonKeyFields(line);
108:                    insertAccountingLine(false, procurementCardForm, line);
109:
110:                    // clear the used newTargetIndex
111:                    procurementCardForm.getNewTargetLines().set(newTargetIndex,
112:                            new ProcurementCardTargetAccountingLine());
113:                }
114:
115:                return mapping.findForward(KFSConstants.MAPPING_BASIC);
116:            }
117:
118:            /**
119:             * Override to resync base accounting lines. New lines on the PCDO document can be inserted anywhere in the list, not necessary
120:             * at the end.
121:             * 
122:             * @see org.kuali.module.financial.web.struts.action.KualiFinancialDocumentActionBase#insertAccountingLine(boolean,
123:             *      org.kuali.module.financial.web.struts.form.KualiFinancialDocumentFormBase, org.kuali.core.bo.AccountingLine)
124:             */
125:            @Override
126:            protected void insertAccountingLine(boolean isSource,
127:                    KualiAccountingDocumentFormBase financialDocumentForm,
128:                    AccountingLine line) {
129:                AccountingDocument tdoc = financialDocumentForm
130:                        .getFinancialDocument();
131:
132:                // create and init a decorator
133:                AccountingLineDecorator decorator = new AccountingLineDecorator();
134:                decorator.setRevertible(false);
135:
136:                // add it to the document
137:                tdoc.addTargetAccountingLine((TargetAccountingLine) line);
138:
139:                // get the index of the inserted line
140:                int newLineIndex = tdoc.getTargetAccountingLines()
141:                        .indexOf(line);
142:
143:                // add it to the baseline, to prevent generation of spurious update events
144:                financialDocumentForm.getBaselineTargetAccountingLines().add(
145:                        newLineIndex, line);
146:
147:                // add the decorator
148:                financialDocumentForm.getTargetLineDecorators().add(
149:                        newLineIndex, decorator);
150:            }
151:
152:            /**
153:             * Override to remove the accounting line from the correct transaction
154:             * 
155:             * @see org.kuali.module.financial.web.struts.action.KualiFinancialDocumentActionBase#deleteAccountingLine(boolean,
156:             *      org.kuali.module.financial.web.struts.form.KualiFinancialDocumentFormBase, int)
157:             */
158:            @Override
159:            protected void deleteAccountingLine(boolean isSource,
160:                    KualiAccountingDocumentFormBase financialDocumentForm,
161:                    int deleteIndex) {
162:                ProcurementCardDocument procurementCardDocument = (ProcurementCardDocument) financialDocumentForm
163:                        .getDocument();
164:                procurementCardDocument.removeTargetAccountingLine(deleteIndex);
165:
166:                // remove baseline duplicate and decorator
167:                financialDocumentForm.getBaselineTargetAccountingLines()
168:                        .remove(deleteIndex);
169:                financialDocumentForm.getTargetLineDecorators().remove(
170:                        deleteIndex);
171:            }
172:
173:            /**
174:             * Ensures that ProcurementCardForm.newTargetLines is cleared. Otherwise works like super.reload.
175:             * 
176:             * @see org.kuali.core.web.struts.action.KualiDocumentActionBase#reload(org.apache.struts.action.ActionMapping,
177:             *      org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
178:             */
179:            @Override
180:            public ActionForward reload(ActionMapping mapping, ActionForm form,
181:                    HttpServletRequest request, HttpServletResponse response)
182:                    throws Exception {
183:                ProcurementCardForm procurementCardForm = (ProcurementCardForm) form;
184:                procurementCardForm.setNewTargetLines(new TypedArrayList(
185:                        ProcurementCardTargetAccountingLine.class));
186:
187:                return super.reload(mapping, procurementCardForm, request,
188:                        response);
189:            }
190:        }
w__w_w.__ja___v_a2___s.___c__o___m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.