Source Code Cross Referenced for Activity.java in  » Workflow-Engines » Bossa » com » bigbross » bossa » wfnet » 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 » Bossa » com.bigbross.bossa.wfnet 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Bossa Workflow System
003:         *
004:         * $Id: Activity.java,v 1.17 2004/03/03 19:17:28 gdvieira Exp $
005:         *
006:         * Copyright (C) 2003,2004 OpenBR Sistemas S/C Ltda.
007:         *
008:         * This file is part of Bossa.
009:         *
010:         * Bossa is free software; you can redistribute it and/or modify it
011:         * under the terms of version 2 of the GNU General Public License as
012:         * published by the Free Software Foundation.
013:         *
014:         * This program is distributed in the hope that it will be useful,
015:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
016:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
017:         * General Public License for more details.
018:         *
019:         * You should have received a copy of the GNU General Public
020:         * License along with this program; if not, write to the
021:         * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
022:         * Boston, MA 02111-1307, USA.
023:         */
024:
025:        package com.bigbross.bossa.wfnet;
026:
027:        import java.io.Serializable;
028:        import java.util.Map;
029:
030:        import com.bigbross.bossa.BossaException;
031:        import com.bigbross.bossa.resource.Resource;
032:
033:        /**
034:         * This class represents an open (firing) work item. <p>
035:         *
036:         * @author <a href="http://www.bigbross.com">BigBross Team</a>
037:         */
038:        public class Activity implements  Serializable {
039:
040:            private int id;
041:
042:            private WorkItem workItem;
043:
044:            private Resource resource;
045:
046:            /**
047:             * Creates a new activity. <p>
048:             * 
049:             * @param workItem the open work item this activity represents.
050:             * @param resource the resource that opened the work item.
051:             */
052:            Activity(WorkItem workItem, Resource resource) {
053:                this .workItem = workItem;
054:                this .id = getCase().nextActivityId();
055:                this .resource = resource;
056:            }
057:
058:            /**
059:             * Returns the id of this activity. <p>
060:             * 
061:             * @return the id of this activity.
062:             */
063:            public int getId() {
064:                return id;
065:            }
066:
067:            /**
068:             * Returns the resource responsible by this activity. <p>
069:             * 
070:             * @return the resource id.
071:             */
072:            public Resource getResource() {
073:                return resource;
074:            }
075:
076:            /**
077:             * Returns the id of the work item that created this activity. <p>
078:             * 
079:             * @return the id of the work item that created this activity.
080:             */
081:            public String getWorkItemId() {
082:                return getTransition().getId();
083:            }
084:
085:            /**
086:             * Returns the case type of this activity. <p>
087:             * 
088:             * @return The case type of this activity.
089:             */
090:            public CaseType getCaseType() {
091:                return workItem.getCaseType();
092:            }
093:
094:            /**
095:             * Returns the case of this activity. <p>
096:             * 
097:             * @return The case of this activity.
098:             */
099:            public Case getCase() {
100:                return workItem.getCase();
101:            }
102:
103:            /**
104:             * Returns the transition the open work item represents. <p>
105:             * 
106:             * @return The transition the open work item represents.
107:             */
108:            Transition getTransition() {
109:                return workItem.getTransition();
110:            }
111:
112:            /**
113:             * Closes and finishes this activity. Call this method when the
114:             * activity is successfully completed. <p>
115:             * 
116:             * @return <code>true</code> if the activity is succesfully opened,
117:             *         <code>false</code> otherwise.
118:             * @exception SetAttributeException if the underlying expression
119:             *            evaluation system has problems setting an attribute.
120:             * @exception EvaluationException if an expression evaluation error
121:             *            occurs. If this exception is thrown the state of the case
122:             *            may be left inconsistent.
123:             * @exception PersistenceException if an error occours when making the
124:             *            execution of this method persistent.
125:             */
126:            public boolean close() throws BossaException {
127:                return dispatchTransaction(new CloseActivity(this , null));
128:            }
129:
130:            /**
131:             * Closes and finishes an activity. Call this method when the
132:             * activity is successfully completed. <p>
133:             * 
134:             * An attribute mapping should be passed when this method is called.
135:             * This is a (<code>String</code>, <code>Object</code>) mapping of
136:             * variables names (as used in edge weight expressions) and Java objects.
137:             * The Java objects should be understandable by the underlying BSF
138:             * engine being used (for JavaScript, <code>Boolean</code>,
139:             * <code>Integer</code> and <code>String</code> are known to work).
140:             * The attributes provided will overwrite current set attributes and
141:             * the value of these attributes will be used when evaluating edge
142:             * weights. <p>
143:             * 
144:             * @param attributes the attributes mapping.
145:             * @return <code>true</code> if the activity is succesfully opened,
146:             *         <code>false</code> otherwise.
147:             * @exception SetAttributeException if the underlying expression
148:             *            evaluation system has problems setting an attribute.
149:             * @exception EvaluationException if an expression evaluation error
150:             *            occurs. If this exception is thrown the state of the case
151:             *            may be left inconsistent.
152:             * @exception PersistenceException if an error occours when making the
153:             *            execution of this method persistent.
154:             */
155:            public boolean close(Map attributes) throws BossaException {
156:                return dispatchTransaction(new CloseActivity(this , attributes));
157:            }
158:
159:            /**
160:             * Cancel this activity. Call this method if the activity could not
161:             * be completed. The related work item will return to the list of
162:             * available work items and can be opened again. <p>
163:             * 
164:             * @return <code>true</code> if the activity is succesfully canceled,
165:             *         <code>false</code> otherwise.
166:             * @exception EvaluationException if an expression evaluation error
167:             *            occurs. If this exception is thrown the state of the case
168:             *            may be left inconsistent.
169:             * @exception PersistenceException if an error occours when making the
170:             *            execution of this method persistent.
171:             */
172:            public boolean cancel() throws BossaException {
173:                return dispatchTransaction(new CancelActivity(this ));
174:            }
175:
176:            /**
177:             * Executes a transaction that returns a boolean value. <p>
178:             * 
179:             * @param transaction the transaction;
180:             * @return The <code>boolean</code> returned by the transaction execution.
181:             */
182:            private boolean dispatchTransaction(WFNetTransaction transaction)
183:                    throws BossaException {
184:                Boolean result = (Boolean) getCaseType().getCaseTypeManager()
185:                        .getBossa().execute(transaction);
186:                return result.booleanValue();
187:            }
188:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.