Source Code Cross Referenced for GetTriggerElementCountWorkflowTemplateTag.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:        import java.io.IOException;
012:        import java.math.BigDecimal;
013:        import javax.xml.parsers.ParserConfigurationException;
014:        import org.w3c.dom.Document;
015:        import org.xml.sax.SAXException;
016:
017:        //project specific classes
018:        import org.jfolder.common.tagging.AppraiseConceptTagContext;
019:        import org.jfolder.common.tagging.ConceptTagCharacteristic;
020:        import org.jfolder.common.tagging.ConceptTagConstraint;
021:        import org.jfolder.common.tagging.ConceptTagConstraintHolder;
022:        import org.jfolder.common.tagging.ConceptTagHelper;
023:        import org.jfolder.common.tagging.DetermineClassConceptTagContext;
024:        import org.jfolder.common.tagging.DetermineValueAndClassConceptTagContext;
025:        import org.jfolder.common.tagging.DetermineValueAndClassConceptTagException;
026:        import org.jfolder.common.tagging.InitializeConceptTagContext;
027:        import org.jfolder.common.tagging.ReturnableConceptTag;
028:        import org.jfolder.common.tagging.StaticConceptTagConstraintContext;
029:        import org.jfolder.common.tagging.StudioConceptTagInstanceInfoContext;
030:        import org.jfolder.common.tagging.StudioConceptTagTypeInfoContext;
031:        import org.jfolder.common.tagging.ValueAndClassForConceptTag;
032:        import org.jfolder.common.utils.misc.CommonExpressions;
033:        import org.jfolder.common.utils.misc.MiscHelper;
034:        import org.jfolder.common.utils.xml.XMLHelper;
035:
036:        //other classes
037:
038:        public class GetTriggerElementCountWorkflowTemplateTag implements 
039:                ReturnableConceptTag {
040:
041:            //characteristics
042:            private ConceptTagCharacteristic pathCtchar = null;
043:            private ConceptTagCharacteristic elementCtchar = null;
044:
045:            //path details
046:            private final static String PATH_CTCON = "path";
047:            private final static String PATH_TITLE = "Path";
048:            private final static String PATH_SHORT_DESCRIPTION = "Path to the element in the trigger containing the elements";
049:            //TO DO: elaborate above
050:
051:            //element details
052:            //TO DO: is this needed, already have path
053:            private final static String ELEMENT_CTCON = "element";
054:            private final static String ELEMENT_TITLE = "Element";
055:            private final static String ELEMENT_SHORT_DESCRIPTION = "XML element to be counted";
056:
057:            //TO DO: elaborate above
058:
059:            public void initialize(InitializeConceptTagContext inIctc) {
060:
061:                //
062:                ConceptTagConstraintHolder rootCtconh = ConceptTagConstraintHolder
063:                        .newInstance(inIctc);
064:
065:                //constrain "path"
066:                ConceptTagConstraint pathCtcon = ConceptTagConstraint
067:                        .newInstance(PATH_CTCON, rootCtconh);
068:                pathCtcon.setTitle(PATH_TITLE);
069:                pathCtcon.setShortDescription(PATH_SHORT_DESCRIPTION);
070:                //
071:                StaticConceptTagConstraintContext pathSctcc = StaticConceptTagConstraintContext
072:                        .newInstance(pathCtcon);
073:                pathSctcc.setRegularExpression(CommonExpressions.ANY_STRING);
074:                //
075:                pathSctcc.addDefaultValue("XMLPATH");
076:                //TO DO: provide better default
077:                //TO DO: define regular expression
078:
079:                //constrain "element"
080:                ConceptTagConstraint elementCtcon = ConceptTagConstraint
081:                        .newInstance(ELEMENT_CTCON, rootCtconh);
082:                elementCtcon.setTitle(ELEMENT_TITLE);
083:                elementCtcon.setShortDescription(ELEMENT_SHORT_DESCRIPTION);
084:                //
085:                StaticConceptTagConstraintContext elementSctcc = StaticConceptTagConstraintContext
086:                        .newInstance(elementCtcon);
087:                elementSctcc.setRegularExpression(CommonExpressions.ANY_STRING);
088:                //
089:                elementSctcc.addDefaultValue("XMLElementToCount");
090:                //TO DO: provide better default
091:                //TO DO: define regular expression
092:
093:                inIctc.initialize();
094:
095:                //initialize characteristics
096:                this .pathCtchar = pathCtcon.getCharacteristic();
097:                this .elementCtchar = elementCtcon.getCharacteristic();
098:
099:            }
100:
101:            public void appraise(AppraiseConceptTagContext inCtic) {
102:                if (inCtic instanceof  StudioConceptTagInstanceInfoContext) {
103:                    StudioConceptTagInstanceInfoContext sctiic = (StudioConceptTagInstanceInfoContext) inCtic;
104:                    sctiic.setInstanceTitle("Get Trigger Element Count");
105:                    sctiic
106:                            .setInstanceDescription("Count the total number of elements of a certain type"
107:                                    + " within an element of the trigger");
108:                } else if (inCtic instanceof  StudioConceptTagTypeInfoContext) {
109:                    StudioConceptTagTypeInfoContext scttic = (StudioConceptTagTypeInfoContext) inCtic;
110:                    scttic.setTypeTitle("Get Trigger Element Count");
111:                    scttic
112:                            .setTypeDescription("Count the total number of elements of a certain type"
113:                                    + " within an element of the trigger");
114:                }
115:            }
116:
117:            public void determineValueAndClass(
118:                    DetermineValueAndClassConceptTagContext inRvacc) {
119:
120:                inRvacc
121:                        .setDetermineException(new DetermineValueAndClassConceptTagException(
122:                                "Not Implemented"));
123:                //ValueAndClassForConceptTag outValue = null;
124:
125:                /*
126:                ComponentsForReturnableConceptTag wcfrt =
127:                    ConceptTagHelper.getComponentsForReturnableScriptTag(
128:                        inRvacc);
129:                
130:                Trigger t = wcfrt.getTrigger();
131:                
132:                //X-Path creation and validation
133:                String xpathData = null;
134:                
135:                if (this.pathTc.isStatic()) {
136:                    xpathData = this.pathTc.getValueAsString();
137:                }
138:                else if (this.pathTc.isDynamic()) {
139:                    
140:                    ValueAndClass outValue = this.pathTc.getDetermineValueAndClass(
141:                        inRvacc);
142:                    xpathData = (String)vac.getValue();
143:                }
144:                
145:                String xpathErrors = XMLHelper.isXPathValid(xpathData);
146:                
147:                if (xpathErrors != null) {
148:                    throw new DetermineValueAndClassConceptTagException("X-Path '"
149:                        + xpathData
150:                        + "' is invalid for the following reasons - " + xpathErrors);
151:                }
152:                
153:                //elementName creation and validation
154:                String elementName = null;
155:                
156:                if (this.elementTc.isStatic()) {
157:                    elementName = this.elementTc.getValueAsString();
158:                }
159:                else if (this.elementTc.isDynamic()) {
160:                    
161:                    ValueAndClass outValue =
162:                        this.elementTc.getDetermineValueAndClass(inRvacc);
163:                    elementName = (String)vac.getValue();
164:                }
165:                
166:                //trigger document creation and validation
167:                Document doc = null;
168:                try {
169:                    doc = XMLHelper.loadDocument(t.getDataAsString());
170:                }
171:                catch (ParserConfigurationException pce) {
172:                    throw new DetermineValueAndClassConceptTagException(pce);
173:                }
174:                catch (SAXException saxe) {
175:                    throw new DetermineValueAndClassConceptTagException(saxe);
176:                }
177:                catch (IOException ioe) {
178:                    throw new DetermineValueAndClassConceptTagException(ioe);
179:                }
180:                
181:                return ValueAndClassFactory.newValueAndClass(
182:                    new BigDecimal(XMLHelper.getElementSubCount(
183:                        doc, xpathData, elementName)), BigDecimal.class);
184:                 */
185:                //return outValue;
186:            }
187:
188:            public void determineClass(DetermineClassConceptTagContext inRcc) {
189:                inRcc.setDetermineClass(BigDecimal.class);
190:            }
191:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.