| Package: MachII.framework.commands |
| Inherits from: framework.Command |
| An Command for announcing an event. |
| Method Summary | |
|---|---|
| public AnnounceCommand |
init(string eventName, [boolean copyEventArgs="true"], [string moduleName=""])
Used by the framework for initialization. |
| public boolean |
execute(Event event, EventContext eventContext)
Executes the command. |
| private string | getEventName() |
| private string | getModuleName() |
| private boolean | isCopyEventArgs() |
| private void | setCopyEventArgs([boolean copyEventArgs="true"]) |
| private void | setEventName(string eventName) |
| private void | setModuleName(string moduleName) |
| Methods inherited from framework.Command: setParameter , getParameter , setParameters |
|---|
| Method Detail |
|---|
| execute |
|---|
public boolean execute( Event event, EventContext eventContext )
Executes the command.
Parameters:
| Event event |
| EventContext eventContext |
Code:
<cffunction name="execute" access="public" returntype="boolean" output="false" hint="Executes the command."> <cfargument name="event" type="MachII.framework.Event" required="true" /> <cfargument name="eventContext" type="MachII.framework.EventContext" required="true" /> <cfset var eventArgs = StructNew() /> <cfif isCopyEventArgs()> <cfset eventArgs = arguments.event.getArgs() /> </cfif> <cfset arguments.eventContext.announceEvent(getEventName(), eventArgs, getModuleName()) /> <cfreturn true /> </cffunction>
| getEventName |
|---|
private string getEventName( )
Parameters:
Code:
<cffunction name="getEventName" access="private" returntype="string" output="false"> <cfreturn variables.eventName /> </cffunction>
| getModuleName |
|---|
private string getModuleName( )
Parameters:
Code:
<cffunction name="getModuleName" access="private" returntype="string" output="false"> <cfreturn variables.moduleName /> </cffunction>
| init |
|---|
public AnnounceCommand init( string eventName, [boolean copyEventArgs="true"], [string moduleName=""] )
Used by the framework for initialization.
Parameters:
| string eventName |
| [boolean copyEventArgs="true"] |
| [string moduleName=""] |
Code:
<cffunction name="init" access="public" returntype="AnnounceCommand" output="false" hint="Used by the framework for initialization."> <cfargument name="eventName" type="string" required="true" /> <cfargument name="copyEventArgs" type="boolean" required="false" default="true" /> <cfargument name="moduleName" type="string" required="false" default="" /> <cfset setEventName(arguments.eventName) /> <cfset setCopyEventArgs(arguments.copyEventArgs) /> <cfset setModuleName(arguments.moduleName) /> <cfreturn this /> </cffunction>
| isCopyEventArgs |
|---|
private boolean isCopyEventArgs( )
Parameters:
Code:
<cffunction name="isCopyEventArgs" access="private" returntype="boolean" output="false"> <cfreturn variables.copyEventArgs /> </cffunction>
| setCopyEventArgs |
|---|
private void setCopyEventArgs( [boolean copyEventArgs="true"] )
Parameters:
| [boolean copyEventArgs="true"] |
Code:
<cffunction name="setCopyEventArgs" access="private" returntype="void" output="false"> <cfargument name="copyEventArgs" type="boolean" required="false" default="true" /> <cfset variables.copyEventArgs = arguments.copyEventArgs /> </cffunction>
| setEventName |
|---|
private void setEventName( string eventName )
Parameters:
| string eventName |
Code:
<cffunction name="setEventName" access="private" returntype="void" output="false"> <cfargument name="eventName" type="string" required="true" /> <cfset variables.eventName = arguments.eventName /> </cffunction>
| setModuleName |
|---|
private void setModuleName( string moduleName )
Parameters:
| string moduleName |
Code:
<cffunction name="setModuleName" access="private" returntype="void" output="false"> <cfargument name="moduleName" type="string" required="true" /> <cfset variables.moduleName = arguments.moduleName /> </cffunction>