framework.Command | +--framework.commands.EventArgCommand
| Method Summary | |
public EventArgCommand |
init(string argName, [string argValue=""], [string argVariable=""])
Used by the framework for initialization. |
public boolean |
execute(Event event, EventContext eventContext)
Executes the command. |
private string |
getArgName()
|
private string |
getArgValue()
|
private string |
getArgVariable()
|
private any |
getArgVariableValue()
|
private boolean |
isArgValueDefined()
|
private boolean |
isArgVariableDefined()
|
private void |
setArgName(string argName)
|
private void |
setArgValue(string argValue)
|
private void |
setArgVariable(string argVariable)
|
| Methods inherited from framework.Command |
setParameter,
getParameter,
setParameters
|
| Method Detail |
public boolean execute(Event event, EventContext eventContext)
Event eventEventContext eventContext<cffunction name="execute" access="public" returntype="boolean" hint="Executes the command."> <cfargument name="event" type="MachII.framework.Event" required="true" /> <cfargument name="eventContext" type="MachII.framework.EventContext" required="true" /> <cfset var value = "" /> <cfif isArgVariableDefined()> <cfset value = getArgVariableValue() /> <cfelseif isArgValueDefined()> <cfset value = getArgValue() /> <cfelse> <cfset value = "" /> </cfif> <cfset arguments.event.setArg(getArgName(), value) /> <cfreturn true /> </cffunction>
private string getArgName()
<cffunction name="getArgName" access="private" returntype="string" output="false"> <cfreturn variables.argName /> </cffunction>
private string getArgValue()
<cffunction name="getArgValue" access="private" returntype="string" output="false"> <cfreturn variables.argValue /> </cffunction>
private string getArgVariable()
<cffunction name="getArgVariable" access="private" returntype="string" output="false"> <cfreturn variables.argVariable /> </cffunction>
private any getArgVariableValue()
<cffunction name="getArgVariableValue" access="private" returntype="any" output="false"> <cfset var value = "" /> <cfif IsDefined(getArgVariable())> <cfset value = Evaluate(getArgVariable()) /> </cfif> <cfreturn value /> </cffunction>
public EventArgCommand init(string argName, [string argValue=""], [string argVariable=""])
string argName[string argValue=""][string argVariable=""]<cffunction name="init" access="public" returntype="EventArgCommand" output="false" hint="Used by the framework for initialization."> <cfargument name="argName" type="string" required="true" /> <cfargument name="argValue" type="string" required="false" default="" /> <cfargument name="argVariable" type="string" required="false" default="" /> <cfset setArgName(arguments.argName) /> <cfset setArgValue(arguments.argValue) /> <cfset setArgVariable(arguments.argVariable) /> <cfreturn this /> </cffunction>
private boolean isArgValueDefined()
<cffunction name="isArgValueDefined" access="private" returntype="boolean" output="false"> <cfreturn NOT getArgValue() EQ '' /> </cffunction>
private boolean isArgVariableDefined()
<cffunction name="isArgVariableDefined" access="private" returntype="boolean" output="false"> <cfreturn NOT getArgVariable() EQ '' /> </cffunction>
private void setArgName(string argName)
string argName<cffunction name="setArgName" access="private" returntype="void" output="false"> <cfargument name="argName" type="string" required="true" /> <cfset variables.argName = arguments.argName /> </cffunction>
private void setArgValue(string argValue)
string argValue<cffunction name="setArgValue" access="private" returntype="void" output="false"> <cfargument name="argValue" type="string" required="true" /> <cfset variables.argValue = arguments.argValue /> </cffunction>
private void setArgVariable(string argVariable)
string argVariable<cffunction name="setArgVariable" access="private" returntype="void" output="false"> <cfargument name="argVariable" type="string" required="true" /> <cfset variables.argVariable = arguments.argVariable /> </cffunction>
<!---
License:
Copyright 2007 GreatBizTools, LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Copyright: GreatBizTools, LLC
Author: Ben Edwards (ben@ben-edwards.com)
$Id: EventArgCommand.cfc 482 2007-09-05 02:07:07Z pfarrell $
Created version: 1.0.0
Updated version: 1.5.0
Notes:
--->
<cfcomponent
displayname="EventArgCommand"
extends="MachII.framework.Command"
output="false"
hint="An Command for putting an event arg into the current event.">
<!---
PROPERTIES
--->
<cfset variables.argName = "" />
<cfset variables.argValue = "" />
<cfset variables.argVariable = "" />
<!---
INITIALIZATION / CONFIGURATION
--->
<cffunction name="init" access="public" returntype="EventArgCommand" output="false"
hint="Used by the framework for initialization.">
<cfargument name="argName" type="string" required="true" />
<cfargument name="argValue" type="string" required="false" default="" />
<cfargument name="argVariable" type="string" required="false" default="" />
<cfset setArgName(arguments.argName) />
<cfset setArgValue(arguments.argValue) />
<cfset setArgVariable(arguments.argVariable) />
<cfreturn this />
</cffunction>
<!---
PUBLIC FUNCTIONS
--->
<cffunction name="execute" access="public" returntype="boolean"
hint="Executes the command.">
<cfargument name="event" type="MachII.framework.Event" required="true" />
<cfargument name="eventContext" type="MachII.framework.EventContext" required="true" />
<cfset var value = "" />
<cfif isArgVariableDefined()>
<cfset value = getArgVariableValue() />
<cfelseif isArgValueDefined()>
<cfset value = getArgValue() />
<cfelse>
<cfset value = "" />
</cfif>
<cfset arguments.event.setArg(getArgName(), value) />
<cfreturn true />
</cffunction>
<!---
ACCESSORS
--->
<cffunction name="setArgName" access="private" returntype="void" output="false">
<cfargument name="argName" type="string" required="true" />
<cfset variables.argName = arguments.argName />
</cffunction>
<cffunction name="getArgName" access="private" returntype="string" output="false">
<cfreturn variables.argName />
</cffunction>
<cffunction name="setArgValue" access="private" returntype="void" output="false">
<cfargument name="argValue" type="string" required="true" />
<cfset variables.argValue = arguments.argValue />
</cffunction>
<cffunction name="getArgValue" access="private" returntype="string" output="false">
<cfreturn variables.argValue />
</cffunction>
<cffunction name="isArgValueDefined" access="private" returntype="boolean" output="false">
<cfreturn NOT getArgValue() EQ '' />
</cffunction>
<cffunction name="setArgVariable" access="private" returntype="void" output="false">
<cfargument name="argVariable" type="string" required="true" />
<cfset variables.argVariable = arguments.argVariable />
</cffunction>
<cffunction name="getArgVariable" access="private" returntype="string" output="false">
<cfreturn variables.argVariable />
</cffunction>
<cffunction name="isArgVariableDefined" access="private" returntype="boolean" output="false">
<cfreturn NOT getArgVariable() EQ '' />
</cffunction>
<cffunction name="getArgVariableValue" access="private" returntype="any" output="false">
<cfset var value = "" />
<cfif IsDefined(getArgVariable())>
<cfset value = Evaluate(getArgVariable()) />
</cfif>
<cfreturn value />
</cffunction>
</cfcomponent>