Source Code Cross Referenced for GetTriggerTextWorkflowTemplateTag.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 javax.xml.parsers.ParserConfigurationException;
013:        import org.w3c.dom.Document;
014:        import org.w3c.dom.Element;
015:        import org.xml.sax.SAXException;
016:
017:        //project specific classes
018:        import org.jfolder.common.tagging.AppraiseConceptTagContext;
019:        import org.jfolder.common.tagging.CompoundConceptTagConstraintContext;
020:        import org.jfolder.common.tagging.ConceptTagCharacteristic;
021:        import org.jfolder.common.tagging.ConceptTagCharacteristicHolder;
022:        import org.jfolder.common.tagging.ConceptTagConstraint;
023:        import org.jfolder.common.tagging.ConceptTagConstraintHolder;
024:        import org.jfolder.common.tagging.ConceptTagConstraintTemplate;
025:        import org.jfolder.common.tagging.DetermineClassConceptTagContext;
026:        import org.jfolder.common.tagging.DetermineValueAndClassConceptTagContext;
027:        import org.jfolder.common.tagging.DetermineValueAndClassConceptTagException;
028:        import org.jfolder.common.tagging.InitializeConceptTagContext;
029:        import org.jfolder.common.tagging.ReturnableConceptTag;
030:        import org.jfolder.common.tagging.StaticConceptTagConstraintContext;
031:        import org.jfolder.common.tagging.StudioConceptTagInstanceInfoContext;
032:        import org.jfolder.common.tagging.StudioConceptTagTypeInfoContext;
033:        import org.jfolder.common.tagging.ValueAndClassForConceptTag;
034:        import org.jfolder.common.utils.xml.LinearXPath;
035:        import org.jfolder.common.utils.xml.LinearXPathHelper;
036:        import org.jfolder.common.utils.xml.XMLHelper;
037:        import org.jfolder.workflow.model.template.*;
038:        import org.jfolder.workflow.model.trigger.WorkflowTrigger;
039:
040:        //other classes
041:
042:        public class GetTriggerTextWorkflowTemplateTag implements 
043:                ReturnableConceptTag {
044:
045:            //ConceptTag characteristic
046:            private ConceptTagCharacteristic pathCtchar = null;
047:
048:            //path details
049:            private final static String PATH_CTCON = "path";
050:            private final static String PATH_TITLE = "Path";
051:            private final static String PATH_SHORT_DESCRIPTION = "Path to the element in the trigger containing the text";
052:            //TO DO: elaborate above
053:
054:            //segment details
055:            private final static String PATH_CTCON_SEGMENT_CTCTEMP = "segment";
056:            private final static String PATH_CTCON_SEGMENT_TITLE = "Segment";
057:            private final static String PATH_CTCON_SEGMENT_SHORT_DESCRIPTION = "Name of XPath segment";
058:
059:            //index details
060:            private final static String PATH_CTCON_INDEX_CTCTEMP = "index";
061:            private final static String PATH_CTCON_INDEX_TITLE = "Index";
062:            private final static String PATH_CTCON_INDEX_SHORT_DESCRIPTION = "Index of XPath segment";
063:
064:            public void initialize(InitializeConceptTagContext inIctc) {
065:
066:                //
067:                ConceptTagConstraintHolder rootCtconh = ConceptTagConstraintHolder
068:                        .newInstance(inIctc);
069:
070:                //constrain "path"
071:                ConceptTagConstraint pathCtcon = ConceptTagConstraint
072:                        .newInstance(PATH_CTCON, rootCtconh);
073:                pathCtcon.setTitle(PATH_TITLE);
074:                pathCtcon.setShortDescription(PATH_SHORT_DESCRIPTION);
075:                pathCtcon.setMinimumLength(1);
076:                pathCtcon.setLengthUnbounded(true);
077:                //
078:                CompoundConceptTagConstraintContext pathCctcc = CompoundConceptTagConstraintContext
079:                        .newInstance(pathCtcon);
080:                //
081:                pathCctcc.addDefaultValue();
082:
083:                //constrain "segment" of "path"
084:                ConceptTagConstraintTemplate pathCtconSegmentCtctemp = ConceptTagConstraintTemplate
085:                        .newInstance(PATH_CTCON_SEGMENT_CTCTEMP, pathCctcc);
086:                pathCtconSegmentCtctemp.setTitle(PATH_CTCON_SEGMENT_TITLE);
087:                pathCtconSegmentCtctemp
088:                        .setShortDescription(PATH_CTCON_SEGMENT_SHORT_DESCRIPTION);
089:                //
090:                StaticConceptTagConstraintContext pathCtconSegmentSctcc = StaticConceptTagConstraintContext
091:                        .newInstance(pathCtconSegmentCtctemp);
092:                //
093:                pathCtconSegmentSctcc.addDefaultValue("SegmentName");
094:
095:                //constrain "index" of "path"
096:                ConceptTagConstraintTemplate pathCtconIndexCtcont = ConceptTagConstraintTemplate
097:                        .newInstance(PATH_CTCON_INDEX_CTCTEMP, pathCctcc);
098:                pathCtconIndexCtcont.setTitle(PATH_CTCON_INDEX_TITLE);
099:                pathCtconIndexCtcont
100:                        .setShortDescription(PATH_CTCON_INDEX_SHORT_DESCRIPTION);
101:                //
102:                StaticConceptTagConstraintContext pathCtconIndexSctcc = StaticConceptTagConstraintContext
103:                        .newInstance(pathCtconIndexCtcont);
104:                //
105:                pathCtconIndexSctcc.addDefaultValue("1");
106:
107:                inIctc.initialize();
108:
109:                //initialize ConceptTag characteristics
110:                this .pathCtchar = pathCtcon.getCharacteristic();
111:
112:            }
113:
114:            public void appraise(AppraiseConceptTagContext inCtic) {
115:                if (inCtic instanceof  StudioConceptTagInstanceInfoContext) {
116:                    StudioConceptTagInstanceInfoContext stiic = (StudioConceptTagInstanceInfoContext) inCtic;
117:
118:                    stiic.setInstanceTitle("Get Trigger Text");
119:                    stiic
120:                            .setInstanceDescription("Get the text within the element of a trigger");
121:                    /*
122:                    if (this.pathTc.getValueLength() == 1) {
123:                        //initialize first operand
124:                        String operandTitle1 = "";
125:                        String operandDesc1 = "";
126:                        if (this.pathTc.isStatic(0)) {
127:                            operandTitle1 = this.pathTc.getValueAsString(0);
128:                            operandDesc1 = this.pathTc.getValueAsString(0);
129:                        }
130:                        else if (this.pathTc.isDynamic(0)) {
131:                            StudioConceptTagInstanceInfoContext nextStiic =
132:                                this.pathTc.getConceptTagInstanceInformation(0);
133:                            
134:                            operandTitle1 = nextStiic.getConceptTagInstanceTitle();
135:                            operandDesc1 = nextStiic.getConceptTagInstanceDescription();
136:                        }
137:                        //set title and description
138:                        stiic.setConceptTagInstanceTitle(
139:                            "Trigger(" + operandTitle1 + "/(#text))");
140:                        stiic.setConceptTagInstanceDescription(
141:                            "Trigger(" + operandDesc1 + "/(#text))");
142:                    }
143:                    else {
144:                        stiic.setConceptTagInstanceTitle("(Error)");
145:                        stiic.setConceptTagInstanceDescription("(Error)");
146:                    }
147:                     */
148:                } else if (inCtic instanceof  StudioConceptTagTypeInfoContext) {
149:                    StudioConceptTagTypeInfoContext scttic = (StudioConceptTagTypeInfoContext) inCtic;
150:                    scttic.setTypeTitle("Get Trigger Text");
151:                    scttic
152:                            .setTypeDescription("Get the text within the element of a trigger");
153:                }
154:            }
155:
156:            public void determineValueAndClass(
157:                    DetermineValueAndClassConceptTagContext inRvacc) {
158:
159:                try {
160:                    ValueAndClassForConceptTag outValue = null;
161:
162:                    ComponentsForReturnableWorkflowTemplateTag wcfrt = WorkflowTemplateTagHelper
163:                            .getComponentsForReturnableWorkflowTemplateTag(inRvacc);
164:
165:                    WorkflowTrigger t = wcfrt.getWorkflowTrigger();
166:
167:                    ConceptTagCharacteristicHolder pathCtconh = this .pathCtchar
168:                            .getValueAsHolder(0, inRvacc);
169:
170:                    //ConceptTagConstraint segmentCtcon =
171:                    //    pathCtconh.getConceptTagConstraint(
172:                    //        PATH_CTCON_SEGMENT_CTCTEMP);
173:                    ConceptTagCharacteristic segmentCtchar = pathCtconh
174:                            .getCharacteristic(PATH_CTCON_SEGMENT_CTCTEMP);
175:                    String segment = segmentCtchar.getValueAsString(0, inRvacc);
176:                    //
177:                    //ConceptTagConstraint indexCtcon =
178:                    //    pathCtconh.getConceptTagConstraint(PATH_CTCON_INDEX_CTCTEMP);
179:                    ConceptTagCharacteristic indexCtchar = pathCtconh
180:                            .getCharacteristic(PATH_CTCON_INDEX_CTCTEMP);
181:                    int index = Integer.parseInt(indexCtchar.getValueAsString(
182:                            0, inRvacc));
183:
184:                    LinearXPath xpath = LinearXPath.r(segment);
185:
186:                    //note that this starts with 1, not 0
187:                    for (int i = 1; i < this .pathCtchar.getValueLength(); i++) {
188:                        //
189:                        pathCtconh = this .pathCtchar.getValueAsHolder(i,
190:                                inRvacc);
191:                        //
192:                        //segmentCtcon =
193:                        //    pathCtconh.getConceptTagConstraint(
194:                        //        PATH_CTCON_SEGMENT_CTCTEMP);
195:                        segmentCtchar = pathCtconh
196:                                .getCharacteristic(PATH_CTCON_SEGMENT_CTCTEMP);
197:                        segment = segmentCtchar.getValueAsString(0, inRvacc);
198:                        //
199:                        //indexCtcon = pathCtconh.getConceptTagConstraint(
200:                        //    PATH_CTCON_INDEX_CTCTEMP);
201:                        indexCtchar = pathCtconh
202:                                .getCharacteristic(PATH_CTCON_INDEX_CTCTEMP);
203:                        index = Integer.parseInt(indexCtchar.getValueAsString(
204:                                0, inRvacc));
205:                        //
206:                        xpath = xpath.b(segment, index);
207:                    }
208:
209:                    Document doc = XMLHelper.loadDocument(t.getDataAsString());
210:                    Element elementXpath = LinearXPathHelper.getXPathElement(
211:                            doc, xpath);
212:                    String xpathData = XMLHelper.getText(elementXpath);
213:
214:                    outValue = ValueAndClassForConceptTag.newInstance(
215:                            xpathData, String.class);
216:
217:                    inRvacc.setDetermineValueAndClass(outValue);
218:                } catch (ParserConfigurationException pce) {
219:                    inRvacc.setDetermineException(pce);
220:                } catch (SAXException saxe) {
221:                    inRvacc.setDetermineException(saxe);
222:                } catch (IOException ioe) {
223:                    inRvacc.setDetermineException(ioe);
224:                }
225:            }
226:
227:            public void determineClass(DetermineClassConceptTagContext inRcc) {
228:                inRcc.setDetermineClass(String.class);
229:            }
230:
231:            /*
232:            public void getConceptTagSummary(ConceptTagSummaryDescriptor tsd) {
233:                //TO DO: placeholder, put meaningful description
234:                if (tsd.getMimeType().equals(ConceptTagSummaryMimeType.TEXT_HTML)) {
235:                    tsd.appendData("Get text from trigger element <i>"
236:                        + this.pathAttr[0] + "</i>");
237:                }
238:            }
239:             */
240:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.