Source Code Cross Referenced for BAForProcessInstantiation.java in  » Workflow-Engines » wfmopen-2.1.1 » de » danet » an » workflow » domain » 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 » wfmopen 2.1.1 » de.danet.an.workflow.domain 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * This file is part of the WfMOpen project.
003:         * Copyright (C) 2001-2004 Danet GmbH (www.danet.de), GS-AN.
004:         * All rights reserved.
005:         *
006:         * This program is free software; you can redistribute it and/or modify
007:         * it under the terms of the GNU General Public License as published by
008:         * the Free Software Foundation; either version 2 of the License, or
009:         * (at your option) any later version.
010:         *
011:         * This program is distributed in the hope that it will be useful,
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014:         * GNU General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU General Public License
017:         * along with this program; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
019:         *
020:         * $Id: BAForProcessInstantiation.java,v 1.3 2007/05/03 21:58:18 mlipp Exp $
021:         *
022:         * $Log: BAForProcessInstantiation.java,v $
023:         * Revision 1.3  2007/05/03 21:58:18  mlipp
024:         * Internal refactoring for making better use of local EJBs.
025:         *
026:         * Revision 1.2  2006/09/29 12:32:08  drmlipp
027:         * Consistently using WfMOpen as projct name now.
028:         *
029:         * Revision 1.1.1.1  2004/08/18 15:17:38  drmlipp
030:         * Update to 1.2
031:         *
032:         * Revision 1.2  2004/05/09 18:42:59  lipp
033:         * Finished process instantiation restructuring.
034:         *
035:         * Revision 1.1  2004/05/06 19:39:18  lipp
036:         * Restructured block activity handling.
037:         *
038:         */
039:        package de.danet.an.workflow.domain;
040:
041:        import java.util.ArrayList;
042:        import java.util.Collection;
043:        import java.util.HashMap;
044:        import java.util.HashSet;
045:        import java.util.Iterator;
046:        import java.util.Map;
047:        import java.util.Set;
048:
049:        import java.rmi.RemoteException;
050:
051:        import org.xml.sax.Attributes;
052:        import org.xml.sax.SAXException;
053:
054:        import de.danet.an.util.sax.HandlerStack;
055:        import de.danet.an.util.sax.StackedHandler;
056:
057:        import de.danet.an.workflow.internalapi.ExtActivityLocal;
058:        import de.danet.an.workflow.localcoreapi.WfActivityLocal;
059:
060:        import de.danet.an.workflow.api.SAXEventBuffer;
061:        import de.danet.an.workflow.api.Activity.JoinAndSplitMode;
062:
063:        /**
064:         * This class provides a temporary representation of a block activity
065:         * used during process instantiation.
066:         *
067:         * @author <a href="mailto:mnl@mnl.de">Michael N. Lipp</a>
068:         * @version $Revision: 1.3 $
069:         */
070:
071:        public class BAForProcessInstantiation extends BlockActivity {
072:
073:            private static final org.apache.commons.logging.Log logger = org.apache.commons.logging.LogFactory
074:                    .getLog(BAForProcessInstantiation.class);
075:
076:            private String setId = null;
077:            private Map allActs = null;
078:            private Collection entryActs = null;
079:            private Collection exitActs = null;
080:            private Map actIds = new HashMap();
081:
082:            /**
083:             * Creates an instance of <code>BAForProcessInstantiation</code>
084:             * with all attributes initialized to given values.
085:             * @param proc the process this block activity is part of
086:             * @param key the block activity key
087:             * @param actSetDef the activity set definition
088:             * @param packageId the package id of the process being
089:             * instantiated
090:             * @param actSetDefs activity set definition map
091:             * @param blkActId the id of the block activity
092:             * @param joinMode the join mode of the block activity
093:             * @param splitMode the split mode of the activity
094:             * @throws SAXException if an error occurs
095:             */
096:            public BAForProcessInstantiation(AbstractProcess proc, String key,
097:                    SAXEventBuffer actSetDef, String packageId, Map actSetDefs,
098:                    String blkActId, JoinAndSplitMode joinMode,
099:                    JoinAndSplitMode splitMode) throws SAXException {
100:                super (key);
101:                allActs = new HashMap();
102:                HandlerStack hs = new HandlerStack(
103:                        new BlockActivityInitializer(proc, actSetDefs,
104:                                blkActId, joinMode, splitMode));
105:                hs.setContextData("packageId", packageId);
106:                actSetDef.emit(hs.contentHandler());
107:            }
108:
109:            /**
110:             * Add an activity to this block activity's activities.
111:             * @param actId the id of the activity in the process definition
112:             * @param act the activity
113:             */
114:            public void add(String actId, WfActivityLocal act) {
115:                allActs.put(actId, act);
116:            }
117:
118:            /**
119:             * Return the id of the activity set this block activity was
120:             * created from.
121:             * @return set id
122:             */
123:            public String setId() {
124:                return setId;
125:            }
126:
127:            /**
128:             * Return the collection of entry activities of this block
129:             * activity.
130:             * @return the entry activities
131:             */
132:            public Collection entryActivities() {
133:                return entryActs;
134:            }
135:
136:            /**
137:             * Return the collection of exit activities of this block
138:             * activity.
139:             * @return the exit activities
140:             */
141:            public Collection exitActivities() {
142:                return exitActs;
143:            }
144:
145:            /**
146:             * Return the id from the acivity set definition of the given
147:             * activity which must be contained in this block activity.
148:             * @param key the activity's key
149:             * @return the id
150:             */
151:            public String getMemberId(String key) {
152:                return (String) actIds.get(key);
153:            }
154:
155:            /**
156:             * Helper class for creating a block activity.
157:             */
158:            public class BlockActivityInitializer extends StackedHandler {
159:
160:                private AbstractProcess process = null;
161:                private Map actSetDefs = null;
162:                private String blkActId = null;
163:                private String blkActKey = null;
164:                private JoinAndSplitMode joinMode = JoinAndSplitMode.AND;
165:                private JoinAndSplitMode splitMode = JoinAndSplitMode.AND;
166:
167:                private Set localFromIds = new HashSet();
168:                private Set localToIds = new HashSet();
169:
170:                private Map setActIdMap = new HashMap();
171:                private Map setTrefsMap = new HashMap();
172:
173:                /**
174:                 * Create a new initializer with the given parameters.
175:                 * @param proc the process this activity belongs to
176:                 * @param actSets activity set definition map
177:                 * @param blkActId the id of the block activity
178:                 * @param jm the join mode of the block activity
179:                 * @param sm the split mode of the activity
180:                 */
181:                public BlockActivityInitializer(AbstractProcess proc,
182:                        Map actSets, String blkActId, JoinAndSplitMode jm,
183:                        JoinAndSplitMode sm) {
184:                    process = proc;
185:                    actSetDefs = actSets;
186:
187:                    this .blkActId = blkActId;
188:                    joinMode = jm;
189:                    splitMode = sm;
190:
191:                    blkActKey = key();
192:                }
193:
194:                /**
195:                 * Receive notification of the beginning of an element.
196:                 *
197:                 * @param uri the Namespace URI, or the empty string if the
198:                 * element has no Namespace URI or if Namespace processing is not
199:                 * being performed.
200:                 * @param loc the local name (without prefix), or the empty string
201:                 * if Namespace processing is not being performed.
202:                 * @param raw the raw XML 1.0 name (with prefix), or the empty
203:                 * string if raw names are not available.
204:                 * @param a the attributes attached to the element. If there are
205:                 * no attributes, it shall be an empty Attributes object.
206:                 * @throws SAXException not thrown.
207:                 */
208:                public void startElement(String uri, String loc, String raw,
209:                        Attributes a) throws SAXException {
210:                    if (loc.equals("ActivitySet")) {
211:                        setId = a.getValue("Id");
212:                    } else if (loc.equals("Activity")) {
213:                        getStack().push(
214:                                process.activityInitializer(setActIdMap,
215:                                        setTrefsMap, actSetDefs, blkActKey));
216:                    } else if (loc.equals("Transition")) {
217:                        localFromIds.add(a.getValue("From"));
218:                        localToIds.add(a.getValue("To"));
219:                        getStack().push(
220:                                process.transitionInitializer(setActIdMap,
221:                                        setTrefsMap, blkActId));
222:                    }
223:                }
224:
225:                /**
226:                 * Receive notification of the end of an element.
227:                 *
228:                 * @param uri the Namespace URI, or the empty string if the
229:                 * element has no Namespace URI or if Namespace processing is not
230:                 * being performed.
231:                 * @param loc the local name (without prefix), or the empty string
232:                 * if Namespace processing is not being performed.
233:                 * @param raw the raw XML 1.0 name (with prefix), or the empty
234:                 * string if raw names are not available.
235:                 * @throws SAXException not thrown.
236:                 */
237:                public void endElement(String uri, String loc, String raw)
238:                        throws SAXException {
239:                    if (loc.equals("ActivitySet")) {
240:                        entryActs = new ArrayList();
241:                        exitActs = new ArrayList();
242:                        actIds = new HashMap();
243:                        for (Iterator i = setActIdMap.entrySet().iterator(); i
244:                                .hasNext();) {
245:                            Map.Entry entry = (Map.Entry) i.next();
246:                            String actId = (String) entry.getKey();
247:                            ExtActivityLocal act = (ExtActivityLocal) entry
248:                                    .getValue();
249:                            if (!localToIds.contains(actId)) {
250:                                // is entry activity
251:                                act.setJoinMode(joinMode);
252:                                entryActs.add(act);
253:                                actIds.put(act.key(), actId);
254:                            }
255:                            if (!localFromIds.contains(actId)) {
256:                                // is exit activity
257:                                act.setSplitMode(splitMode);
258:                                exitActs.add(act);
259:                                actIds.put(act.key(), actId);
260:                            }
261:                        }
262:                    }
263:                }
264:            }
265:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.