Source Code Cross Referenced for NodeWorkflowTemplateTag.java in  » Workflow-Engines » JFolder » org » jfolder » workflow » model » template » v1 » 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 » JFolder » org.jfolder.workflow.model.template.v1 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * JFolder, Copyright 2001-2006 Gary Steinmetz
003:         *
004:         * Distributable under LGPL license.
005:         * See terms of license at gnu.org.
006:         */
007:
008:        package org.jfolder.workflow.model.template.v1;
009:
010:        //base classes
011:
012:        //project specific classes
013:        import org.jfolder.common.tagging.CompoundConceptTagConstraintContext;
014:        import org.jfolder.common.tagging.ConceptTagCharacteristic;
015:        import org.jfolder.common.tagging.ConceptTagCharacteristicHolder;
016:        import org.jfolder.common.tagging.ConceptTagConstraint;
017:        import org.jfolder.common.tagging.ConceptTagConstraintHolder;
018:        import org.jfolder.common.tagging.ConceptTagConstraintTemplate;
019:        import org.jfolder.common.tagging.CoreConceptTag;
020:        import org.jfolder.common.tagging.DetermineValueAndClassConceptTagContext;
021:        import org.jfolder.common.tagging.DetermineValueAndClassConceptTagException;
022:        import org.jfolder.common.tagging.DynamicConceptTagConstraintContext;
023:        import org.jfolder.common.tagging.DynamicConceptTagValidator;
024:        import org.jfolder.common.tagging.InitializeConceptTagContext;
025:        import org.jfolder.common.tagging.StaticConceptTagConstraintContext;
026:        import org.jfolder.common.tagging.ValueAndClassForConceptTag;
027:
028:        //other classes
029:
030:        abstract class NodeWorkflowTemplateTag implements  CoreConceptTag {
031:
032:            //characteristics
033:            private ConceptTagCharacteristic ifTransitionCtchar = null;
034:            private ConceptTagCharacteristic transitionCtchar = null;
035:            private ConceptTagCharacteristic branchCtchar = null;
036:
037:            //ifTransition details
038:            private final static String IF_TRANSITION_CTCON = "if-transition";
039:            private final static String IF_TRANSITION_TITLE = "If Transitions";
040:            private final static String IF_TRANSITION_SHORT_DESCRIPTION = "Transition to take if condition is true";
041:
042:            //ifTransition condition template
043:            private final static String IF_TRANSITION_CTCON_CONDITION_CTCTEMP = "condition";
044:            private final static String IF_TRANSITION_CTCON_CONDITION_TITLE = "Condition";
045:            private final static String IF_TRANSITION_CTCON_CONDITION_SHORT_DESCRIPTION = "This path will be taken only if this condition evaluates to true";
046:
047:            //ifTransition transition template
048:            private final static String IF_TRANSITION_CTCON_TRANSITION_CTCTEMP = "transition";
049:            private final static String IF_TRANSITION_CTCON_TRANSITION_TITLE = "Transition";
050:            private final static String IF_TRANSITION_CTCON_TRANSITION_SHORT_DESCRIPTION = "This path to be taken";
051:
052:            //transition details
053:            private final static String TRANSITION_CTCON = "transition";
054:            private final static String TRANSITION_TITLE = "Default Transition";
055:            private final static String TRANSITION_SHORT_DESCRIPTION = "Transition to take if none of the if transition conditions"
056:                    + " evaluate to true";
057:
058:            //branch detail
059:            private final static String BRANCH_CTCON = "branch";
060:            private final static String BRANCH_TITLE = "Branch";
061:            private final static String BRANCH_SHORT_DESCRIPTION = "Simultaneous path to take";
062:
063:            //branch ifTransition template
064:            private final static String BRANCH_CTCON_IF_TRANSITION_CTCTEMP = "if-transition";
065:            private final static String BRANCH_CTCON_IF_TRANSITION_TITLE = "If Transitions";
066:            private final static String BRANCH_CTCON_IF_TRANSITION_SHORT_DESCRIPTION = "Transition to take if condition is true";
067:            //branch ifTransition template condition template
068:            private final static String BRANCH_CTCON_IF_TRANSITION_CTCTEMP_CONDITION_CTCTEMP = "condition";
069:            private final static String BRANCH_CTCON_IF_TRANSITION_CTCTEMP_CONDITION_TITLE = "Condition";
070:            private final static String BRANCH_CTCON_IF_TRANSITION_CTCTEMP_CONDITION_SHORT_DESCRIPTION = "This path will be taken only if this condition evaluates to true";
071:            //branch ifTransition template transition template
072:            private final static String BRANCH_CTCON_IF_TRANSITION_CTCTEMP_TRANSITION_CTCTEMP = "transition";
073:            private final static String BRANCH_CTCON_IF_TRANSITION_CTCTEMP_TRANSITION_TITLE = "Transition";
074:            private final static String BRANCH_CTCON_IF_TRANSITION_CTCTEMP_TRANSITION_SHORT_DESCRIPTION = "This path to be taken";
075:            //branch transition template
076:            private final static String BRANCH_CTCON_TRANSITION_CTCTEMP = "transition";
077:            private final static String BRANCH_CTCON_TRANSITION_TITLE = "Default Transition";
078:            private final static String BRANCH_CTCON_TRANSITION_SHORT_DESCRIPTION = "Transition to take if none of the if transition conditions"
079:                    + " evaluate to true";
080:
081:            //TO DO: look into duplicate TC names!
082:
083:            public void initializeBase(InitializeConceptTagContext inIctc) {
084:
085:                //
086:                ConceptTagConstraintHolder rootCtconh = ConceptTagConstraintHolder
087:                        .newInstance(inIctc);
088:
089:                //constrain "if-transition"
090:                ConceptTagConstraint ifTransitionCtcon = ConceptTagConstraint
091:                        .newInstance(IF_TRANSITION_CTCON, rootCtconh);
092:                ifTransitionCtcon.setTitle(IF_TRANSITION_TITLE);
093:                ifTransitionCtcon
094:                        .setShortDescription(IF_TRANSITION_SHORT_DESCRIPTION);
095:                ifTransitionCtcon.setMinimumLength(0);
096:                ifTransitionCtcon.setLengthUnbounded(true);
097:                //
098:                CompoundConceptTagConstraintContext ifTransitionCctcc = CompoundConceptTagConstraintContext
099:                        .newInstance(ifTransitionCtcon);
100:                //
101:                //constrain "condition" of "if-transition"
102:                ConceptTagConstraintTemplate ifTransitionCtconConditionCtctemp = ConceptTagConstraintTemplate
103:                        .newInstance(IF_TRANSITION_CTCON_CONDITION_CTCTEMP,
104:                                ifTransitionCctcc);
105:                ifTransitionCtconConditionCtctemp
106:                        .setTitle(IF_TRANSITION_CTCON_CONDITION_TITLE);
107:                ifTransitionCtconConditionCtctemp
108:                        .setShortDescription(IF_TRANSITION_CTCON_CONDITION_SHORT_DESCRIPTION);
109:                //TO DO: validate static text
110:                DynamicConceptTagConstraintContext ifTransitionCtconConditionDctcc = DynamicConceptTagConstraintContext
111:                        .newInstance(ifTransitionCtconConditionCtctemp);
112:                DynamicConceptTagValidator ifTransitionCtconConditionDctccVal = ifTransitionCtconConditionDctcc
113:                        .getValidator();
114:                ifTransitionCtconConditionDctccVal.allowReturnOfOnlyBoolean();
115:                //
116:                //constrain "transition" of "if-transition"
117:                ConceptTagConstraintTemplate ifTransitionCtconTransitionCtctemp = ConceptTagConstraintTemplate
118:                        .newInstance(IF_TRANSITION_CTCON_TRANSITION_CTCTEMP,
119:                                ifTransitionCctcc);
120:                ifTransitionCtconTransitionCtctemp
121:                        .setTitle(IF_TRANSITION_CTCON_TRANSITION_TITLE);
122:                ifTransitionCtconTransitionCtctemp
123:                        .setShortDescription(IF_TRANSITION_CTCON_TRANSITION_SHORT_DESCRIPTION);
124:                //
125:                StaticConceptTagConstraintContext ifTransitionCtconTransitionSctcc = StaticConceptTagConstraintContext
126:                        .newInstance(ifTransitionCtconTransitionCtctemp);
127:                //
128:                ifTransitionCtconTransitionSctcc.addDefaultValue("State");
129:                //((InitializeConceptTagContextBean)inItc).registerTransitions(stct1);
130:                //TO DO: validate static text
131:
132:                //constrain "transition"
133:                ConceptTagConstraint transitionCtcon = ConceptTagConstraint
134:                        .newInstance(TRANSITION_CTCON, rootCtconh);
135:                transitionCtcon.setTitle(TRANSITION_TITLE);
136:                transitionCtcon
137:                        .setShortDescription(TRANSITION_SHORT_DESCRIPTION);
138:                //
139:                StaticConceptTagConstraintContext transitionSctcc = StaticConceptTagConstraintContext
140:                        .newInstance(transitionCtcon);
141:                transitionSctcc.addDefaultValue("State");
142:                //((InitializeConceptTagContextBean)inItc).registerTransitions(
143:                //    this.transitionTc);
144:                //TO DO: validate static text
145:
146:                ////////////////////////////////////////////////////////////////
147:
148:                //constrain "branch"
149:                ConceptTagConstraint branchCtcon = ConceptTagConstraint
150:                        .newInstance(BRANCH_CTCON, rootCtconh);
151:                branchCtcon.setTitle(BRANCH_TITLE);
152:                branchCtcon.setShortDescription(BRANCH_SHORT_DESCRIPTION);
153:                branchCtcon.setMinimumLength(0);
154:                branchCtcon.setLengthUnbounded(true);
155:                //
156:                CompoundConceptTagConstraintContext branchCctcc = CompoundConceptTagConstraintContext
157:                        .newInstance(branchCtcon);
158:                //
159:                //constrain "if-transition" of "branch"
160:                ConceptTagConstraintTemplate branchCtconIfTransitionCtctemp = ConceptTagConstraintTemplate
161:                        .newInstance(BRANCH_CTCON_IF_TRANSITION_CTCTEMP,
162:                                branchCctcc);
163:                branchCtconIfTransitionCtctemp
164:                        .setTitle(BRANCH_CTCON_IF_TRANSITION_TITLE);
165:                branchCtconIfTransitionCtctemp
166:                        .setShortDescription(BRANCH_CTCON_IF_TRANSITION_SHORT_DESCRIPTION);
167:                branchCtconIfTransitionCtctemp.setMinimumLength(0);
168:                branchCtconIfTransitionCtctemp.setLengthUnbounded(true);
169:                //
170:                CompoundConceptTagConstraintContext branchCtconIfTransitionCctcc = CompoundConceptTagConstraintContext
171:                        .newInstance(branchCtconIfTransitionCtctemp);
172:                //constrain "condition" of "if-transition" of "branch"
173:                ConceptTagConstraintTemplate branchCtconIfTransitionCtctempConditionCtctemp = ConceptTagConstraintTemplate
174:                        .newInstance(
175:                                BRANCH_CTCON_IF_TRANSITION_CTCTEMP_CONDITION_CTCTEMP,
176:                                branchCtconIfTransitionCctcc);
177:                branchCtconIfTransitionCtctempConditionCtctemp
178:                        .setTitle(BRANCH_CTCON_IF_TRANSITION_CTCTEMP_CONDITION_TITLE);
179:                branchCtconIfTransitionCtctempConditionCtctemp
180:                        .setShortDescription(BRANCH_CTCON_IF_TRANSITION_CTCTEMP_CONDITION_SHORT_DESCRIPTION);
181:                //
182:                DynamicConceptTagConstraintContext branchCtconIfTransitionCtctempConditionDctcc = DynamicConceptTagConstraintContext
183:                        .newInstance(branchCtconIfTransitionCtctempConditionCtctemp);
184:                //
185:                //constrain "transition" of "if-transition" of "branch"
186:                ConceptTagConstraintTemplate branchCtconIfTransitionCtctempTransitionCtctemp = ConceptTagConstraintTemplate
187:                        .newInstance(
188:                                BRANCH_CTCON_IF_TRANSITION_CTCTEMP_TRANSITION_CTCTEMP,
189:                                branchCtconIfTransitionCctcc);
190:                branchCtconIfTransitionCtctempTransitionCtctemp
191:                        .setTitle(BRANCH_CTCON_IF_TRANSITION_CTCTEMP_TRANSITION_TITLE);
192:                branchCtconIfTransitionCtctempTransitionCtctemp
193:                        .setShortDescription(BRANCH_CTCON_IF_TRANSITION_CTCTEMP_TRANSITION_SHORT_DESCRIPTION);
194:                //((InitializeConceptTagContextBean)inItc).registerTransitions(stct2);
195:                //
196:                StaticConceptTagConstraintContext branchCtconIfTransitionCtctempTransitionSctcc = StaticConceptTagConstraintContext
197:                        .newInstance(branchCtconIfTransitionCtctempTransitionCtctemp);
198:                //
199:
200:                ConceptTagConstraintTemplate branchCtconTransitionCtctemp = ConceptTagConstraintTemplate
201:                        .newInstance(BRANCH_CTCON_TRANSITION_CTCTEMP,
202:                                branchCctcc);
203:                branchCtconTransitionCtctemp
204:                        .setTitle(BRANCH_CTCON_TRANSITION_TITLE);
205:                branchCtconTransitionCtctemp
206:                        .setShortDescription(BRANCH_CTCON_TRANSITION_SHORT_DESCRIPTION);
207:                //
208:                StaticConceptTagConstraintContext branchCtconTransitionSctcc = StaticConceptTagConstraintContext
209:                        .newInstance(branchCtconTransitionCtctemp);
210:                //((InitializeConceptTagContextBean)inItc).registerTransitions(stct3);
211:
212:                inIctc.initialize();
213:
214:                //initialize characteristics
215:                this .ifTransitionCtchar = ifTransitionCtcon.getCharacteristic();
216:                this .transitionCtchar = transitionCtcon.getCharacteristic();
217:                this .branchCtchar = branchCtcon.getCharacteristic();
218:            }
219:
220:            public String evaluateTransition(
221:                    DetermineValueAndClassConceptTagContext inRvacc)
222:                    throws DetermineValueAndClassConceptTagException {
223:
224:                String outValue = null;
225:
226:                for (int i = 0; i < this .ifTransitionCtchar.getValueLength(); i++) {
227:
228:                    ConceptTagCharacteristicHolder nextCh = this .ifTransitionCtchar
229:                            .getValueAsHolder(i, inRvacc);
230:
231:                    ConceptTagCharacteristic conditionTc = nextCh
232:                            .getCharacteristic(IF_TRANSITION_CTCON_CONDITION_CTCTEMP);
233:
234:                    ValueAndClassForConceptTag conditionVac = conditionTc
235:                            .getDetermineValueAndClass(0, inRvacc);
236:
237:                    Boolean bValue = (Boolean) conditionVac.getValue();
238:
239:                    if (bValue.booleanValue()) {
240:
241:                        ConceptTagCharacteristic transitionNameTc = nextCh
242:                                .getCharacteristic(this .IF_TRANSITION_CTCON_TRANSITION_CTCTEMP);
243:                        outValue = transitionNameTc
244:                                .getValueAsString(0, inRvacc);
245:
246:                        break;
247:                    }
248:                }
249:
250:                if (outValue == null) {
251:                    outValue = this .transitionCtchar.getValueAsString(0,
252:                            inRvacc);
253:                }
254:
255:                return outValue;
256:            }
257:
258:            public int getIfTransitionCount() {
259:                return this .ifTransitionCtchar.getValueLength();
260:            }
261:
262:            public String getIfTransitionDestination(int inIndex) {
263:
264:                ConceptTagCharacteristic outValue = null;
265:
266:                ConceptTagCharacteristicHolder nextCh = this .ifTransitionCtchar
267:                        .getValueAsHolder(inIndex, null);
268:                outValue = nextCh
269:                        .getCharacteristic(this .IF_TRANSITION_CTCON_TRANSITION_CTCTEMP);
270:
271:                return outValue.getValueAsString(0, null);
272:            }
273:
274:            public String getTransitionDestination() {
275:                return this .transitionCtchar.getValueAsString(0, null);
276:            }
277:
278:            public int getBranchIfTransitionCount(int inBranch) {
279:
280:                ConceptTagCharacteristic outValue = null;
281:
282:                ConceptTagCharacteristicHolder topCh = this .branchCtchar
283:                        .getValueAsHolder(inBranch, null);
284:                outValue = topCh
285:                        .getCharacteristic(this .BRANCH_CTCON_IF_TRANSITION_CTCTEMP);
286:
287:                return outValue.getValueLength();
288:            }
289:
290:            public String getBranchIfTransitionDestination(int inBranch,
291:                    int inIndex) {
292:
293:                ConceptTagCharacteristic outValue = null;
294:
295:                ConceptTagCharacteristicHolder topCh = this .branchCtchar
296:                        .getValueAsHolder(inBranch, null);
297:
298:                ConceptTagCharacteristic topIfTransitionTc = topCh
299:                        .getCharacteristic(this .BRANCH_CTCON_IF_TRANSITION_CTCTEMP);
300:                ConceptTagCharacteristicHolder nextCh = topIfTransitionTc
301:                        .getValueAsHolder(inIndex, null);
302:                outValue = nextCh
303:                        .getCharacteristic(BRANCH_CTCON_IF_TRANSITION_CTCTEMP_TRANSITION_CTCTEMP);
304:
305:                return outValue.getValueAsString(0, null);
306:            }
307:
308:            public String getBranchTransitionDestination(int inBranch) {
309:
310:                ConceptTagCharacteristic outValue = null;
311:
312:                ConceptTagCharacteristicHolder topCh = this .branchCtchar
313:                        .getValueAsHolder(inBranch, null);
314:                outValue = topCh
315:                        .getCharacteristic(BRANCH_CTCON_TRANSITION_CTCTEMP);
316:
317:                return outValue.getValueAsString(0, null);
318:            }
319:
320:            public int getBranchCount() {
321:                return this .branchCtchar.getValueLength();
322:            }
323:
324:            public String evaluateBranch(int inIndex,
325:                    DetermineValueAndClassConceptTagContext inRvacc)
326:                    throws DetermineValueAndClassConceptTagException {
327:
328:                String outValue = null;
329:
330:                ConceptTagCharacteristicHolder topCh = this .branchCtchar
331:                        .getValueAsHolder(inIndex, inRvacc);
332:
333:                ConceptTagCharacteristic topIfTransitionTc = topCh
334:                        .getCharacteristic(this .BRANCH_CTCON_IF_TRANSITION_CTCTEMP);
335:
336:                for (int i = 0; i < topIfTransitionTc.getValueLength(); i++) {
337:
338:                    ConceptTagCharacteristicHolder nextCh = topIfTransitionTc
339:                            .getValueAsHolder(i, inRvacc);
340:
341:                    ConceptTagCharacteristic conditionTc = nextCh
342:                            .getCharacteristic(BRANCH_CTCON_IF_TRANSITION_CTCTEMP_CONDITION_CTCTEMP);
343:
344:                    ValueAndClassForConceptTag conditionVac = conditionTc
345:                            .getDetermineValueAndClass(0, inRvacc);
346:
347:                    Boolean bValue = (Boolean) conditionVac.getValue();
348:
349:                    if (bValue.booleanValue()) {
350:
351:                        ConceptTagCharacteristic transitionNameTc = nextCh
352:                                .getCharacteristic(BRANCH_CTCON_IF_TRANSITION_CTCTEMP_TRANSITION_CTCTEMP);
353:                        outValue = transitionNameTc
354:                                .getValueAsString(0, inRvacc);
355:
356:                        break;
357:                    }
358:                }
359:
360:                if (outValue == null) {
361:
362:                    ConceptTagCharacteristic topTransitionTc = topCh
363:                            .getCharacteristic(BRANCH_CTCON_TRANSITION_CTCTEMP);
364:
365:                    outValue = topTransitionTc.getValueAsString(0, inRvacc);
366:                }
367:                return outValue;
368:            }
369:
370:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.