Source Code Cross Referenced for WorkItemEJB.java in  » Workflow-Engines » obe-1.0 » org » obe » server » j2ee » repository » 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 » obe 1.0 » org.obe.server.j2ee.repository 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*--
002:
003:         Copyright (C) 2002-2005 Adrian Price.
004:         All rights reserved.
005:
006:         Redistribution and use in source and binary forms, with or without
007:         modification, are permitted provided that the following conditions
008:         are met:
009:
010:         1. Redistributions of source code must retain the above copyright
011:            notice, this list of conditions, and the following disclaimer.
012:
013:         2. Redistributions in binary form must reproduce the above copyright
014:            notice, this list of conditions, and the disclaimer that follows
015:            these conditions in the documentation and/or other materials
016:            provided with the distribution.
017:
018:         3. The names "OBE" and "Open Business Engine" must not be used to
019:         	endorse or promote products derived from this software without prior
020:         	written permission.  For written permission, please contact
021:         	adrianprice@sourceforge.net.
022:
023:         4. Products derived from this software may not be called "OBE" or
024:         	"Open Business Engine", nor may "OBE" or "Open Business Engine"
025:         	appear in their name, without prior written permission from
026:         	Adrian Price (adrianprice@users.sourceforge.net).
027:
028:         THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
029:         WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
030:         OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
031:         DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT,
032:         INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
033:         (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
034:         SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
035:         HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
036:         STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
037:         IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
038:         POSSIBILITY OF SUCH DAMAGE.
039:
040:         For more information on OBE, please see
041:         <http://obe.sourceforge.net/>.
042:
043:         */
044:
045:        package org.obe.server.j2ee.repository;
046:
047:        import org.apache.commons.logging.Log;
048:        import org.obe.client.api.repository.RepositoryException;
049:        import org.obe.spi.model.ActivityInstance;
050:        import org.obe.spi.model.AttributedEntity;
051:        import org.obe.spi.model.WorkItem;
052:        import org.obe.spi.service.ServerConfig;
053:        import org.wfmc.wapi.WMFilter;
054:        import org.wfmc.wapi.WMWorkItemState;
055:
056:        import javax.ejb.CreateException;
057:        import javax.ejb.FinderException;
058:        import javax.ejb.ObjectNotFoundException;
059:        import java.sql.SQLException;
060:        import java.util.Collection;
061:        import java.util.Date;
062:        import java.util.List;
063:
064:        /**
065:         * Holds the persistent state of a work item.
066:         *
067:         * @author Adrian Price
068:         * @ejb:bean type="CMP"
069:         * cmp-version="2.x"
070:         * name="WorkItem"
071:         * display-name="OBE Work Item"
072:         * local-jndi-name="org/obe/ejb/WorkItemLocal"
073:         * primkey-field="workItemId"
074:         * reentrant="False"
075:         * schema="WORKITEM"
076:         * transaction-type="Container"
077:         * view-type="local"
078:         * @ejb:home local-class="org.obe.server.j2ee.repository.WorkItemLocalHome"
079:         * local-extends="javax.ejb.EJBLocalHome"
080:         * @ejb:interface local-class="org.obe.server.j2ee.repository.WorkItemLocal"
081:         * local-extends="org.obe.spi.model.WorkItem, javax.ejb.EJBLocalObject"
082:         * @ejb:persistence table-name="OBEWORKITEM"
083:         * @ejb:pk class="java.lang.String"
084:         * unchecked="true"
085:         * @ejb:permission unchecked="true"
086:         * @ejb:transaction type="Supports"
087:         * @weblogic:transaction-isolation ${transaction.isolation}
088:         * @ejb:finder signature="java.util.Collection findAll()"
089:         * query="SELECT OBJECT(w) FROM WORKITEM AS w"
090:         * result-type-mapping="Local"
091:         * unchecked="true"
092:         * @ejb:ejb-ref ejb-name="Sequence"
093:         * view-type="local"
094:         * @weblogic:ejb-local-reference-description ejb-ref-name="ejb/Sequence"
095:         * jndi-name="org/obe/ejb/SequenceLocal"
096:         * @ejb:ejb-ref ejb-name="ActivityInstance"
097:         * view-type="local"
098:         * @weblogic:ejb-local-reference-description ejb-ref-name="ejb/ActivityInstance"
099:         * jndi-name="org/obe/ejb/ActivityInstanceLocal"
100:         * @ejb:resource-ref res-name="jdbc/TxDataSource"
101:         * res-type="javax.sql.DataSource"
102:         * res-auth="Container"
103:         * @jboss:resource-manager res-man-class="javax.sql.DataSource"
104:         * res-man-name="jdbc/TxDataSource"
105:         * res-man-jndi-name="java:/${xdoclet.DataSource}"
106:         * @weblogic:resource-description res-ref-name="jdbc/TxDataSource"
107:         * jndi-name="${xdoclet.DataSource}"
108:         * @weblogic:data-source-name java:comp/env/jdbc/TxDataSource
109:         * @jboss:create-table false
110:         * @weblogic:pool max-beans-in-free-pool="225"
111:         * initial-beans-in-free-pool="0"
112:         * @weblogic:cache max-beans-in-cache="225"
113:         * idle-timeout-seconds="0"
114:         * concurrency-strategy="Database"
115:         * @weblogic:persistence delay-updates-until-end-of-tx="True"
116:         * @jboss:tuned-updates tune="true"
117:         * @jboss:container-configuration name="${xdoclet.jboss.container-configuration}"
118:         * @jboss:cache-invalidation value="True"
119:         * @jboss:cache-invalidation-config invalidation-group-name="WorkItem"
120:         */
121:        public abstract class WorkItemEJB extends AbstractAttributedEntityEJB {
122:            private static final long serialVersionUID = 5075666391524114744L;
123:            private static final Log _logger = getLogger(WorkItemEJB.class);
124:
125:            public WorkItemEJB() {
126:                super (WorkItem.propertyDescriptors);
127:            }
128:
129:            /**
130:             * @ejb:create-method
131:             */
132:            public String ejbCreate(String processDefinitionId,
133:                    String processInstanceId, int toolIndex,
134:                    String workItemName, int priority, int state,
135:                    String performer, String participant)
136:                    throws CreateException, RepositoryException {
137:
138:                if (_logger.isDebugEnabled() && ServerConfig.isVerbose()) {
139:                    _logger.debug("ejbCreate(" + processDefinitionId + ", "
140:                            + processInstanceId + ", " + toolIndex + ", "
141:                            + workItemName + ", " + priority + ", " + state
142:                            + ", " + performer + ", " + participant + ')');
143:                }
144:
145:                clear();
146:
147:                setWorkItemId(WorkItemDAO.getInstance().getNewId());
148:                setToolIndex(toolIndex);
149:                setProcessDefinitionId(processDefinitionId);
150:                setProcessInstanceId(processInstanceId);
151:                // When a cmp-field and a cmr-field (relationship) are mapped to the
152:                // same column, the setXXX method for the cmp-field may not be called.
153:                // The cmp-field is read-only.
154:                //        setActivityInstanceId(activityInstanceId);
155:                setName(workItemName);
156:                setPriority(priority);
157:                setState(state);
158:                setPerformer(performer);
159:                setParticipant(participant);
160:
161:                return null;
162:            }
163:
164:            public void ejbPostCreate(String processDefinitionId,
165:                    String processInstanceId, int toolIndex,
166:                    String workItemName, int priority, int state,
167:                    String performer, String participant) {
168:
169:                if (_logger.isDebugEnabled() && ServerConfig.isVerbose()) {
170:                    _logger.debug("ejbPostCreate(pk=" + _ctx.getPrimaryKey()
171:                            + ", " + processDefinitionId + ", "
172:                            + processInstanceId + ", " + toolIndex + ", "
173:                            + workItemName + ", " + priority + ", " + state
174:                            + ", " + performer + ", " + participant + ')');
175:                }
176:                _ejbLocalObject = _ctx.getEJBLocalObject();
177:            }
178:
179:            /**
180:             * Counts the number of matching work items.
181:             *
182:             * @param filter Work item filter; can be <code>null</code>.
183:             * @return The number of matching work items.
184:             * @ejb:home-method
185:             */
186:            public int ejbHomeCount(WMFilter filter) throws RepositoryException {
187:                try {
188:                    return WorkItemDAO.getInstance().count(filter);
189:                } catch (SQLException e) {
190:                    throw new RepositoryException(e);
191:                }
192:            }
193:
194:            /**
195:             * Retrieves matching work items.
196:             *
197:             * @param filter Work item filter; should not be <code>null</code>
198:             *               (use {@link WorkItemLocalHome#findAll} instead).
199:             * @return A collection of matching work items.
200:             * @ejb:home-method
201:             * @see WorkItemLocalHome#findAll
202:             */
203:            public Collection ejbHomeXfindByFilter(WMFilter filter)
204:                    throws FinderException, RepositoryException {
205:
206:                try {
207:                    List workitems = WorkItemDAO.getInstance().findByFilter(
208:                            filter);
209:                    WorkItemLocalHome home = (WorkItemLocalHome) _ctx
210:                            .getEJBLocalHome();
211:                    for (int i = 0; i < workitems.size(); i++) {
212:                        try {
213:                            workitems.set(i,
214:                                    home.findByPrimaryKey((String) workitems
215:                                            .get(i)));
216:                        } catch (ObjectNotFoundException e) {
217:                            // Someone else deleted this PK, so just skip it.
218:                            workitems.remove(i--);
219:                        }
220:                    }
221:                    return workitems;
222:                } catch (SQLException e) {
223:                    throw new RepositoryException(e);
224:                }
225:            }
226:
227:            /**
228:             * @ejb:interface-method
229:             * @ejb:persistence column-name="WORKITEMID"
230:             */
231:            public abstract String getWorkItemId();
232:
233:            /**
234:             * @ejb:persistence column-name="WORKITEMID"
235:             */
236:            public abstract void setWorkItemId(String workItemId);
237:
238:            /**
239:             * @ejb:interface-method
240:             * @ejb:persistence column-name="TOOLINDEX"
241:             */
242:            public abstract int getToolIndex();
243:
244:            /**
245:             * @ejb:interface-method
246:             * @ejb:persistence column-name="TOOLINDEX"
247:             */
248:            public abstract void setToolIndex(int toolIndex);
249:
250:            /**
251:             * @ejb:interface-method
252:             */
253:            public String getActivityDefinitionId() {
254:                return getActivityInstanceCmr().getActivityDefinitionId();
255:            }
256:
257:            /**
258:             * @ejb:interface-method
259:             * @ejb:persistence column-name="ACTIVITYINSTANCEID"
260:             */
261:            public abstract String getActivityInstanceId();
262:
263:            /**
264:             * @ejb:persistence column-name="ACTIVITYINSTANCEID"
265:             */
266:            public abstract void setActivityInstanceId(String activityInstanceId);
267:
268:            /**
269:             * @ejb:interface-method
270:             * @ejb:persistence column-name="NAME"
271:             */
272:            public abstract String getName();
273:
274:            /**
275:             * @ejb:interface-method
276:             * @ejb:persistence column-name="NAME"
277:             */
278:            public abstract void setName(String name);
279:
280:            /**
281:             * @ejb:interface-method
282:             * @ejb:persistence column-name="PERFORMER"
283:             */
284:            public abstract String getPerformer();
285:
286:            /**
287:             * @ejb:interface-method
288:             * @ejb:persistence column-name="PERFORMER"
289:             */
290:            public abstract void setPerformer(String performer);
291:
292:            /**
293:             * @ejb:interface-method
294:             * @ejb:persistence column-name="PARTICIPANT"
295:             */
296:            public abstract String getParticipant();
297:
298:            /**
299:             * @ejb:interface-method
300:             * @ejb:persistence column-name="PARTICIPANT"
301:             */
302:            public abstract void setParticipant(String participant);
303:
304:            /**
305:             * @ejb:interface-method
306:             * @ejb:persistence column-name="PRIORITY"
307:             */
308:            public abstract int getPriority();
309:
310:            /**
311:             * @ejb:interface-method
312:             * @ejb:persistence column-name="PRIORITY"
313:             */
314:            public abstract void setPriority(int priority);
315:
316:            /**
317:             * @ejb:interface-method
318:             * @ejb:persistence column-name="PROCESSINSTANCEID"
319:             */
320:            public abstract String getProcessInstanceId();
321:
322:            /**
323:             * @ejb:persistence column-name="PROCESSINSTANCEID"
324:             */
325:            public abstract void setProcessInstanceId(String processInstanceId);
326:
327:            /**
328:             * @ejb:interface-method
329:             * @ejb:persistence column-name="STARTEDDATE"
330:             */
331:            public abstract Date getStartedDate();
332:
333:            /**
334:             * @ejb:interface-method
335:             * @ejb:persistence column-name="STARTEDDATE"
336:             */
337:            public abstract void setStartedDate(Date startedDate);
338:
339:            /**
340:             * @ejb:interface-method
341:             * @ejb:persistence column-name="COMPLETEDDATE"
342:             */
343:            public abstract Date getCompletedDate();
344:
345:            /**
346:             * @ejb:interface-method
347:             * @ejb:persistence column-name="COMPLETEDDATE"
348:             */
349:            public abstract void setCompletedDate(Date completedDate);
350:
351:            /**
352:             * @ejb:interface-method
353:             * @ejb:persistence column-name="TARGETDATE"
354:             */
355:            public abstract Date getTargetDate();
356:
357:            /**
358:             * @ejb:interface-method
359:             * @ejb:persistence column-name="TARGETDATE"
360:             */
361:            public abstract void setTargetDate(Date targetDate);
362:
363:            /**
364:             * @ejb:interface-method
365:             * @ejb:persistence column-name="DUEDATE"
366:             */
367:            public abstract Date getDueDate();
368:
369:            /**
370:             * @ejb:interface-method
371:             * @ejb:persistence column-name="DUEDATE"
372:             */
373:            public abstract void setDueDate(Date dueDate);
374:
375:            /**
376:             * @ejb:interface-method
377:             * @ejb:persistence column-name="STATE"
378:             */
379:            public abstract int getState();
380:
381:            /**
382:             * @ejb:interface-method
383:             * @ejb:persistence column-name="STATE"
384:             */
385:            public abstract void setState(int state);
386:
387:            /**
388:             * @ejb:relation name="ActivityInstance-WorkItem"
389:             * role-name="WorkItem-Has-An-ActivityInstance"
390:             * cascade-delete="yes"
391:             * @jboss:relation related-pk-field="activityInstanceId"
392:             * fk-column="ACTIVITYINSTANCEID"
393:             * @weblogic:column-map foreign-key-column="ACTIVITYINSTANCEID"
394:             * key-column="ACTIVITYINSTANCEID"
395:             */
396:            public abstract ActivityInstanceLocal getActivityInstanceCmr();
397:
398:            public abstract void setActivityInstanceCmr(
399:                    ActivityInstanceLocal pkg);
400:
401:            /**
402:             * @ejb:interface-method
403:             */
404:            public ActivityInstance getActivityInstance() {
405:                return getActivityInstanceCmr();
406:            }
407:
408:            /**
409:             * @ejb:interface-method
410:             */
411:            public String getEntityId() {
412:                return getWorkItemId();
413:            }
414:
415:            protected int getOwnerType() {
416:                return AttributedEntity.WORKITEM_TYPE;
417:            }
418:
419:            /**
420:             * @ejb:interface-method
421:             */
422:            public String toString() {
423:                return "WorkItem[workItemId='" + getEntityId()
424:                        + "', activityInstanceId='" + getActivityInstanceId()
425:                        + "', processInstanceId='" + getProcessInstanceId()
426:                        + "', processDefinitionId='" + getProcessDefinitionId()
427:                        + "', activityDefinitionId='"
428:                        + getActivityDefinitionId() + "', name='" + getName()
429:                        + "', state="
430:                        + WMWorkItemState.valueOf(getState()).stringValue()
431:                        + ", priority=" + getPriority() + ", performer='"
432:                        + getPerformer() + ", participant='" + getParticipant()
433:                        + "', startedDate=" + getStartedDate()
434:                        + ", completedDate=" + getCompletedDate()
435:                        + ", dueDate=" + getDueDate() + ']';
436:            }
437:
438:            protected final Log getLogger() {
439:                return _logger;
440:            }
441:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.