Source Code Cross Referenced for RuleQuickLinksAction.java in  » ERP-CRM-Financial » Kuali-Financial-System » edu » iu » uis » eden » routetemplate » 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.routetemplate.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.routetemplate.web;
018:
019:        import java.util.ArrayList;
020:        import java.util.HashMap;
021:        import java.util.Iterator;
022:        import java.util.List;
023:
024:        import javax.servlet.http.HttpServletRequest;
025:        import javax.servlet.http.HttpServletResponse;
026:
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.ActionMessages;
031:
032:        import edu.iu.uis.eden.KEWServiceLocator;
033:        import edu.iu.uis.eden.doctype.DocumentType;
034:        import edu.iu.uis.eden.doctype.DocumentTypeService;
035:        import edu.iu.uis.eden.engine.node.RouteNode;
036:        import edu.iu.uis.eden.routetemplate.RuleBaseValues;
037:        import edu.iu.uis.eden.routetemplate.RuleService;
038:        import edu.iu.uis.eden.routetemplate.RuleTemplate;
039:        import edu.iu.uis.eden.routetemplate.RuleTemplateService;
040:        import edu.iu.uis.eden.web.WorkflowAction;
041:
042:        /**
043:         * A Struts Action for building and interacting with the Rule Quick Links.
044:         *
045:         * @author rkirkend
046:         */
047:        public class RuleQuickLinksAction extends WorkflowAction {
048:
049:            public ActionForward start(ActionMapping mapping, ActionForm form,
050:                    HttpServletRequest request, HttpServletResponse response)
051:                    throws Exception {
052:                makeLookupPathParam(mapping, request);
053:                return mapping.findForward("basic");
054:            }
055:
056:            public ActionMessages establishRequiredState(
057:                    HttpServletRequest request, ActionForm form)
058:                    throws Exception {
059:                RuleQuickLinksForm qlForm = (RuleQuickLinksForm) form;
060:                List documentTypes;
061:                if (qlForm.getRootDocTypeName() != null) {
062:                    documentTypes = new ArrayList();
063:                    DocumentType docType = getDocumentTypeService().findByName(
064:                            qlForm.getRootDocTypeName());
065:                    documentTypes.add(docType);
066:                    request.setAttribute("renderOpened", Boolean.TRUE);
067:                } else {
068:                    documentTypes = getDocumentTypeService()
069:                            .findAllCurrentRootDocuments();
070:                }
071:                qlForm
072:                        .setDocumentTypeQuickLinksStructures(getDocumentTypeDataStructure(documentTypes));
073:
074:                return null;
075:            }
076:
077:            public ActionForward addDelegationRule(ActionMapping mapping,
078:                    ActionForm form, HttpServletRequest request,
079:                    HttpServletResponse response) throws Exception {
080:                Long ruleTemplateId = new Long(request
081:                        .getParameter("ruleTemplate.ruleTemplateId"));
082:                String docTypeName = request.getParameter("docTypeFullName");
083:                List rules = getRuleService().search(docTypeName, null,
084:                        ruleTemplateId, "", null, null, "", Boolean.FALSE,
085:                        Boolean.TRUE, new HashMap());
086:                if (rules.size() == 1) {
087:                    RuleBaseValues rule = (RuleBaseValues) rules.get(0);
088:                    RuleTemplate ruleTemplate = getRuleTemplateService()
089:                            .findByRuleTemplateId(ruleTemplateId);
090:                    String url = "DelegateRule.do?methodToCall=start"
091:                            + "&parentRule.getDocTypeName=" + docTypeName
092:                            + "&ruleCreationValues.ruleTemplateId="
093:                            + ruleTemplate.getDelegationTemplateId()
094:                            + "&ruleCreationValues.ruleTemplateName="
095:                            + ruleTemplate.getDelegationTemplate().getName()
096:                            + "&ruleCreationValues.ruleId="
097:                            + rule.getRuleBaseValuesId();
098:                    return new ActionForward(url, true);
099:                }
100:                makeLookupPathParam(mapping, request);
101:                return new ActionForward("Lookup.do?"
102:                        + stripMethodToCall(request.getQueryString()), true);
103:            }
104:
105:            private List getDocumentTypeDataStructure(List rootDocuments) {
106:                List documentTypeQuickLinksStructures = new ArrayList();
107:                for (Iterator iter = rootDocuments.iterator(); iter.hasNext();) {
108:                    DocumentTypeQuickLinksStructure quickLinkStruct = new DocumentTypeQuickLinksStructure(
109:                            (DocumentType) iter.next());
110:                    if (!quickLinkStruct.getFlattenedNodes().isEmpty()
111:                            || !quickLinkStruct.getChildrenDocumentTypes()
112:                                    .isEmpty()) {
113:                        documentTypeQuickLinksStructures.add(quickLinkStruct);
114:                    }
115:
116:                }
117:
118:                return documentTypeQuickLinksStructures;
119:            }
120:
121:            /**
122:             * A bean to hold a DocumentType with its flattened nodes for rendering purposes 
123:             * on the quick links.
124:             * 
125:             * @author rkirkend
126:             */
127:            public static class DocumentTypeQuickLinksStructure {
128:                private DocumentType documentType;
129:                private List flattenedNodes = new ArrayList();
130:                private List childrenDocumentTypes = new ArrayList();
131:
132:                private DocumentTypeQuickLinksStructure(
133:                        DocumentType documentType) {
134:                    this .documentType = documentType;
135:                    List tempFlattendNodes = KEWServiceLocator
136:                            .getRouteNodeService().getFlattenedNodes(
137:                                    documentType, true);
138:                    for (Iterator iter = tempFlattendNodes.iterator(); iter
139:                            .hasNext();) {
140:                        RouteNode routeNode = (RouteNode) iter.next();
141:                        if (routeNode.isFlexRM()) {
142:                            flattenedNodes.add(routeNode);
143:                        }
144:                    }
145:                    for (Iterator iter = documentType.getChildrenDocTypes()
146:                            .iterator(); iter.hasNext();) {
147:                        childrenDocumentTypes
148:                                .add(new DocumentTypeQuickLinksStructure(
149:                                        (DocumentType) iter.next()));
150:                    }
151:                }
152:
153:                public List getChildrenDocumentTypes() {
154:                    return childrenDocumentTypes;
155:                }
156:
157:                public void setChildrenDocumentTypes(List childrenDocumentTypes) {
158:                    this .childrenDocumentTypes = childrenDocumentTypes;
159:                }
160:
161:                public DocumentType getDocumentType() {
162:                    return documentType;
163:                }
164:
165:                public void setDocumentType(DocumentType documentType) {
166:                    this .documentType = documentType;
167:                }
168:
169:                public List getFlattenedNodes() {
170:                    return flattenedNodes;
171:                }
172:
173:                public void setFlattenedNodes(List flattenedNodes) {
174:                    this .flattenedNodes = flattenedNodes;
175:                }
176:            }
177:
178:            private void makeLookupPathParam(ActionMapping mapping,
179:                    HttpServletRequest request) {
180:                String basePath = request.getScheme() + "://"
181:                        + request.getServerName() + ":"
182:                        + request.getServerPort() + request.getContextPath()
183:                        + mapping.getModuleConfig().getPrefix();
184:                request.setAttribute("basePath", basePath);
185:            }
186:
187:            private String stripMethodToCall(String queryString) {
188:                return queryString.replaceAll(
189:                        "methodToCall=addDelegationRule&", "");
190:            }
191:
192:            private DocumentTypeService getDocumentTypeService() {
193:                return KEWServiceLocator.getDocumentTypeService();
194:            }
195:
196:            private RuleService getRuleService() {
197:                return KEWServiceLocator.getRuleService();
198:            }
199:
200:            private RuleTemplateService getRuleTemplateService() {
201:                return KEWServiceLocator.getRuleTemplateService();
202:            }
203:
204:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.