Source Code Cross Referenced for SetApplicationAttributeWorkflowTemplateTag.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.AppraiseConceptTagContext;
014:        import org.jfolder.common.tagging.ConceptTagCharacteristic;
015:        import org.jfolder.common.tagging.ConceptTagConstraint;
016:        import org.jfolder.common.tagging.ConceptTagConstraintHolder;
017:        import org.jfolder.common.tagging.DetermineClassConceptTagContext;
018:        import org.jfolder.common.tagging.DetermineValueAndClassConceptTagContext;
019:        import org.jfolder.common.tagging.DetermineValueAndClassConceptTagException;
020:        import org.jfolder.common.tagging.DynamicConceptTagConstraintContext;
021:        import org.jfolder.common.tagging.InitializeConceptTagContext;
022:        import org.jfolder.common.tagging.ReturnableConceptTag;
023:        import org.jfolder.common.tagging.StaticConceptTagConstraintContext;
024:        import org.jfolder.common.tagging.StudioConceptTagInstanceInfoContext;
025:        import org.jfolder.common.tagging.StudioConceptTagTypeInfoContext;
026:        import org.jfolder.common.tagging.ValueAndClassForConceptTag;
027:        import org.jfolder.common.utils.misc.CommonExpressions;
028:        import org.jfolder.common.utils.misc.MiscHelper;
029:        import org.jfolder.workflow.model.attributes.AttributeSet;
030:        import org.jfolder.workflow.model.template.*;
031:
032:        //other classes
033:
034:        public class SetApplicationAttributeWorkflowTemplateTag implements 
035:                ReturnableConceptTag {
036:
037:            //characteristics
038:            private ConceptTagCharacteristic nameCtchar = null;
039:            private ConceptTagCharacteristic operandCtchar = null;
040:            private String attributeClass = null;
041:
042:            //name details
043:            private final static String NAME_CTCON = "name";
044:            private final static String NAME_TITLE = "Application Attribute";
045:            private final static String NAME_SHORT_DESCRIPTION = "Application attribute to be set by operand";
046:
047:            //operand details
048:            private final static String OPERAND_CTCON = "operand";
049:            private final static String OPERAND_TITLE = "Operand";
050:            private final static String OPERAND_SHORT_DESCRIPTION = "Value that will be assigned to the application attribute";
051:
052:            public void initialize(InitializeConceptTagContext inIctc) {
053:
054:                //
055:                ConceptTagConstraintHolder rootCtconh = ConceptTagConstraintHolder
056:                        .newInstance(inIctc);
057:
058:                //constrain "name"
059:                ConceptTagConstraint nameCtcon = ConceptTagConstraint
060:                        .newInstance(NAME_CTCON, rootCtconh);
061:                nameCtcon.setTitle(NAME_TITLE);
062:                nameCtcon.setShortDescription(NAME_SHORT_DESCRIPTION);
063:                //
064:                StaticConceptTagConstraintContext nameSctcc = StaticConceptTagConstraintContext
065:                        .newInstance(nameCtcon);
066:                nameSctcc.setRegularExpression(CommonExpressions.JAVA_NAME);
067:                //
068:                nameSctcc.addDefaultValue("AttributeNameHere");
069:                //((InitializeConceptTagContextBean)inItc).requireAttributeUse(
070:                //    this.nameTc);
071:                //TO DO: check if attribute exists
072:
073:                //constrain "operand"
074:                ConceptTagConstraint operandCtcon = ConceptTagConstraint
075:                        .newInstance(OPERAND_CTCON, rootCtconh);
076:                operandCtcon.setTitle(OPERAND_TITLE);
077:                operandCtcon.setShortDescription(OPERAND_SHORT_DESCRIPTION);
078:                //dtc1.setClassRestrictions(ReturnableTag.class);
079:                //dtc1.setReturnClassRestrictions(Object.class);
080:                //
081:                DynamicConceptTagConstraintContext operandDctcc = DynamicConceptTagConstraintContext
082:                        .newInstance(operandCtcon);
083:                operandDctcc.getValidator()
084:                        .allowReturnOfAnythingExceptNothing();
085:                //
086:                operandDctcc
087:                        .addDefaultValue(GetApplicationAttributeWorkflowTemplateTag.class);
088:                //TO DO: possibly constrain return type here instead of below?
089:
090:                inIctc.initialize();
091:
092:                //initialize characteristics
093:                this .nameCtchar = nameCtcon.getCharacteristic();
094:                this .operandCtchar = operandCtcon.getCharacteristic();
095:
096:                //TO DO: change this
097:                this .attributeClass = Object.class.getName();
098:                //TO DO: check if casting is acceptable after initialization
099:                //post initialization
100:                //if (this.nameTc.getValueLength() >= 1 && this.nameTc.isStatic(0)) {
101:                //    this.attributeClass =
102:                //        ((InitializeConceptTagContextBean)inItc).getAttributeClass(
103:                //            this.nameTc.getValueAsString(0));
104:                //}
105:                //else {
106:                //    this.attributeClass = Object.class.getName();
107:                //}
108:            }
109:
110:            public void appraise(AppraiseConceptTagContext inCtic) {
111:                if (inCtic instanceof  StudioConceptTagInstanceInfoContext) {
112:                    StudioConceptTagInstanceInfoContext sctiic = (StudioConceptTagInstanceInfoContext) inCtic;
113:                    String name = "(Unknown)";
114:                    if (this .nameCtchar.getValueLength() >= 1
115:                            && this .nameCtchar.isStatic(0, inCtic)) {
116:                        name = this .nameCtchar.getValueAsString(0, inCtic);
117:                    }
118:                    String resultTitle = "(Unknown)";
119:                    String resultDesc = "(Unknown)";
120:                    if (this .operandCtchar.isHolderWithConceptTag(0, inCtic)) {
121:                        StudioConceptTagInstanceInfoContext nextStiic = this .operandCtchar
122:                                .getInstanceInformation(0);
123:
124:                        resultTitle = nextStiic.getInstanceTitle();
125:                        resultDesc = nextStiic.getInstanceDescription();
126:                    }
127:                    sctiic.setInstanceTitle("SetAttribute(" + name + " = "
128:                            + resultTitle + ")");
129:                    sctiic
130:                            .setInstanceDescription("Set the value of an application attribute '"
131:                                    + name + "' equal to - " + resultDesc);
132:                } else if (inCtic instanceof  StudioConceptTagTypeInfoContext) {
133:                    StudioConceptTagTypeInfoContext scttic = (StudioConceptTagTypeInfoContext) inCtic;
134:                    scttic.setTypeTitle("Set Application Attribute");
135:                    scttic
136:                            .setTypeDescription("Assigns a new value to an application attribute");
137:                }
138:            }
139:
140:            public void determineValueAndClass(
141:                    DetermineValueAndClassConceptTagContext inRvacc) {
142:
143:                try {
144:                    ValueAndClassForConceptTag outValue = null;
145:
146:                    ComponentsForReturnableWorkflowTemplateTag wcfrt = WorkflowTemplateTagHelper
147:                            .getComponentsForReturnableWorkflowTemplateTag(inRvacc);
148:
149:                    AttributeSet as = wcfrt.getAttributeSet();
150:                    String name = this .nameCtchar.getValueAsString(0, inRvacc);
151:
152:                    if (!as.isAppAttrPresent(name)) {
153:                        inRvacc
154:                                .setDetermineException(new DetermineValueAndClassConceptTagException(
155:                                        "Application attribute '" + name
156:                                                + "' does not exist"));
157:                    } else {
158:                        as.setAppAttr(name, this .operandCtchar
159:                                .getDetermineValueAndClass(0, inRvacc));
160:
161:                        outValue = as.getAppAttr(name);
162:
163:                        inRvacc.setDetermineValueAndClass(outValue);
164:                    }
165:
166:                } catch (DetermineValueAndClassConceptTagException dvaccte) {
167:                    inRvacc.setDetermineException(dvaccte);
168:                }
169:            }
170:
171:            public void determineClass(DetermineClassConceptTagContext inRcc) {
172:
173:                try {
174:                    Class c = Class.forName(this .attributeClass);
175:                    inRcc.setDetermineClass(c);
176:                } catch (ClassNotFoundException cnfe) {
177:                    inRcc.setDetermineException(cnfe);
178:                }
179:            }
180:            /*
181:            public void getTagSummary(TagSummaryDescriptor tsd) {
182:                //TO DO: placeholder, put meaningful description
183:                if (tsd.getMimeType().equals(TagSummaryMimeType.TEXT_HTML)) {
184:                    tsd.appendData("Set <i>" + this.nameAttr[0] + "</i> equal to ");
185:                    if (this.returnableTags.size() > 0) {
186:                        ((Tag)(this.returnableTags.get(0))).getTagSummary(tsd);
187:                    }
188:                }
189:            }
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.