Source Code Cross Referenced for Activity.java in  » Workflow-Engines » JaWE » org » enhydra » shark » xpdl » elements » 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 » JaWE » org.enhydra.shark.xpdl.elements 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.enhydra.shark.xpdl.elements;
002:
003:        import java.util.ArrayList;
004:        import java.util.Iterator;
005:
006:        import org.enhydra.shark.xpdl.XMLAttribute;
007:        import org.enhydra.shark.xpdl.XMLCollectionElement;
008:        import org.enhydra.shark.xpdl.XMLElement;
009:        import org.enhydra.shark.xpdl.XMLUtil;
010:        import org.enhydra.shark.xpdl.XPDLConstants;
011:
012:        /**
013:         *  Represents coresponding element from XPDL schema.
014:         * 
015:         *  @author Sasa Bojanic
016:         */
017:        public class Activity extends XMLCollectionElement {
018:
019:            protected transient ArrayList outgoingTransitions;
020:            protected transient ArrayList incomingTransitions;
021:            protected transient ArrayList exceptionalOutgoingTransitions;
022:            protected transient ArrayList nonExceptionalOutgoingTransitions;
023:            protected transient ArrayList exceptionalIncomingTransitions;
024:            protected transient ArrayList nonExceptionalIncomingTransitions;
025:
026:            public Activity(Activities acts) {
027:                super (acts, true);
028:            }
029:
030:            protected void fillStructure() {
031:                XMLAttribute attrName = new XMLAttribute(this , "Name", false);
032:                Description refDescription = new Description(this ); // min=0
033:                Limit refLimit = new Limit(this ); // min=0
034:                // can be Route, BlockActivity or Implementation
035:                ActivityTypes refType = new ActivityTypes(this );
036:                Performer refPerformer = new Performer(this );// min=0
037:                StartMode refStartMode = new StartMode(this ); // min=0
038:                FinishMode refFinishMode = new FinishMode(this ); // min=0
039:                Priority refPriority = new Priority(this ); // min=0
040:                // we use Deadlines instead of Deadline
041:                Deadlines refDeadlines = new Deadlines(this ); // min=0
042:                SimulationInformation refSimulationInformation = new SimulationInformation(
043:                        this ); // min=0
044:                Icon refIcon = new Icon(this ); // min=0
045:                Documentation refDocumentation = new Documentation(this ); // min=0
046:                TransitionRestrictions refTransitionRestrictions = new TransitionRestrictions(
047:                        this ); // min=0
048:                ExtendedAttributes refExtendedAttributes = new ExtendedAttributes(
049:                        this ); // min=0
050:
051:                super .fillStructure();
052:                add(attrName);
053:                add(refDescription);
054:                add(refLimit);
055:                add(refType);
056:                add(refPerformer);
057:                add(refStartMode);
058:                add(refFinishMode);
059:                add(refPriority);
060:                add(refDeadlines);
061:                add(refSimulationInformation);
062:                add(refIcon);
063:                add(refDocumentation);
064:                add(refTransitionRestrictions);
065:                add(refExtendedAttributes);
066:            }
067:
068:            public void initCaches() {
069:                super .initCaches();
070:                Transitions ts;
071:                if (getParent().getParent() instanceof  WorkflowProcess) {
072:                    ts = ((WorkflowProcess) getParent().getParent())
073:                            .getTransitions();
074:                } else {
075:                    ts = ((ActivitySet) getParent().getParent())
076:                            .getTransitions();
077:                }
078:                TransitionRestrictions trs = getTransitionRestrictions();
079:                ArrayList trefs = null;
080:                if (trs.size() > 0) {
081:                    trefs = ((TransitionRestriction) trs.get(0)).getSplit()
082:                            .getTransitionRefs().toElements();
083:                } else {
084:                    trefs = new ArrayList();
085:                }
086:
087:                Iterator it = trefs.iterator();
088:                while (it.hasNext()) {
089:                    TransitionRef tref = (TransitionRef) it.next();
090:                    Transition t = ts.getTransition(tref.getId());
091:                    outgoingTransitions.add(t);
092:                    putTransitionInTheRightList(t, true);
093:                }
094:                it = ts.toElements().iterator();
095:                while (it.hasNext()) {
096:                    Transition t = (Transition) it.next();
097:                    if (!outgoingTransitions.contains(t)
098:                            && t.getFrom().equals(getId())) {
099:                        outgoingTransitions.add(t);
100:                        putTransitionInTheRightList(t, true);
101:                    }
102:                    if (t.getTo().equals(getId())) {
103:                        incomingTransitions.add(t);
104:                        putTransitionInTheRightList(t, false);
105:                    }
106:                }
107:            }
108:
109:            public void clearCaches() {
110:                clearInternalCaches();
111:                super .clearCaches();
112:            }
113:
114:            protected void clearInternalCaches() {
115:                outgoingTransitions = new ArrayList();
116:                incomingTransitions = new ArrayList();
117:                exceptionalOutgoingTransitions = new ArrayList();
118:                nonExceptionalOutgoingTransitions = new ArrayList();
119:                exceptionalIncomingTransitions = new ArrayList();
120:                nonExceptionalIncomingTransitions = new ArrayList();
121:            }
122:
123:            protected void putTransitionInTheRightList(Transition t,
124:                    boolean outg) {
125:                Condition condition = t.getCondition();
126:                String condType = condition.getType();
127:                if (condType.equals(XPDLConstants.CONDITION_TYPE_EXCEPTION)
128:                        || condType
129:                                .equals(XPDLConstants.CONDITION_TYPE_DEFAULTEXCEPTION)) {
130:                    if (outg) {
131:                        exceptionalOutgoingTransitions.add(t);
132:                    } else {
133:                        exceptionalIncomingTransitions.add(t);
134:                    }
135:                } else {
136:                    if (outg) {
137:                        nonExceptionalOutgoingTransitions.add(t);
138:                    } else {
139:                        nonExceptionalIncomingTransitions.add(t);
140:                    }
141:                }
142:            }
143:
144:            public ArrayList getOutgoingTransitions() {
145:                if (!isReadOnly) {
146:                    throw new RuntimeException(
147:                            "This method can be used only in read-only mode!");
148:                }
149:                return outgoingTransitions;
150:            }
151:
152:            public ArrayList getIncomingTransitions() {
153:                if (!isReadOnly) {
154:                    throw new RuntimeException(
155:                            "This method can be used only in read-only mode!");
156:                }
157:                return incomingTransitions;
158:            }
159:
160:            public ArrayList getNonExceptionalOutgoingTransitions() {
161:                if (!isReadOnly) {
162:                    throw new RuntimeException(
163:                            "This method can be used only in read-only mode!");
164:                }
165:                return nonExceptionalOutgoingTransitions;
166:            }
167:
168:            public ArrayList getExceptionalOutgoingTransitions() {
169:                if (!isReadOnly) {
170:                    throw new RuntimeException(
171:                            "This method can be used only in read-only mode!");
172:                }
173:                return exceptionalOutgoingTransitions;
174:            }
175:
176:            public ArrayList getNonExceptionalIncomingTransitions() {
177:                if (!isReadOnly) {
178:                    throw new RuntimeException(
179:                            "This method can be used only in read-only mode!");
180:                }
181:                return nonExceptionalIncomingTransitions;
182:            }
183:
184:            public ArrayList getExceptionalIncomingTransitions() {
185:                if (!isReadOnly) {
186:                    throw new RuntimeException(
187:                            "This method can be used only in read-only mode!");
188:                }
189:                return exceptionalIncomingTransitions;
190:            }
191:
192:            public boolean isAndTypeSplit() {
193:                return XMLUtil.isANDTypeSplitOrJoin(this , 0);
194:            }
195:
196:            public boolean isAndTypeJoin() {
197:                return XMLUtil.isANDTypeSplitOrJoin(this , 1);
198:            }
199:
200:            public int getActivityStartMode() {
201:                return XMLUtil.getStartMode(this );
202:            }
203:
204:            public int getActivityFinishMode() {
205:                return XMLUtil.getFinishMode(this );
206:            }
207:
208:            public int getActivityType() {
209:                XMLElement ch = getActivityTypes().getChoosen();
210:                if (ch instanceof  Route) {
211:                    return XPDLConstants.ACTIVITY_TYPE_ROUTE;
212:                } else if (ch instanceof  Implementation) {
213:                    ch = ((Implementation) ch).getImplementationTypes()
214:                            .getChoosen();
215:                    if (ch instanceof  Tools) {
216:                        return XPDLConstants.ACTIVITY_TYPE_TOOL;
217:                    } else if (ch instanceof  SubFlow) {
218:                        return XPDLConstants.ACTIVITY_TYPE_SUBFLOW;
219:                    } else {
220:                        return XPDLConstants.ACTIVITY_TYPE_NO;
221:                    }
222:                } else {
223:                    return XPDLConstants.ACTIVITY_TYPE_BLOCK;
224:                }
225:
226:            }
227:
228:            public boolean isSubflowSynchronous() {
229:                if (getActivityType() != XPDLConstants.ACTIVITY_TYPE_SUBFLOW) {
230:                    throw new RuntimeException(
231:                            "The activity type is not SubFlow!");
232:                }
233:                return XMLUtil.isSubflowSynchronous(this );
234:            }
235:
236:            public String getName() {
237:                return get("Name").toValue();
238:            }
239:
240:            public void setName(String name) {
241:                set("Name", name);
242:            }
243:
244:            public Deadlines getDeadlines() {
245:                return (Deadlines) get("Deadlines");
246:            }
247:
248:            public String getDescription() {
249:                return get("Description").toValue();
250:            }
251:
252:            public void setDescription(String description) {
253:                set("Description", description);
254:            }
255:
256:            public String getDocumentation() {
257:                return get("Documentation").toValue();
258:            }
259:
260:            public void setDocumentation(String documentation) {
261:                set("Documentation", documentation);
262:            }
263:
264:            public ExtendedAttributes getExtendedAttributes() {
265:                return (ExtendedAttributes) get("ExtendedAttributes");
266:            }
267:
268:            public FinishMode getFinishMode() {
269:                return (FinishMode) get("FinishMode");
270:            }
271:
272:            public String getIcon() {
273:                return get("Icon").toValue();
274:            }
275:
276:            public void setIcon(String icon) {
277:                set("Icon", icon);
278:            }
279:
280:            public String getLimit() {
281:                return get("Limit").toValue();
282:            }
283:
284:            public void setLimit(String limit) {
285:                set("Limit", limit);
286:            }
287:
288:            public String getPerformer() {
289:                return get("Performer").toValue();
290:            }
291:
292:            public void setPerformer(String performer) {
293:                set("Performer", performer);
294:            }
295:
296:            public String getPriority() {
297:                return get("Priority").toValue();
298:            }
299:
300:            public void setPriority(String priority) {
301:                set("Priority", priority);
302:            }
303:
304:            public SimulationInformation getSimulationInformation() {
305:                return (SimulationInformation) get("SimulationInformation");
306:            }
307:
308:            public StartMode getStartMode() {
309:                return (StartMode) get("StartMode");
310:            }
311:
312:            public TransitionRestrictions getTransitionRestrictions() {
313:                return (TransitionRestrictions) get("TransitionRestrictions");
314:            }
315:
316:            public ActivityTypes getActivityTypes() {
317:                return (ActivityTypes) get("Type");
318:            }
319:
320:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.