| Package: MachII.framework.commands |
| Inherits from: framework.Command |
| An Command for announcing an event. |
<!--- License: Copyright 2008 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: AnnounceCommand.cfc 772 2008-05-11 03:23:00Z peterfarrell $ Created version: 1.0.0 Updated version: 1.5.0 Notes: ---> |
| 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([string copyEventArgs="true"]) |
| private void | setEventName(string eventName) |
| private void | setModuleName(string moduleName) |
| Methods inherited from framework.Command: setParameters , getParameter , setLog , setParameter , getLog |
|---|
| 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( [string copyEventArgs="true"] )
Parameters:
| [string copyEventArgs="true"] |
Code:
<cffunction name="setCopyEventArgs" access="private" returntype="void" output="false"> <cfargument name="copyEventArgs" type="string" required="false" default="true" /> <cfset variables.copyEventArgs = (arguments.copyEventArgs IS NOT "false") /> </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>