Sorcerer's IsleCode QueryParam Scanner / files

     1<!---
     2Copyright 2006-2007 TeraTech, Inc. http://teratech.com/
     3
     4Licensed under the Apache License, Version 2.0 (the "License");
     5you may not use this file except in compliance with the License.
     6You may obtain a copy of the License at
     7
     8http://www.apache.org/licenses/LICENSE-2.0
     9
    10Unless required by applicable law or agreed to in writing, software
    11distributed under the License is distributed on an "AS IS" BASIS,
    12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13See the License for the specific language governing permissions and
    14limitations under the License.
    15--->
    16<cfcomponent output="false" 
    17			hint="I represent a fuseaction within a circuit.">
    18
    19	<cffunction name="init" returntype="any" access="public" output="false" 
    20				hint="I am the constructor.">
    21		<cfargument name="circuit" type="any" required="false" 
    22					hint="I am the circuit to which this fuseaction belongs. I am required but it's faster to specify that I am not required." />
    23		<cfargument name="name" type="any" required="false" 
    24					hint="I am the name of the fuseaction. I am required but it's faster to specify that I am not required." />
    25		<cfargument name="access" type="any" required="false" 
    26					hint="I am the access criteria for the fuseaction. I am required but it's faster to specify that I am not required." />
    27		<cfargument name="children" type="any" required="false" 
    28					hint="I am the verbs for this fuseaction. I am required but it's faster to specify that I am not required." />
    29		<cfargument name="global" type="any" default="false" 
    30					hint="I indicate whether or not this is a globalfuseaction in fusebox.xml." />
    31		<cfargument name="customAttribs" type="any" default="#structNew()#" 
    32					hint="I hold the custom (namespace-qualified) attributes in the fuseaction tag." />
    33		
    34		<cfset var i = 0 />
    35		<cfset var verb = "" />
    36		<cfset var factory = arguments.circuit.getApplication().getFuseactionFactory() />
    37
    38		<cfset variables.circuit = arguments.circuit />
    39		<cfset variables.name = arguments.name />
    40		<cfset variables.customAttributes = arguments.customAttribs />
    41		<cfset variables.nChildren = arrayLen(arguments.children) />
    42		<cfset variables.actions = structNew() />
    43		
    44		<cfset this.access = arguments.access />
    45		
    46		<cfloop from="1" to="#variables.nChildren#" index="i">
    47			<cfset variables.actions[i] = factory.create(arguments.children[i].xmlName,
    48					this,arguments.children[i].xmlAttributes,arguments.children[i].xmlChildren,
    49						arguments.global) />
    50		</cfloop>
    51		
    52		<cfreturn this />
    53		
    54	</cffunction>
    55	
    56	<cffunction name="compile" returntype="void" access="public" output="false" 
    57				hint="I compile this fuseaction.">
    58		<cfargument name="writer" type="any" required="false" 
    59					hint="I am the writer object to which the compiled code should be written. I am required but it's faster to specify that I am not required." />
    60	
    61		<cfset var i = 0 />
    62		<cfset var n = 0 />
    63		
    64		<cfloop from="1" to="#variables.nChildren#" index="i">
    65			<cfset variables.actions[i].compile(arguments.writer) />
    66		</cfloop>
    67		
    68	</cffunction>
    69	
    70	<cffunction name="getName" returntype="string" access="public" output="false" 
    71				hint="I return the name of the fuseaction.">
    72		
    73		<cfreturn variables.name />
    74		
    75	</cffunction>
    76
    77	<cffunction name="getCircuit" returntype="any" access="public" output="false" 
    78				hint="I return the enclosing circuit object.">
    79	
    80		<cfreturn variables.circuit />
    81	
    82	</cffunction>
    83	
    84	<cffunction name="getAccess" returntype="string" access="public" output="false" 
    85				hint="I am a convenience method to return this fuseaction's access attribute value.">
    86	
    87		<cfreturn this.access />
    88	
    89	</cffunction>
    90	
    91	<cffunction name="getPermissions" returntype="string" access="public" output="false" 
    92				hint="I return the aggregated permissions for this fuseaction.">
    93		<cfargument name="inheritFromCircuit" type="boolean" default="true" 
    94					hint="I indicate whether or not the circuit's permissions should be returned if this fuseaction has no permissions specified." />
    95		<cfargument name="useCircuitTrace" type="boolean" default="false" 
    96					hint="I indicate whether or not to inherit the parent circuit's permissions if this fuseaction's circuit has no permissions specified." />
    97	
    98		<cfif this.permissions is "" and arguments.inheritFromCircuit>
    99			<cfreturn getCircuit().getPermissions(arguments.useCircuitTrace) />
   100		<cfelse>
   101			<cfreturn this.permissions />
   102		</cfif>
   103	
   104	</cffunction>
   105	
   106	<cffunction name="getCustomAttributes" returntype="struct" access="public" output="false" 
   107				hint="I return the custom (namespace-qualified) attributes for this fuseaction tag.">
   108		<cfargument name="ns" type="string" required="true" 
   109					hint="I am the namespace prefix whose attributes should be returned." />
   110		
   111		<cfif structKeyExists(variables.customAttributes,arguments.ns)>
   112			<!--- we structCopy() this so folks can't poke values back into the metadata! --->
   113			<cfreturn structCopy(variables.customAttributes[arguments.ns]) />
   114		<cfelse>
   115			<cfreturn structNew() />
   116		</cfif>
   117		
   118	</cffunction>
   119	
   120</cfcomponent>