Source Code Cross Referenced for TaskMgmtSession.java in  » Workflow-Engines » jbpm-jpdl-3.2.2 » org » jbpm » db » 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 » Workflow Engines » jbpm jpdl 3.2.2 » org.jbpm.db 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * JBoss, Home of Professional Open Source
003:         * Copyright 2005, JBoss Inc., and individual contributors as indicated
004:         * by the @authors tag. See the copyright.txt in the distribution for a
005:         * full listing of individual contributors.
006:         *
007:         * This is free software; you can redistribute it and/or modify it
008:         * under the terms of the GNU Lesser General Public License as
009:         * published by the Free Software Foundation; either version 2.1 of
010:         * the License, or (at your option) any later version.
011:         *
012:         * This software is distributed in the hope that it will be useful,
013:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
014:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015:         * Lesser General Public License for more details.
016:         *
017:         * You should have received a copy of the GNU Lesser General Public
018:         * License along with this software; if not, write to the Free
019:         * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020:         * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021:         */
022:        package org.jbpm.db;
023:
024:        import java.io.Serializable;
025:        import java.util.ArrayList;
026:        import java.util.List;
027:
028:        import org.apache.commons.logging.Log;
029:        import org.apache.commons.logging.LogFactory;
030:        import org.hibernate.Query;
031:        import org.hibernate.Session;
032:        import org.jbpm.JbpmException;
033:        import org.jbpm.graph.exe.ProcessInstance;
034:        import org.jbpm.taskmgmt.exe.TaskInstance;
035:
036:        public class TaskMgmtSession implements  Serializable {
037:
038:            private static final long serialVersionUID = 1L;
039:
040:            JbpmSession jbpmSession = null;
041:            Session session = null;
042:
043:            public TaskMgmtSession(JbpmSession jbpmSession) {
044:                this .jbpmSession = jbpmSession;
045:                this .session = jbpmSession.getSession();
046:            }
047:
048:            public TaskMgmtSession(Session session) {
049:                this .session = session;
050:                this .jbpmSession = new JbpmSession(session);
051:            }
052:
053:            /**
054:             * get the tasllist for a given actor.
055:             */
056:            public List findTaskInstances(String actorId) {
057:                List result = null;
058:                try {
059:                    Query query = session
060:                            .getNamedQuery("TaskMgmtSession.findTaskInstancesByActorId");
061:                    query.setString("actorId", actorId);
062:                    result = query.list();
063:                } catch (Exception e) {
064:                    log.error(e);
065:                    jbpmSession.handleException();
066:                    throw new JbpmException(
067:                            "couldn't get task instances list for actor '"
068:                                    + actorId + "'", e);
069:                }
070:                return result;
071:            }
072:
073:            /**
074:             * get all the task instances for all the given actorIds.
075:             * @return a list of task instances.  An empty list is returned in case no task instances are found.
076:             */
077:            public List findTaskInstances(List actorIds) {
078:                if (actorIds == null)
079:                    return new ArrayList(0);
080:                return findTaskInstances((String[]) actorIds
081:                        .toArray(new String[actorIds.size()]));
082:            }
083:
084:            /**
085:             * get all the task instances for all the given actorIds.
086:             */
087:            public List findTaskInstances(String[] actorIds) {
088:                List result = null;
089:                try {
090:                    Query query = session
091:                            .getNamedQuery("TaskMgmtSession.findTaskInstancesByActorIds");
092:                    query.setParameterList("actorIds", actorIds);
093:                    result = query.list();
094:                } catch (Exception e) {
095:                    log.error(e);
096:                    jbpmSession.handleException();
097:                    throw new JbpmException(
098:                            "couldn't get task instances list for actors '"
099:                                    + actorIds + "'", e);
100:                }
101:                return result;
102:            }
103:
104:            /**
105:             * get the taskinstances for which the given actor is in the pool.
106:             */
107:            public List findPooledTaskInstances(String actorId) {
108:                List result = null;
109:                try {
110:                    Query query = session
111:                            .getNamedQuery("TaskMgmtSession.findPooledTaskInstancesByActorId");
112:                    query.setString("swimlaneActorId", actorId);
113:                    result = query.list();
114:                } catch (Exception e) {
115:                    log.error(e);
116:                    jbpmSession.handleException();
117:                    throw new JbpmException(
118:                            "couldn't get pooled task instances list for actor '"
119:                                    + actorId + "'", e);
120:                }
121:                return result;
122:            }
123:
124:            /**
125:             * get the taskinstances for which the given actor is in the pool.
126:             */
127:            public List findPooledTaskInstances(List actorIds) {
128:                List result = null;
129:                try {
130:                    Query query = session
131:                            .getNamedQuery("TaskMgmtSession.findPooledTaskInstancesByActorIds");
132:                    query.setParameterList("actorIds", actorIds);
133:                    result = query.list();
134:                } catch (Exception e) {
135:                    log.error(e);
136:                    jbpmSession.handleException();
137:                    throw new JbpmException(
138:                            "couldn't get pooled task instances list for actors '"
139:                                    + actorIds + "'", e);
140:                }
141:                return result;
142:            }
143:
144:            /**
145:             * get active taskinstances for a given token.
146:             */
147:            public List findTaskInstancesByToken(long tokenId) {
148:                List result = null;
149:                try {
150:                    Query query = session
151:                            .getNamedQuery("TaskMgmtSession.findTaskInstancesByTokenId");
152:                    query.setLong("tokenId", tokenId);
153:                    result = query.list();
154:                } catch (Exception e) {
155:                    log.error(e);
156:                    jbpmSession.handleException();
157:                    throw new JbpmException(
158:                            "couldn't get task instances by token '" + tokenId
159:                                    + "'", e);
160:                }
161:                return result;
162:            }
163:
164:            /**
165:             * get active taskinstances for a given token.
166:             */
167:            public List findTaskInstancesByProcessInstance(
168:                    ProcessInstance processInstance) {
169:                List result = null;
170:                try {
171:                    Query query = session
172:                            .getNamedQuery("TaskMgmtSession.findTaskInstancesByProcessInstance");
173:                    query.setEntity("processInstance", processInstance);
174:                    result = query.list();
175:                } catch (Exception e) {
176:                    log.error(e);
177:                    jbpmSession.handleException();
178:                    throw new JbpmException(
179:                            "couldn't get task instances by process instance '"
180:                                    + processInstance + "'", e);
181:                }
182:                return result;
183:            }
184:
185:            /**
186:             * get the task instance for a given task instance-id.
187:             */
188:            public TaskInstance loadTaskInstance(long taskInstanceId) {
189:                TaskInstance taskInstance = null;
190:                try {
191:                    taskInstance = (TaskInstance) session.load(
192:                            TaskInstance.class, new Long(taskInstanceId));
193:                } catch (Exception e) {
194:                    log.error(e);
195:                    jbpmSession.handleException();
196:                    throw new JbpmException("couldn't get task instance '"
197:                            + taskInstanceId + "'", e);
198:                }
199:                return taskInstance;
200:            }
201:
202:            /**
203:             * get the task instance for a given task instance-id.
204:             */
205:            public TaskInstance getTaskInstance(long taskInstanceId) {
206:                TaskInstance taskInstance = null;
207:                try {
208:                    taskInstance = (TaskInstance) session.get(
209:                            TaskInstance.class, new Long(taskInstanceId));
210:                } catch (Exception e) {
211:                    log.error(e);
212:                    jbpmSession.handleException();
213:                    throw new JbpmException("couldn't get task instance '"
214:                            + taskInstanceId + "'", e);
215:                }
216:                return taskInstance;
217:            }
218:
219:            public List findTaskInstancesByIds(List taskInstanceIds) {
220:                List result = null;
221:                try {
222:                    Query query = session
223:                            .getNamedQuery("TaskMgmtSession.findTaskInstancesByIds");
224:                    query.setParameterList("taskInstanceIds", taskInstanceIds);
225:                    result = query.list();
226:                } catch (Exception e) {
227:                    log.error(e);
228:                    jbpmSession.handleException();
229:                    throw new JbpmException(
230:                            "couldn't get task instances by ids '"
231:                                    + taskInstanceIds + "'", e);
232:                }
233:                return result;
234:            }
235:
236:            private static final Log log = LogFactory
237:                    .getLog(TaskMgmtSession.class);
238:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.