Source Code Cross Referenced for WorkflowTrigger.java in  » Workflow-Engines » JFolder » org » jfolder » workflow » model » trigger » 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.trigger 
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.trigger;
009:
010:        //base classes
011:        import java.util.ArrayList;
012:        import java.util.HashMap;
013:        import java.util.Iterator;
014:
015:        //project specific classes
016:        import org.jfolder.common.UnexpectedSystemException;
017:        import org.jfolder.security.audit.SecurityAudit;
018:        import org.jfolder.workflow.model.WorkflowComponent;
019:        import org.jfolder.workflow.model.WorkflowComponentApplyUpdatesContext;
020:        import org.jfolder.workflow.model.WorkflowComponentIdentifyUpdatesContext;
021:        import org.jfolder.workflow.model.WorkflowComponentUpdates;
022:        import org.jfolder.workflow.model.dms.WorkflowDocumentGroup;
023:
024:        //other classes
025:
026:        public class WorkflowTrigger extends WorkflowComponent {
027:
028:            public final static String SUBMITTED = "SUBMITTED";
029:            public final static String PROCESSED = "PROCESSED";
030:            public final static String RETIRED = "RETIRED";
031:
032:            private String data = null;
033:            private String originalData = null;
034:            //private boolean previousTriggerPresent = false;
035:            //private TriggerData previousTrigger = null;
036:            //private String workflowId = null;
037:            //
038:            private HashMap propertiesMap = null;
039:            private ArrayList propertiesArray = null;
040:            private HashMap originalPropertiesMap = null;
041:
042:            //
043:
044:            //private TriggerDataBean(String inData, boolean inPreviousTriggerPresent,
045:            //    TriggerData inPreviousTrigger, WorkflowAudit inWa) {
046:            //    
047:            //    super(inWa);
048:            //    
049:            //    this.data = inData;
050:            //    this.previousTriggerPresent = inPreviousTriggerPresent;
051:            //    this.previousTrigger = inPreviousTrigger;
052:            //}
053:
054:            protected WorkflowTrigger() {
055:
056:                super ();
057:                //
058:                this .propertiesMap = new HashMap();
059:                this .propertiesArray = new ArrayList();
060:                this .originalPropertiesMap = new HashMap();
061:                //
062:                //this.data = inData;
063:                //this.workflowId = inWorkflowId;
064:            }
065:
066:            public final static WorkflowTrigger newInstance() {
067:
068:                return new WorkflowTrigger();
069:            }
070:
071:            //protected TriggerDataBean(String inData, TriggerData inPreviousTrigger,
072:            //    WorkflowAudit inWa) {
073:            //
074:            //    this(inData, true, inPreviousTrigger, inWa);
075:            //}
076:
077:            public String getDataAsString() {
078:                return this .data;
079:            }
080:
081:            public void setDataAsString(String inData) {
082:                this .data = inData;
083:            }
084:
085:            //public boolean isPreviousTriggerPresent() {
086:            //    return this.previousTriggerPresent;
087:            //}
088:
089:            //public TriggerData getPreviousTrigger() {
090:            //    return this.previousTrigger;
091:            //}
092:
093:            //public String getWorkflowId() {
094:            //    return this.workflowId;
095:            //}
096:            //
097:            //public void setWorkflowId(String inWorkflowId) {
098:            //    this.workflowId = inWorkflowId;
099:            //}
100:
101:            //public void setAuditStatus(String inStatus) {
102:            //    super.setAuditStatus(inStatus);
103:            //}
104:
105:            public String getProperty(String inName) {
106:
107:                String outValue = null;
108:
109:                if (this .propertiesMap.containsKey(inName)) {
110:                    outValue = (String) this .propertiesMap.get(inName);
111:                } else {
112:                    throw new UnexpectedSystemException("Property '" + inName
113:                            + "' does not exist");
114:                }
115:
116:                return outValue;
117:            }
118:
119:            public String getPropertyName(int inIndex) {
120:
121:                String outValue = null;
122:
123:                outValue = (String) this .propertiesArray.get(inIndex);
124:
125:                return outValue;
126:            }
127:
128:            public String getProperty(int inIndex) {
129:
130:                String outValue = null;
131:
132:                String propName = (String) this .propertiesArray.get(inIndex);
133:                outValue = (String) this .propertiesMap.get(propName);
134:
135:                return outValue;
136:            }
137:
138:            public int getPropertyCount() {
139:                return this .propertiesArray.size();
140:            }
141:
142:            public boolean isPropertyPresent(String inName) {
143:                return this .propertiesMap.containsKey(inName);
144:            }
145:
146:            public void addProperty(String inName, String inValue) {
147:                if (!this .propertiesMap.containsKey(inName)) {
148:                    this .propertiesMap.put(inName, inValue);
149:                    this .propertiesArray.add(inName);
150:                } else {
151:                    throw new UnexpectedSystemException("Property '" + inName
152:                            + "' already exists");
153:                }
154:            }
155:
156:            public void updateProperty(String inName, String inValue) {
157:                if (this .propertiesMap.containsKey(inName)) {
158:                    this .propertiesMap.put(inName, inValue);
159:                } else {
160:                    throw new UnexpectedSystemException("Property '" + inName
161:                            + "' does not exists");
162:                }
163:            }
164:
165:            public void removeProperty(String inName) {
166:                if (this .propertiesMap.containsKey(inName)) {
167:                    this .propertiesMap.remove(inName);
168:                    this .propertiesArray.remove(inName);
169:                } else {
170:                    throw new UnexpectedSystemException("Property '" + inName
171:                            + "' does not exists");
172:                }
173:            }
174:
175:            public WorkflowComponentUpdates identifyUpdates(
176:                    WorkflowComponentIdentifyUpdatesContext inWciuc) {
177:
178:                WorkflowTriggerUpdates outValue = new WorkflowTriggerUpdates();
179:
180:                //
181:                //PROPERTIES
182:                //
183:                ArrayList propCommands = new ArrayList();
184:                ArrayList propNames = new ArrayList();
185:                ArrayList propValues = new ArrayList();
186:                //
187:                HashMap removePropMap = (HashMap) this .originalPropertiesMap
188:                        .clone();
189:                //
190:                Iterator addUpdatePropIter = this .propertiesMap.keySet()
191:                        .iterator();
192:                while (addUpdatePropIter.hasNext()) {
193:                    String nextPropName = (String) addUpdatePropIter.next();
194:                    String nextPropValue = (String) this .propertiesMap
195:                            .get(nextPropName);
196:                    if (!(removePropMap.containsKey(nextPropName))) {
197:                        propCommands.add(WorkflowTriggerUpdates.ADD);
198:                        propNames.add(nextPropName);
199:                        propValues.add(nextPropValue);
200:                    } else {
201:                        String origPropValue = (String) removePropMap
202:                                .get(nextPropName);
203:                        removePropMap.remove(nextPropName);
204:                        if (!(origPropValue.equals(nextPropValue))) {
205:                            propCommands.add(WorkflowTriggerUpdates.UPDATE);
206:                            propNames.add(nextPropName);
207:                            propValues.add(nextPropValue);
208:                        } else {
209:                            //values the same, no change necessary
210:                        }
211:                    }
212:                }
213:                //
214:                Iterator removePropIter = removePropMap.keySet().iterator();
215:                while (removePropIter.hasNext()) {
216:                    String nextPropName = (String) removePropIter.next();
217:                    String nextPropValue = (String) removePropMap
218:                            .get(nextPropName);
219:                    //
220:                    propCommands.add(WorkflowTriggerUpdates.REMOVE);
221:                    propNames.add(nextPropName);
222:                    propValues.add(nextPropValue);
223:                }
224:                //
225:                outValue
226:                        .setPropertyUpdates(propCommands, propNames, propValues);
227:                //
228:                //DATA
229:                //
230:                String updateData = null;
231:                if (this .data != null) {
232:                    if ((this .originalData) == null
233:                            || (this .data.equals(this .originalData))) {
234:                        updateData = this .data;
235:                    }
236:                } else {
237:                    throw new UnexpectedSystemException("Trigger data not set");
238:                }
239:
240:                //
241:                //RESET
242:                //
243:                //this.refreshSecurityAudit(inSa);
244:                this .originalPropertiesMap = (HashMap) this .propertiesMap
245:                        .clone();
246:                //
247:                this .originalData = this .data;
248:                //this.annotations = new ArrayList();
249:
250:                return outValue;
251:            }
252:
253:            //public WorkflowComponentUpdates identifyUpdates(
254:            //    WorkflowComponentIdentifyUpdatesContext inWciuc) {
255:            //    throw UnexpectedSystemException.notImplemented();
256:            //}
257:
258:            public void applyUpdates(
259:                    WorkflowComponentApplyUpdatesContext inWcauc) {
260:                throw UnexpectedSystemException.notImplemented();
261:            }
262:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.