Source Code Cross Referenced for KualiBalanceInquiryReportMenuAction.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » kfs » 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.kfs.web.struts.action 
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:        package org.kuali.kfs.web.struts.action;
017:
018:        import java.util.Properties;
019:
020:        import javax.servlet.http.HttpServletRequest;
021:        import javax.servlet.http.HttpServletResponse;
022:
023:        import org.apache.commons.lang.StringUtils;
024:        import org.apache.struts.action.ActionForm;
025:        import org.apache.struts.action.ActionForward;
026:        import org.apache.struts.action.ActionMapping;
027:        import org.kuali.core.util.GlobalVariables;
028:        import org.kuali.core.util.UrlFactory;
029:        import org.kuali.core.web.struts.action.KualiAction;
030:        import org.kuali.core.web.struts.form.KualiForm;
031:        import org.kuali.kfs.KFSConstants;
032:        import org.kuali.kfs.web.struts.form.KualiBalanceInquiryReportMenuForm;
033:
034:        /**
035:         * This class handles Actions for the balance inquiry report menu
036:         */
037:        public class KualiBalanceInquiryReportMenuAction extends KualiAction {
038:            private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger
039:                    .getLogger(KualiBalanceInquiryReportMenuAction.class);
040:
041:            /**
042:             * Entry point to balance inquiry menu, forwards to jsp for rendering.
043:             * 
044:             * @param mapping
045:             * @param form
046:             * @param request
047:             * @param response
048:             * @return ActionForward
049:             * @throws Exception
050:             */
051:            public ActionForward start(ActionMapping mapping, ActionForm form,
052:                    HttpServletRequest request, HttpServletResponse response)
053:                    throws Exception {
054:                return mapping.findForward(KFSConstants.MAPPING_BASIC);
055:            }
056:
057:            /**
058:             * Returns back to calling document.
059:             * 
060:             * @param mapping
061:             * @param form
062:             * @param request
063:             * @param response
064:             * @return ActionForward
065:             * @throws Exception
066:             */
067:            public ActionForward cancel(ActionMapping mapping, ActionForm form,
068:                    HttpServletRequest request, HttpServletResponse response)
069:                    throws Exception {
070:                KualiBalanceInquiryReportMenuForm balanceInquiryReportMenuForm = (KualiBalanceInquiryReportMenuForm) form;
071:
072:                String backUrl = balanceInquiryReportMenuForm.getBackLocation()
073:                        + "?methodToCall=refresh&docFormKey="
074:                        + balanceInquiryReportMenuForm.getDocFormKey();
075:                return new ActionForward(backUrl, true);
076:            }
077:
078:            /**
079:             * Needs to overrided to inject the real value into the docFormKey b/c otherwise the lookup's refresh back to this menu
080:             * overwrites the original value that we actually need. It too leverages the docFormKey.
081:             * 
082:             * @param mapping
083:             * @param form
084:             * @param request
085:             * @param response
086:             * @return ActionForward
087:             * @throws Exception
088:             */
089:            public ActionForward refresh(ActionMapping mapping,
090:                    ActionForm form, HttpServletRequest request,
091:                    HttpServletResponse response) throws Exception {
092:                KualiBalanceInquiryReportMenuForm balanceInquiryReportMenuForm = (KualiBalanceInquiryReportMenuForm) form;
093:
094:                // need to inject the real value into the docFormKey b/c otherwise the lookup's refresh back to this menu overwrites
095:                // the original value that we actually need.
096:                balanceInquiryReportMenuForm
097:                        .setDocFormKey(balanceInquiryReportMenuForm
098:                                .getBalanceInquiryReportMenuCallerDocFormKey());
099:
100:                return mapping.findForward(KFSConstants.MAPPING_BASIC);
101:            }
102:
103:            /**
104:             * Takes care of storing the action form in the user session and forwarding to the balance inquiry lookup action.
105:             * 
106:             * @param mapping
107:             * @param form
108:             * @param request
109:             * @param response
110:             * @return ActionForward
111:             * @throws Exception
112:             */
113:            public ActionForward performBalanceInquiryLookup(
114:                    ActionMapping mapping, ActionForm form,
115:                    HttpServletRequest request, HttpServletResponse response)
116:                    throws Exception {
117:                String basePath = request.getScheme() + "://"
118:                        + request.getServerName() + ":"
119:                        + request.getServerPort() + request.getContextPath();
120:
121:                // parse out the important strings from our methodToCall parameter
122:                String fullParameter = (String) request
123:                        .getAttribute(KFSConstants.METHOD_TO_CALL_ATTRIBUTE);
124:
125:                // parse out business object class name for lookup
126:                String boClassName = StringUtils.substringBetween(
127:                        fullParameter,
128:                        KFSConstants.METHOD_TO_CALL_BOPARM_LEFT_DEL,
129:                        KFSConstants.METHOD_TO_CALL_BOPARM_RIGHT_DEL);
130:                if (StringUtils.isBlank(boClassName)) {
131:                    throw new RuntimeException(
132:                            "Illegal call to perform lookup, no business object class name specified.");
133:                }
134:
135:                // build the parameters for the lookup url
136:                Properties parameters = new Properties();
137:                String conversionFields = StringUtils.substringBetween(
138:                        fullParameter,
139:                        KFSConstants.METHOD_TO_CALL_PARM1_LEFT_DEL,
140:                        KFSConstants.METHOD_TO_CALL_PARM1_RIGHT_DEL);
141:                if (StringUtils.isNotBlank(conversionFields)) {
142:                    parameters.put(KFSConstants.CONVERSION_FIELDS_PARAMETER,
143:                            conversionFields);
144:                }
145:
146:                // pass values from form that should be pre-populated on lookup search
147:                String parameterFields = StringUtils.substringBetween(
148:                        fullParameter,
149:                        KFSConstants.METHOD_TO_CALL_PARM2_LEFT_DEL,
150:                        KFSConstants.METHOD_TO_CALL_PARM2_RIGHT_DEL);
151:                if (StringUtils.isNotBlank(parameterFields)) {
152:                    String[] lookupParams = parameterFields
153:                            .split(KFSConstants.FIELD_CONVERSIONS_SEPERATOR);
154:
155:                    for (int i = 0; i < lookupParams.length; i++) {
156:                        String[] keyValue = lookupParams[i]
157:                                .split(KFSConstants.FIELD_CONVERSION_PAIR_SEPERATOR);
158:
159:                        // hard-coded passed value
160:                        if (StringUtils.contains(keyValue[0], "'")) {
161:                            parameters.put(keyValue[1], StringUtils.replace(
162:                                    keyValue[0], "'", ""));
163:                        }
164:                        // passed value should come from property
165:                        else if (StringUtils.isNotBlank(request
166:                                .getParameter(keyValue[0]))) {
167:                            parameters.put(keyValue[1], request
168:                                    .getParameter(keyValue[0]));
169:                        }
170:                    }
171:                }
172:
173:                // grab whether or not the "return value" link should be hidden or not
174:                String hideReturnLink = StringUtils.substringBetween(
175:                        fullParameter,
176:                        KFSConstants.METHOD_TO_CALL_PARM3_LEFT_DEL,
177:                        KFSConstants.METHOD_TO_CALL_PARM3_RIGHT_DEL);
178:                if (StringUtils.isNotBlank(hideReturnLink)) {
179:                    parameters.put(KFSConstants.HIDE_LOOKUP_RETURN_LINK,
180:                            hideReturnLink);
181:                }
182:
183:                System.out.println("Setting the anchor to "
184:                        + ((KualiForm) form).getAnchor());
185:                // anchor, if it exists
186:                if (form instanceof  KualiForm
187:                        && StringUtils.isNotEmpty(((KualiForm) form)
188:                                .getAnchor())) {
189:                    parameters.put(KFSConstants.LOOKUP_ANCHOR,
190:                            ((KualiForm) form).getAnchor());
191:                }
192:
193:                // determine what the action path is
194:                String actionPath = StringUtils.substringBetween(fullParameter,
195:                        KFSConstants.METHOD_TO_CALL_PARM4_LEFT_DEL,
196:                        KFSConstants.METHOD_TO_CALL_PARM4_RIGHT_DEL);
197:                if (StringUtils.isBlank(actionPath)) {
198:                    throw new IllegalStateException(
199:                            "The \"actionPath\" attribute is an expected parameter for the <gl:balanceInquiryLookup> tag - it "
200:                                    + "should never be blank.");
201:                }
202:
203:                // now add required parameters
204:                parameters
205:                        .put(KFSConstants.DISPATCH_REQUEST_PARAMETER, "start");
206:                parameters.put(KFSConstants.DOC_FORM_KEY, GlobalVariables
207:                        .getUserSession().addObject(form));
208:                parameters.put(KFSConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE,
209:                        boClassName);
210:                parameters.put(KFSConstants.RETURN_LOCATION_PARAMETER, basePath
211:                        + mapping.getPath() + ".do");
212:
213:                String lookupUrl = UrlFactory.parameterizeUrl(basePath + "/"
214:                        + actionPath, parameters);
215:
216:                return new ActionForward(lookupUrl, true);
217:            }
218:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.