Source Code Cross Referenced for EmForgeJpdlReader.java in  » Project-Management » EmForce » org » emforge » jbpm » parser » 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 » Project Management » EmForce » org.emforge.jbpm.parser 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.emforge.jbpm.parser;
002:
003:        import java.io.Reader;
004:
005:        import org.dom4j.Element;
006:        import org.emforge.jbpm.BpmSystemRole;
007:        import org.jbpm.graph.node.TaskNode;
008:        import org.jbpm.instantiation.Delegation;
009:        import org.jbpm.jpdl.xml.JpdlXmlReader;
010:        import org.jbpm.jpdl.xml.ProblemListener;
011:        import org.jbpm.taskmgmt.def.Swimlane;
012:        import org.jbpm.taskmgmt.def.Task;
013:        import org.jbpm.taskmgmt.def.TaskMgmtDefinition;
014:        import org.xml.sax.InputSource;
015:
016:        /**
017:         *
018:         */
019:        public class EmForgeJpdlReader extends JpdlXmlReader {
020:
021:            private static final long serialVersionUID = -7785137528064121736L;
022:
023:            /**
024:             * @param inputSource
025:             */
026:            public EmForgeJpdlReader(InputSource inputSource) {
027:
028:                super (inputSource);
029:            }
030:
031:            /**
032:             * @param inputSource
033:             * @param problemListener
034:             */
035:            public EmForgeJpdlReader(InputSource inputSource,
036:                    ProblemListener problemListener) {
037:
038:                super (inputSource, problemListener);
039:            }
040:
041:            /**
042:             * @param reader
043:             */
044:            public EmForgeJpdlReader(Reader reader) {
045:
046:                super (reader);
047:            }
048:
049:            /**
050:             * @see org.jbpm.jpdl.xml.JpdlXmlReader#readTask(org.dom4j.Element, org.jbpm.taskmgmt.def.TaskMgmtDefinition, org.jbpm.graph.node.TaskNode)
051:             */
052:            @Override
053:            public Task readTask(Element taskElement,
054:                    TaskMgmtDefinition taskMgmtDefinition, TaskNode taskNode) {
055:
056:                Task task = new Task();
057:                task.setProcessDefinition(processDefinition);
058:
059:                // get the task name
060:                String name = taskElement.attributeValue("name");
061:                if (name != null) {
062:                    task.setName(name);
063:                    taskMgmtDefinition.addTask(task);
064:                } else if (taskNode != null) {
065:                    task.setName(taskNode.getName());
066:                    taskMgmtDefinition.addTask(task);
067:                }
068:
069:                // parse common subelements
070:                readTaskTimers(taskElement, task);
071:                readEvents(taskElement, task);
072:                readExceptionHandlers(taskElement, task);
073:
074:                // description and duration
075:                task.setDescription(taskElement.attributeValue("description"));
076:                String duedateText = taskElement.attributeValue("duedate");
077:                if (duedateText == null) {
078:                    duedateText = taskElement.attributeValue("dueDate");
079:                }
080:                task.setDueDate(duedateText);
081:                String priorityText = taskElement.attributeValue("priority");
082:                if (priorityText != null) {
083:                    task.setPriority(Task.parsePriority(priorityText));
084:                }
085:
086:                // if this task is in the context of a taskNode, associate them
087:                if (taskNode != null) {
088:                    taskNode.addTask(task);
089:                }
090:
091:                // blocking
092:                String blockingText = taskElement.attributeValue("blocking");
093:                if (blockingText != null) {
094:                    if (("true".equalsIgnoreCase(blockingText))
095:                            || ("yes".equalsIgnoreCase(blockingText))
096:                            || ("on".equalsIgnoreCase(blockingText))) {
097:                        task.setBlocking(true);
098:                    }
099:                }
100:
101:                // signalling
102:                String signallingText = taskElement
103:                        .attributeValue("signalling");
104:                if (signallingText != null) {
105:                    if (("false".equalsIgnoreCase(signallingText))
106:                            || ("no".equalsIgnoreCase(signallingText))
107:                            || ("off".equalsIgnoreCase(signallingText))) {
108:                        task.setSignalling(false);
109:                    }
110:                }
111:
112:                // assignment
113:                String swimlaneName = taskElement.attributeValue("swimlane");
114:                Element assignmentElement = taskElement.element("assignment");
115:
116:                // if there is a swimlane attribute specified
117:                if (swimlaneName != null) {
118:                    Swimlane swimlane = taskMgmtDefinition
119:                            .getSwimlane(swimlaneName);
120:                    if (swimlane == null) {
121:                        // if swimlane is not exists: create it
122:                        swimlane = new Swimlane(swimlaneName);
123:                        taskMgmtDefinition.addSwimlane(swimlane);
124:                    }
125:
126:                    // if delegation is not specified - set default EmForge delegation
127:                    if (swimlane.getActorIdExpression() == null
128:                            && swimlane.getAssignmentDelegation() == null) {
129:                        if (swimlaneName.equals(BpmSystemRole.OWNER
130:                                .getRoleName())) {
131:                            swimlane
132:                                    .setAssignmentDelegation(createSpringDelegation("assignToProcessOwner"));
133:                        } else {
134:                            swimlane
135:                                    .setAssignmentDelegation(createSpringDelegation("assignToSwimlane"));
136:                        }
137:                    }
138:
139:                    task.setSwimlane(swimlane);
140:
141:                    // else if there is a direct assignment specified
142:                } else if (assignmentElement != null) {
143:                    if ((assignmentElement.attribute("actor-id") != null)
144:                            || (assignmentElement.attribute("pooled-actors") != null)) {
145:                        task.setActorIdExpression(assignmentElement
146:                                .attributeValue("actor-id"));
147:                        task.setPooledActorsExpression(assignmentElement
148:                                .attributeValue("pooled-actors"));
149:
150:                    } else {
151:                        Delegation assignmentDelegation = readAssignmentDelegation(assignmentElement);
152:                        task.setAssignmentDelegation(assignmentDelegation);
153:                    }
154:
155:                    // if no assignment or swimlane is specified
156:                } else {
157:                    // the user has to manage assignment manually, so we better warn him/her.
158:                    addWarning("warning: no swimlane or assignment specified for task '"
159:                            + taskElement.asXML() + "'");
160:                }
161:
162:                // task controller
163:                Element taskControllerElement = taskElement
164:                        .element("controller");
165:                if (taskControllerElement != null) {
166:                    task
167:                            .setTaskController(readTaskController(taskControllerElement));
168:                }
169:
170:                return task;
171:            }
172:
173:            /**
174:             * @param i_beanName
175:             * @return
176:             */
177:            public static Delegation createSpringDelegation(String i_beanName) {
178:
179:                Delegation delegation = new Delegation(
180:                        "org.springmodules.workflow.jbpm31.JbpmHandler");
181:                delegation.setConfigType("bean");
182:                delegation
183:                        .setConfiguration("<beanName>"
184:                                + i_beanName
185:                                + "</beanName><factoryKey>jbpmConfiguration</factoryKey>");
186:
187:                return delegation;
188:            }
189:
190:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.