Source Code Cross Referenced for SuperUserAction.java in  » ERP-CRM-Financial » Kuali-Financial-System » edu » iu » uis » eden » superuser » web » 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 » edu.iu.uis.eden.superuser.web 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2005-2006 The Kuali Foundation.
003:         * 
004:         * 
005:         * Licensed under the Educational Community License, Version 1.0 (the "License");
006:         * you may not use this file except in compliance with the License.
007:         * You may obtain a copy of the License at
008:         * 
009:         * http://www.opensource.org/licenses/ecl1.php
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:        package edu.iu.uis.eden.superuser.web;
018:
019:        import java.util.Collection;
020:        import java.util.Iterator;
021:
022:        import javax.servlet.http.HttpServletRequest;
023:        import javax.servlet.http.HttpServletResponse;
024:
025:        import org.apache.struts.action.ActionForm;
026:        import org.apache.struts.action.ActionForward;
027:        import org.apache.struts.action.ActionMapping;
028:        import org.apache.struts.action.ActionMessage;
029:        import org.apache.struts.action.ActionMessages;
030:        import org.kuali.rice.resourceloader.GlobalResourceLoader;
031:
032:        import edu.iu.uis.eden.EdenConstants;
033:        import edu.iu.uis.eden.KEWServiceLocator;
034:        import edu.iu.uis.eden.actionrequests.ActionRequestValue;
035:        import edu.iu.uis.eden.clientapp.IDocHandler;
036:        import edu.iu.uis.eden.clientapp.WorkflowDocument;
037:        import edu.iu.uis.eden.clientapp.vo.WorkflowIdVO;
038:        import edu.iu.uis.eden.plugin.attributes.WorkflowLookupable;
039:        import edu.iu.uis.eden.routeheader.DocumentRouteHeaderValue;
040:        import edu.iu.uis.eden.user.WorkflowUser;
041:        import edu.iu.uis.eden.web.WorkflowAction;
042:
043:        /**
044:         * A Struts Action which provides super user functionality.
045:         *
046:         * @author bmcgough
047:         * @author xqi
048:         * @author temay
049:         * @author rkirkend
050:         */
051:        public class SuperUserAction extends WorkflowAction {
052:            private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger
053:                    .getLogger(SuperUserAction.class);
054:            public static final String UNAUTHORIZED = "authorizationFailure";
055:
056:            //private static String DOCUMENT_TYPE = "EDENSERVICE-DOCS.WKGRPREQ";
057:
058:            public ActionForward start(ActionMapping mapping, ActionForm form,
059:                    HttpServletRequest request, HttpServletResponse response)
060:                    throws Exception {
061:                return mapping.findForward("basic");
062:            }
063:
064:            public ActionForward displaySuperUserDocument(
065:                    ActionMapping mapping, ActionForm form,
066:                    HttpServletRequest request, HttpServletResponse response)
067:                    throws Exception {
068:                SuperUserForm super UserForm = (SuperUserForm) form;
069:                super UserForm
070:                        .setDocHandlerUrl(EdenConstants.DOC_HANDLER_REDIRECT_PAGE
071:                                + "?docId="
072:                                + super UserForm.getRouteHeaderId()
073:                                + "&"
074:                                + IDocHandler.COMMAND_PARAMETER
075:                                + "="
076:                                + IDocHandler.SUPERUSER_COMMAND);
077:                return mapping.findForward("basic");
078:            }
079:
080:            public ActionForward routeLevelApprove(ActionMapping mapping,
081:                    ActionForm form, HttpServletRequest request,
082:                    HttpServletResponse response) throws Exception {
083:                LOG.info("entering routeLevelApprove()...");
084:                SuperUserForm super UserForm = (SuperUserForm) form;
085:                //SpringServiceLocator.getWorkflowDocumentService().superUserRouteLevelApproveAction(getUserSession(request).getWorkflowUser(), superUserForm.getRouteHeader(), superUserForm.getRouteLevel(), superUserForm.getAnnotation());
086:                KEWServiceLocator.getWorkflowDocumentService()
087:                        .super UserNodeApproveAction(
088:                                getUserSession(request).getWorkflowUser(),
089:                                super UserForm.getRouteHeader(),
090:                                super UserForm.getDestNodeName(),
091:                                super UserForm.getAnnotation());
092:                saveDocumentActionMessage(
093:                        "general.routing.superuser.routeLevelApproved",
094:                        request, super UserForm.getRouteHeaderIdString(), null);
095:                LOG.info("exiting routeLevelApprove()...");
096:                super UserForm.getActionRequests().clear();
097:                establishRequiredState(request, form);
098:                return mapping.findForward("basic");
099:            }
100:
101:            public ActionForward approve(ActionMapping mapping,
102:                    ActionForm form, HttpServletRequest request,
103:                    HttpServletResponse response) throws Exception {
104:                LOG.info("entering approve() ...");
105:                SuperUserForm super UserForm = (SuperUserForm) form;
106:                KEWServiceLocator.getWorkflowDocumentService()
107:                        .super UserApprove(
108:                                getUserSession(request).getWorkflowUser(),
109:                                super UserForm.getRouteHeader(),
110:                                super UserForm.getAnnotation());
111:                saveDocumentActionMessage("general.routing.superuser.approved",
112:                        request, super UserForm.getRouteHeaderIdString(), null);
113:                LOG.info("exiting approve() ...");
114:                super UserForm.getActionRequests().clear();
115:                establishRequiredState(request, form);
116:                return mapping.findForward("basic");
117:            }
118:
119:            public ActionForward disapprove(ActionMapping mapping,
120:                    ActionForm form, HttpServletRequest request,
121:                    HttpServletResponse response) throws Exception {
122:                LOG.info("entering disapprove() ...");
123:                SuperUserForm super UserForm = (SuperUserForm) form;
124:                KEWServiceLocator.getWorkflowDocumentService()
125:                        .super UserDisapproveAction(
126:                                getUserSession(request).getWorkflowUser(),
127:                                super UserForm.getRouteHeader(),
128:                                super UserForm.getAnnotation());
129:                saveDocumentActionMessage(
130:                        "general.routing.superuser.disapproved", request,
131:                        super UserForm.getRouteHeaderIdString(), null);
132:                LOG.info("exiting disapprove() ...");
133:                super UserForm.getActionRequests().clear();
134:                establishRequiredState(request, form);
135:                return mapping.findForward("basic");
136:            }
137:
138:            public ActionForward cancel(ActionMapping mapping, ActionForm form,
139:                    HttpServletRequest request, HttpServletResponse response)
140:                    throws Exception {
141:                LOG.info("entering cancel() ...");
142:                SuperUserForm super UserForm = (SuperUserForm) form;
143:                KEWServiceLocator.getWorkflowDocumentService()
144:                        .super UserCancelAction(
145:                                getUserSession(request).getWorkflowUser(),
146:                                super UserForm.getRouteHeader(),
147:                                super UserForm.getAnnotation());
148:                saveDocumentActionMessage("general.routing.superuser.canceled",
149:                        request, super UserForm.getRouteHeaderIdString(), null);
150:                LOG.info("exiting cancel() ...");
151:                super UserForm.getActionRequests().clear();
152:                establishRequiredState(request, form);
153:                return mapping.findForward("basic");
154:            }
155:
156:            public ActionForward returnToPreviousNode(ActionMapping mapping,
157:                    ActionForm form, HttpServletRequest request,
158:                    HttpServletResponse response) throws Exception {
159:                LOG.info("entering returnToPreviousNode() ...");
160:                SuperUserForm super UserForm = (SuperUserForm) form;
161:                KEWServiceLocator.getWorkflowDocumentService()
162:                        .super UserReturnDocumentToPreviousNode(
163:                                getUserSession(request).getWorkflowUser(),
164:                                super UserForm.getRouteHeaderId(),
165:                                super UserForm.getReturnDestNodeName(),
166:                                super UserForm.getAnnotation());
167:                saveDocumentActionMessage(
168:                        "general.routing.returnedToPreviousNode", request,
169:                        "document", super UserForm.getReturnDestNodeName()
170:                                .toString());
171:                LOG.info("exiting returnToPreviousRouteLevel() ...");
172:                super UserForm.getActionRequests().clear();
173:                establishRequiredState(request, form);
174:                return mapping.findForward("basic");
175:            }
176:
177:            public ActionForward actionRequestApprove(ActionMapping mapping,
178:                    ActionForm form, HttpServletRequest request,
179:                    HttpServletResponse response) throws Exception {
180:                LOG.info("entering actionRequestApprove() ...");
181:                SuperUserForm super UserForm = (SuperUserForm) form;
182:                LOG.debug("Routing super user action request approve action");
183:                KEWServiceLocator.getWorkflowDocumentService()
184:                        .super UserActionRequestApproveAction(
185:                                getUserSession(request).getWorkflowUser(),
186:                                super UserForm.getRouteHeader(),
187:                                new Long(super UserForm
188:                                        .getActionTakenActionRequestId()),
189:                                super UserForm.getAnnotation());
190:                String messageString;
191:                String actionReqest = (String) request
192:                        .getParameter("buttonClick");
193:                if (actionReqest.equalsIgnoreCase("acknowlege")) {
194:                    messageString = "general.routing.superuser.actionRequestAcknowleged";
195:                } else if (actionReqest.equalsIgnoreCase("FYI")) {
196:                    messageString = "general.routing.superuser.actionRequestFYI";
197:                } else if (actionReqest.equalsIgnoreCase("complete")) {
198:                    messageString = "general.routing.superuser.actionRequestCompleted";
199:                } else if (actionReqest.equalsIgnoreCase("approved")) {
200:                    messageString = "general.routing.superuser.actionRequestApproved";
201:                } else {
202:                    messageString = "general.routing.superuser.actionRequestApproved";
203:                }
204:                saveDocumentActionMessage(messageString, request, super UserForm
205:                        .getRouteHeaderIdString(), super UserForm
206:                        .getActionTakenActionRequestId());
207:                LOG.info("exiting actionRequestApprove() ...");
208:                super UserForm.getActionRequests().clear();
209:                establishRequiredState(request, form);
210:                return mapping.findForward("basic");
211:            }
212:
213:            public ActionMessages establishRequiredState(
214:                    HttpServletRequest request, ActionForm form)
215:                    throws Exception {
216:                SuperUserForm super UserForm = (SuperUserForm) form;
217:                DocumentRouteHeaderValue routeHeader = KEWServiceLocator
218:                        .getRouteHeaderService().getRouteHeader(
219:                                super UserForm.getRouteHeaderId());
220:                super UserForm.setRouteHeader(routeHeader);
221:                WorkflowUser user = getUserSession(request).getWorkflowUser();
222:                boolean isAuthorized = routeHeader.getDocumentType()
223:                        .isSuperUser(user);
224:                super UserForm.setAuthorized(isAuthorized);
225:                if (!isAuthorized) {
226:                    saveDocumentActionMessage(
227:                            "general.routing.superuser.notAuthorized", request,
228:                            super UserForm.getRouteHeaderIdString(), null);
229:                    return null;
230:                }
231:
232:                super UserForm.setFutureNodeNames(KEWServiceLocator
233:                        .getRouteNodeService().findFutureNodeNames(
234:                                routeHeader.getRouteHeaderId()));
235:
236:                Collection actionRequests = KEWServiceLocator
237:                        .getActionRequestService().findPendingByDoc(
238:                                routeHeader.getRouteHeaderId());
239:                Iterator requestIterator = actionRequests.iterator();
240:                while (requestIterator.hasNext()) {
241:                    ActionRequestValue req = (ActionRequestValue) requestIterator
242:                            .next();
243:                    // if (EdenConstants.ACTION_REQUEST_APPROVE_REQ.equalsIgnoreCase(req.getActionRequested())) {
244:                    super UserForm.getActionRequests().add(req);
245:                    // }
246:                }
247:
248:                super UserForm.setDocId(super UserForm.getRouteHeaderId());
249:                if (super UserForm.getDocId() != null) {
250:                    super UserForm.setFlexDoc(new WorkflowDocument(
251:                            new WorkflowIdVO(getUserSession(request)
252:                                    .getWorkflowUser().getWorkflowId()),
253:                            super UserForm.getDocId()));
254:                    super UserForm.establishVisibleActionRequestCds();
255:                }
256:
257:                return null;
258:            }
259:
260:            public void saveDocumentActionMessage(String messageKey,
261:                    HttpServletRequest request, String subVariable1,
262:                    String subVariable2) {
263:                ActionMessages messages = new ActionMessages();
264:                ActionMessage actionMessage = null;
265:                if (subVariable2 == null) {
266:                    actionMessage = new ActionMessage(messageKey, subVariable1);
267:                } else {
268:                    actionMessage = new ActionMessage(messageKey, subVariable1,
269:                            subVariable2);
270:                }
271:                messages.add(ActionMessages.GLOBAL_MESSAGE, actionMessage);
272:                saveMessages(request, messages);
273:            }
274:
275:            public ActionForward performLookup(ActionMapping mapping,
276:                    ActionForm form, HttpServletRequest request,
277:                    HttpServletResponse response) throws Exception {
278:                SuperUserForm super UserForm = (SuperUserForm) form;
279:
280:                String basePath = request.getScheme() + "://"
281:                        + request.getServerName() + ":"
282:                        + request.getServerPort() + request.getContextPath()
283:                        + mapping.getModuleConfig().getPrefix();
284:                StringBuffer lookupUrl = new StringBuffer(basePath);
285:                lookupUrl.append("/Lookup.do?methodToCall=start&docFormKey=")
286:                        .append(getUserSession(request).addObject(form))
287:                        .append("&lookupableImplServiceName=");
288:                lookupUrl.append(request
289:                        .getParameter("lookupableImplServiceName"));
290:
291:                String lookupType = super UserForm.getLookupType();
292:                super UserForm.setLookupType(null);
293:
294:                if (lookupType != null && !lookupType.equals("")) {
295:                    lookupUrl.append("&conversionFields=");
296:                    WorkflowLookupable workflowLookupable = (WorkflowLookupable) GlobalResourceLoader
297:                            .getService(request
298:                                    .getParameter("lookupableImplServiceName"));//SpringServiceLocator.getExtensionService().getLookupable(request.getParameter("lookupableImplServiceName"));
299:                    for (Iterator iterator = workflowLookupable
300:                            .getDefaultReturnType().iterator(); iterator
301:                            .hasNext();) {
302:                        String returnType = (String) iterator.next();
303:                        lookupUrl.append(returnType).append(":").append(
304:                                lookupType);
305:                    }
306:                }
307:
308:                lookupUrl.append("&returnLocation=").append(basePath).append(
309:                        mapping.getPath()).append(".do");
310:                return new ActionForward(lookupUrl.toString(), true);
311:            }
312:
313:            public ActionForward routeToAppSpecificRecipient(
314:                    ActionMapping mapping, ActionForm form,
315:                    HttpServletRequest request, HttpServletResponse response)
316:                    throws Exception {
317:                SuperUserForm super UserForm = (SuperUserForm) form;
318:                super.routeToAppSpecificRecipient(mapping, form, request,
319:                        response);
320:                superUserForm.getActionRequests().clear();
321:                establishRequiredState(request, form);
322:                return start(mapping, form, request, response);
323:            }
324:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.