public
Description: Shade is a state machine (or workflow) engine for ColdFusion business objects.
Homepage:
Clone URL: git://github.com/ryanwood/shade.git
Clean up
ryanwood (author)
Fri Jul 18 13:20:38 -0700 2008
commit  4245d4bde90bb8ef808702716d99aedae1409387
tree    c11f3841bb68e555072486dd829866f411f7e1f3
parent  9bd2d89c803a6023caf640b7d8bd70f7cd4b4582
...
53
54
55
56
 
57
58
59
...
53
54
55
 
56
57
58
59
0
@@ -53,7 +53,7 @@
0
     <cfset instance.index = 1 />
0
   </cffunction>
0
   
0
-  <!--- IEnumerable Implementation --->
0
+  <!--- Iterator --->
0
   
0
   <cffunction name="next" access="public" output="false">
0
     <cfif hasNext()>
...
42
43
44
45
46
47
48
49
50
 
51
52
53
...
42
43
44
 
 
 
 
 
 
45
46
47
48
0
@@ -42,12 +42,7 @@
0
     </cfloop>  
0
     <cfreturn false />  
0
   </cffunction>  
0
-  
0
-  <cffunction name="transitions" access="public" output="false">
0
-    <cfargument name="record" required="true" />
0
-  </cffunction>
0
-  
0
-  
0
+    
0
   <cffunction name="getName" access="public" returntype="string" output="false">
0
     <cfreturn instance.name />
0
   </cffunction>
...
1
2
 
 
3
4
5
6
7
8
9
10
11
...
29
30
31
32
 
33
34
35
...
1
 
2
3
4
5
6
7
8
 
9
10
11
...
29
30
31
 
32
33
34
35
0
@@ -1,11 +1,11 @@
0
 <cfcomponent displayname="State" output="false">
0
-  <cfscript> instance = structNew(); </cfscript>
0
+  
0
+  <cfset instance = structNew() />
0
   
0
   <cffunction name="init" access="public" output="false">
0
     <cfargument name="name" type="string" required="true" />
0
     <cfscript>
0
       instance.name = arguments.name;
0
-      instance.callbacks = structNew();
0
     </cfscript>      
0
     <cfreturn this />
0
   </cffunction>
0
@@ -29,7 +29,7 @@
0
     <cfset invokeCallback('exit#getName()#Action', arguments.obj) />
0
   </cffunction>
0
   
0
-  <cffunction name="invokeCallback" returntype="boolean" access="public" output="false">
0
+  <cffunction name="invokeCallback" returntype="boolean" access="private" output="false">
0
     <cfargument name="callback" type="string" required="true" />
0
     <cfargument name="obj" required="true" />
0
     <cfif structKeyExists(arguments.obj, arguments.callback)>
...
79
80
81
 
82
83
84
...
87
88
89
90
91
 
92
93
94
...
132
133
134
135
 
 
136
 
 
 
 
 
137
138
139
...
159
160
161
162
 
163
164
165
...
79
80
81
82
83
84
85
...
88
89
90
 
 
91
92
93
94
...
132
133
134
 
135
136
137
138
139
140
141
142
143
144
145
...
165
166
167
 
168
169
170
171
0
@@ -79,6 +79,7 @@
0
   </cffunction>
0
   
0
   <!--- This should only be called once during init --->
0
+  
0
   <cffunction name="setInitialState" access="private" output="false">
0
     <cfargument name="stateName" required="true" />
0
     <cfscript>
0
@@ -87,8 +88,7 @@
0
       setState(arguments.stateName);
0
       state.after(this);
0
     </cfscript>
0
-  </cffunction>
0
-  
0
+  </cffunction>  
0
   
0
   <cffunction name="getCurrentState" access="public" returntype="string" output="false">
0
     <cfreturn invokeMethod("get#instance.stateMethod#") />
0
@@ -132,8 +132,14 @@
0
     <cfreturn '' />
0
   </cffunction>
0
   
0
-  <!--- Some method twisting --->
0
+  <!--- 
0
+  We are using onMissingMethod for three things:
0
   
0
+    1. To defined the state query handlers, i.e. isClosed()
0
+    2. To define the event firing shortcuts, i.e. close()
0
+    3. To pass any unknown method on to the decorated object to handle
0
+        
0
+  --->  
0
   <cffunction name="onMissingMethod" output="false" access="public">
0
     <cfargument name="missingMethodName" type="string" />
0
     <cfargument name="missingMethodArguments" type="struct" />
0
@@ -159,7 +165,7 @@
0
   
0
   <!--- Utility --->
0
   
0
-  <cffunction name="invokeMethod" access="public" returntype="Any" output="false">
0
+  <cffunction name="invokeMethod" access="private" returntype="Any" output="false">
0
     <cfargument name="method" type="string" required="true" />
0
     <cfargument name="argcollection" type="struct" required="false" default="#structNew()#" />         
0
 
...
62
63
64
65
66
67
68
69
70
71
72
...
75
76
77
78
79
80
81
82
83
84
...
62
63
64
 
 
 
 
 
65
66
67
...
70
71
72
 
 
 
 
 
73
74
0
@@ -62,11 +62,6 @@
0
      </cfscript>
0
   </cffunction>  
0
   
0
-  <cffunction name="isEqual" access="public" output="false">
0
-    <cfargument name="obj" required="true" />
0
-  </cffunction>
0
-  
0
-  
0
   <cffunction name="getFromState" access="public" returntype="string" output="false">
0
     <cfreturn instance.from />
0
   </cffunction>
0
@@ -75,9 +70,4 @@
0
     <cfreturn instance.to />
0
   </cffunction>
0
   
0
-  <cffunction name="setFromState" access="public" returntype="void" output="false">
0
-    <cfargument name="From" type="string" required="true" />
0
-    <cfset instance.from = arguments.from />
0
-  </cffunction>
0
-  
0
 </cfcomponent>
0
\ No newline at end of file

Comments