Source Code Cross Referenced for WorkflowDocumentActions.java in  » ERP-CRM-Financial » Kuali-Financial-System » edu » iu » uis » eden » edl » components » 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.edl.components 
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.edl.components;
018:
019:        import org.apache.log4j.Logger;
020:        import org.w3c.dom.Document;
021:        import org.w3c.dom.Element;
022:
023:        import edu.iu.uis.eden.clientapp.WorkflowDocument;
024:        import edu.iu.uis.eden.clientapp.vo.NetworkIdVO;
025:        import edu.iu.uis.eden.edl.EDLContext;
026:        import edu.iu.uis.eden.edl.EDLModelComponent;
027:        import edu.iu.uis.eden.edl.EDLXmlUtils;
028:        import edu.iu.uis.eden.edl.RequestParser;
029:        import edu.iu.uis.eden.exception.WorkflowException;
030:        import edu.iu.uis.eden.exception.WorkflowRuntimeException;
031:        import edu.iu.uis.eden.util.XmlHelper;
032:
033:        /**
034:         * Used as a pre processor and post processor.  
035:         * As a pre processor this creates/fetches the workflow document and sets it on request.
036:         * As a post processor this takes appropriate user action on the document if the document is not in error.  
037:         * 
038:         * @author rkirkend
039:         * @author ahamid
040:         *  
041:         */
042:        public class WorkflowDocumentActions implements  EDLModelComponent {
043:
044:            private static final Logger LOG = Logger
045:                    .getLogger(WorkflowDocumentActions.class);
046:
047:            public static final String USER_ACTION_REQUEST_KEY = "userAction";
048:            public static final String ACTION_CREATE = "initiate";
049:            public static final String RETRIEVE = "retrieve";
050:            public static final String ACTION_ROUTE = "route";
051:            public static final String ACTION_APPROVE = "approve";
052:            public static final String ACTION_DISAPPROVE = "disapprove";
053:            public static final String ACTION_CANCEL = "cancel";
054:            public static final String ACTION_BLANKETAPPROVE = "blanketApprove";
055:            public static final String ACTION_FYI = "fyi";
056:            public static final String ACTION_ACKNOWLEDGE = "acknowledge";
057:            public static final String ACTION_SAVE = "save";
058:            public static final String ACTION_COMPLETE = "complete";
059:            public static final String ACTION_DELETE = "delete";
060:            public static final String ACTION_RETURN_TO_PREVIOUS = "returnToPrevious";
061:
062:            boolean isPreProcessor;
063:
064:            public void updateDOM(Document dom, Element configElement,
065:                    EDLContext edlContext) {
066:
067:                try {
068:                    isPreProcessor = configElement.getTagName().equals(
069:                            "preProcessor");
070:                    if (isPreProcessor) {
071:                        doPreProcessWork(edlContext);
072:                    } else {
073:                        doPostProcessWork(dom, edlContext);
074:                    }
075:                } catch (Exception e) {
076:                    throw new WorkflowRuntimeException(e);
077:                }
078:
079:            }
080:
081:            private void doPreProcessWork(EDLContext edlContext)
082:                    throws Exception {
083:                RequestParser requestParser = edlContext.getRequestParser();
084:                String userAction = requestParser
085:                        .getParameterValue(USER_ACTION_REQUEST_KEY);
086:                if (userAction == null) {
087:                    userAction = requestParser.getParameterValue("command");//'WorkflowQuicklinks'
088:                }
089:
090:                WorkflowDocument document = null;
091:                if (ACTION_CREATE.equals(userAction)) {
092:                    document = new WorkflowDocument(new NetworkIdVO(edlContext
093:                            .getUserSession().getNetworkId()), edlContext
094:                            .getEdocLiteAssociation().getEdlName());
095:                    document.setTitle("Routing Document Type '"
096:                            + document.getDocumentType() + "'");
097:                    document.getRouteHeaderId();
098:                    LOG.info("Created document " + document.getRouteHeaderId());
099:                } else {
100:                    document = (WorkflowDocument) requestParser
101:                            .getAttribute(RequestParser.WORKFLOW_DOCUMENT_SESSION_KEY);
102:                    if (document == null) {
103:                        String docId = requestParser.getParameterValue("docId");
104:                        if (docId == null) {
105:                            LOG.info("no document found for edl "
106:                                    + edlContext.getEdocLiteAssociation()
107:                                            .getEdlName());
108:                            return;
109:                        } else {
110:                            document = new WorkflowDocument(
111:                                    new NetworkIdVO(edlContext.getUserSession()
112:                                            .getNetworkId()), new Long(docId));
113:                        }
114:                    }
115:                }
116:
117:                requestParser.setAttribute(
118:                        RequestParser.WORKFLOW_DOCUMENT_SESSION_KEY, document);
119:            }
120:
121:            private void doPostProcessWork(Document dom, EDLContext edlContext)
122:                    throws Exception {
123:                RequestParser requestParser = edlContext.getRequestParser();
124:                // if the document is in error then we don't want to execute the action!
125:                if (edlContext.isInError()) {
126:                    return;
127:                }
128:                WorkflowDocument document = (WorkflowDocument) edlContext
129:                        .getRequestParser().getAttribute(
130:                                RequestParser.WORKFLOW_DOCUMENT_SESSION_KEY);
131:                if (document == null) {
132:                    return;
133:                }
134:                //strip out the data element
135:                Element dataElement = (Element) dom.getElementsByTagName(
136:                        EDLXmlUtils.DATA_E).item(0);
137:                String docContent = XmlHelper.writeNode(dataElement);//use the transformer on edlcontext
138:                document.setApplicationContent(docContent);
139:                takeAction(document, requestParser);
140:            }
141:
142:            public static void takeAction(WorkflowDocument document,
143:                    RequestParser requestParser) throws WorkflowException {
144:
145:                String annotation = requestParser
146:                        .getParameterValue("annotation");
147:                String action = requestParser
148:                        .getParameterValue(USER_ACTION_REQUEST_KEY);
149:                String nodeName = requestParser
150:                        .getParameterValue("previousNode");
151:
152:                if (ACTION_ROUTE.equals(action)) {
153:                    document.routeDocument(annotation);
154:                } else if (ACTION_APPROVE.equals(action)) {
155:                    document.approve(annotation);
156:                } else if (ACTION_DISAPPROVE.equals(action)) {
157:                    document.disapprove(annotation);
158:                } else if (ACTION_CANCEL.equals(action)) {
159:                    document.cancel(annotation);
160:                } else if (ACTION_BLANKETAPPROVE.equals(action)) {
161:                    document.blanketApprove(annotation);
162:                } else if (ACTION_FYI.equals(action)) {
163:                    document.fyi();
164:                } else if (ACTION_ACKNOWLEDGE.equals(action)) {
165:                    document.acknowledge(annotation);
166:                } else if (ACTION_SAVE.equals(action)) {
167:                    document.saveDocument(annotation);
168:                } else if (ACTION_COMPLETE.equals(action)) {
169:                    document.complete(annotation);
170:                } else if (ACTION_DELETE.equals(action)) {
171:                    document.delete();
172:                } else if (ACTION_RETURN_TO_PREVIOUS.equals(action)) {
173:                    document.returnToPreviousNode(annotation, nodeName);
174:                }
175:            }
176:
177:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.