| Package: MachII.framework |
| Base component to load commands for the framework. |
| Method Summary | |
|---|---|
| public void |
init()
Initialization function called by the framework. |
| private Command | createCommand(any commandNode) |
| private AnnounceCommand |
setupAnnounce(any commandNode)
Sets up an announce command. |
| private Command |
setupDefault()
Sets up a default command. |
| private EventArgCommand |
setupEventArg(any commandNode)
Sets up an event-arg command. |
| private EventBeanCommand |
setupEventBean(any commandNode)
Sets up a event-bean command. |
| private EventMappingCommand |
setupEventMapping(any commandNode)
Sets up an event-mapping command. |
| private ExecuteCommand |
setupExecute(any commandNode)
Sets up an execute command. |
| private FilterCommand |
setupFilter(any commandNode)
Sets up a filter command. |
| private NotifyCommand |
setupNotify(any commandNode)
Sets up a notify command. |
| private RedirectCommand |
setupRedirect(any commandNode)
Sets up a redirect command. |
| private ViewPageCommand |
setupViewPage(any commandNode)
Sets up a view-page command. |
| Method Detail |
|---|
| createCommand |
|---|
private Command createCommand( any commandNode )
Parameters:
| any commandNode |
Code:
<cffunction name="createCommand" access="private" returntype="MachII.framework.Command" output="false"> <cfargument name="commandNode" type="any" required="true" /> <cfset var command = "" /> <cfif arguments.commandNode.xmlName EQ "view-page"> <cfset command = setupViewPage(arguments.commandNode) /> <cfelseif arguments.commandNode.xmlName EQ "notify"> <cfset command = setupNotify(arguments.commandNode) /> <cfelseif arguments.commandNode.xmlName EQ "announce"> <cfset command = setupAnnounce(arguments.commandNode) /> <cfelseif arguments.commandNode.xmlName EQ "event-mapping"> <cfset command = setupEventMapping(arguments.commandNode) /> <cfelseif arguments.commandNode.xmlName EQ "execute"> <cfset command = setupExecute(arguments.commandNode) /> <cfelseif arguments.commandNode.xmlName EQ "filter"> <cfset command = setupFilter(arguments.commandNode) /> <cfelseif arguments.commandNode.xmlName EQ "event-bean"> <cfset command = setupEventBean(arguments.commandNode) /> <cfelseif arguments.commandNode.xmlName EQ "redirect"> <cfset command = setupRedirect(arguments.commandNode) /> <cfelseif arguments.commandNode.xmlName EQ "event-arg"> <cfset command = setupEventArg(arguments.commandNode) /> <cfelse> <cfset command = setupDefault(arguments.commandNode) /> </cfif> <cfreturn command /> </cffunction>
| init |
|---|
public void init( )
Initialization function called by the framework.
Parameters:
Code:
<cffunction name="init" access="public" returntype="void" output="false" hint="Initialization function called by the framework."> </cffunction>
| setupAnnounce |
|---|
private AnnounceCommand setupAnnounce( any commandNode )
Sets up an announce command.
Parameters:
| any commandNode |
Code:
<cffunction name="setupAnnounce" access="private" returntype="MachII.framework.commands.AnnounceCommand" output="false"
hint="Sets up an announce command.">
<cfargument name="commandNode" type="any" required="true" />
<cfset var command = "" />
<cfset var eventName = arguments.commandNode.xmlAttributes["event"] />
<cfset var copyEventArgs = true />
<cfset var moduleName = "" />
<cfif StructKeyExists(arguments.commandNode.xmlAttributes, "copyEventArgs")>
<cfset copyEventArgs = arguments.commandNode.xmlAttributes["copyEventArgs"] />
</cfif>
<cfif StructKeyExists(arguments.commandNode.xmlAttributes, "module")>
<cfset moduleName = arguments.commandNode.xmlAttributes["module"] />
<cfelse>
<cfset moduleName = getAppManager().getModuleName() />
</cfif>
<cfset command = CreateObject("component", "MachII.framework.commands.AnnounceCommand").init(eventName, copyEventArgs, moduleName) />
<cfreturn command />
</cffunction>
| setupDefault |
|---|
private Command setupDefault( )
Sets up a default command.
Parameters:
Code:
<cffunction name="setupDefault" access="private" returntype="MachII.framework.Command" output="false"
hint="Sets up a default command.">
<cfset var command = CreateObject("component", "MachII.framework.Command").init() />
<cfreturn command />
</cffunction>
| setupEventArg |
|---|
private EventArgCommand setupEventArg( any commandNode )
Sets up an event-arg command.
Parameters:
| any commandNode |
Code:
<cffunction name="setupEventArg" access="private" returntype="MachII.framework.commands.EventArgCommand" output="false"
hint="Sets up an event-arg command.">
<cfargument name="commandNode" type="any" required="true" />
<cfset var command = "" />
<cfset var argValue = "" />
<cfset var argVariable = "" />
<cfset var argName = arguments.commandNode.xmlAttributes["name"] />
<cfif StructKeyExists(arguments.commandNode.xmlAttributes, "value")>
<cfset argValue = arguments.commandNode.xmlAttributes["value"] />
</cfif>
<cfif StructKeyExists(arguments.commandNode.xmlAttributes, "variable")>
<cfset argVariable = arguments.commandNode.xmlAttributes["variable"] />
</cfif>
<cfset command = CreateObject("component", "MachII.framework.commands.EventArgCommand").init(argName, argValue, argVariable) />
<cfreturn command />
</cffunction>
| setupEventBean |
|---|
private EventBeanCommand setupEventBean( any commandNode )
Sets up a event-bean command.
Parameters:
| any commandNode |
Code:
<cffunction name="setupEventBean" access="private" returntype="MachII.framework.commands.EventBeanCommand" output="false"
hint="Sets up a event-bean command.">
<cfargument name="commandNode" type="any" required="true" />
<cfset var command = "" />
<cfset var beanName = arguments.commandNode.xmlAttributes["name"] />
<cfset var beanType = arguments.commandNode.xmlAttributes["type"] />
<cfset var beanFields = "" />
<cfset var reinit = true />
<cfif StructKeyExists(arguments.commandNode.xmlAttributes, "fields")>
<cfset beanFields = arguments.commandNode.xmlAttributes["fields"] />
</cfif>
<cfif StructKeyExists(arguments.commandNode.xmlAttributes, "reinit")>
<cfset reinit = arguments.commandNode.xmlAttributes["reinit"] />
</cfif>
<cfset command = CreateObject("component", "MachII.framework.commands.EventBeanCommand").init(beanName, beanType, beanFields, reinit) />
<cfreturn command />
</cffunction>
| setupEventMapping |
|---|
private EventMappingCommand setupEventMapping( any commandNode )
Sets up an event-mapping command.
Parameters:
| any commandNode |
Code:
<cffunction name="setupEventMapping" access="private" returntype="MachII.framework.commands.EventMappingCommand" output="false"
hint="Sets up an event-mapping command.">
<cfargument name="commandNode" type="any" required="true" />
<cfset var command = "" />
<cfset var eventName = arguments.commandNode.xmlAttributes["event"] />
<cfset var mappingName = arguments.commandNode.xmlAttributes["mapping"] />
<cfset var mappingModule = "" />
<cfif StructKeyExists(arguments.commandNode.xmlAttributes, "mappingModule")>
<cfset mappingModule = arguments.commandNode.xmlAttributes["mappingModule"] />
<cfelse>
<cfset mappingModule = getAppManager().getModuleName() />
</cfif>
<cfset command = CreateObject("component", "MachII.framework.commands.EventMappingCommand").init(eventName, mappingName, mappingModule) />
<cfreturn command />
</cffunction>
| setupExecute |
|---|
private ExecuteCommand setupExecute( any commandNode )
Sets up an execute command.
Parameters:
| any commandNode |
Code:
<cffunction name="setupExecute" access="private" returntype="MachII.framework.commands.ExecuteCommand" output="false"
hint="Sets up an execute command.">
<cfargument name="commandNode" type="any" required="true" />
<cfset var command = "" />
<cfset var subroutine = arguments.commandNode.xmlAttributes["subroutine"] />
<cfset command = CreateObject("component", "MachII.framework.commands.ExecuteCommand").init(subroutine) />
<cfreturn command />
</cffunction>
| setupFilter |
|---|
private FilterCommand setupFilter( any commandNode )
Sets up a filter command.
Parameters:
| any commandNode |
Code:
<cffunction name="setupFilter" access="private" returntype="MachII.framework.commands.FilterCommand" output="false"
hint="Sets up a filter command.">
<cfargument name="commandNode" type="any" required="true" />
<cfset var command = "" />
<cfset var filterName = arguments.commandNode.xmlAttributes["name"] />
<cfset var filterParams = StructNew() />
<cfset var paramNodes = arguments.commandNode.xmlChildren />
<cfset var paramName = "" />
<cfset var paramValue = "" />
<cfset var filter = getAppManager().getFilterManager().getFilter(filterName) />
<cfset var i = "" />
<cfloop from="1" to="#ArrayLen(paramNodes)#" index="i">
<cfset paramName = paramNodes[i].xmlAttributes["name"] />
<cfif NOT StructKeyExists(paramNodes[i].xmlAttributes, "value")>
<cfset paramValue = getAppManager().getUtils().recurseComplexValues(paramNodes[i]) />
<cfelse>
<cfset paramValue = paramNodes[i].xmlAttributes["value"] />
</cfif>
<cfset filterParams[paramName] = paramValue />
</cfloop>
<cfset command = CreateObject("component", "MachII.framework.commands.FilterCommand").init(filter, filterParams) />
<cfreturn command />
</cffunction>
| setupNotify |
|---|
private NotifyCommand setupNotify( any commandNode )
Sets up a notify command.
Parameters:
| any commandNode |
Code:
<cffunction name="setupNotify" access="private" returntype="MachII.framework.commands.NotifyCommand" output="false"
hint="Sets up a notify command.">
<cfargument name="commandNode" type="any" required="true" />
<cfset var command = "" />
<cfset var notifyListener = arguments.commandNode.xmlAttributes["listener"] />
<cfset var notifyMethod = arguments.commandNode.xmlAttributes["method"] />
<cfset var notifyResultKey = "" />
<cfset var notifyResultArg = "" />
<cfset var listener = getAppManager().getListenerManager().getListener(notifyListener) />
<cfif StructKeyExists(arguments.commandNode.xmlAttributes, "resultKey")>
<cfset notifyResultKey = arguments.commandNode.xmlAttributes["resultKey"] />
</cfif>
<cfif StructKeyExists(arguments.commandNode.xmlAttributes, "resultArg")>
<cfset notifyResultArg = arguments.commandNode.xmlAttributes["resultArg"] />
</cfif>
<cfset command = CreateObject("component", "MachII.framework.commands.NotifyCommand").init(listener, notifyMethod, notifyResultKey, notifyResultArg) />
<cfreturn command />
</cffunction>
| setupRedirect |
|---|
private RedirectCommand setupRedirect( any commandNode )
Sets up a redirect command.
Parameters:
| any commandNode |
Code:
<cffunction name="setupRedirect" access="private" returntype="MachII.framework.commands.RedirectCommand" output="false"
hint="Sets up a redirect command.">
<cfargument name="commandNode" type="any" required="true" />
<cfset var command = "" />
<cfset var eventName = "" />
<cfset var redirectUrl = getAppManager().getPropertyManager().getProperty("urlBase", "index.cfm") />
<cfset var moduleName = "" />
<cfset var args = "" />
<cfset var persist = false />
<cfset var persistArgs = "" />
<cfset var statusType = "temporary" />
<cfset var eventParameter = getAppManager().getPropertyManager().getProperty("eventParameter", "event") />
<cfset var redirectPersistParameter = getAppManager().getPropertyManager().getProperty("redirectPersistParameter", "persistId") /> />
<cfif StructKeyExists(arguments.commandNode.xmlAttributes, "event")>
<cfset eventName = arguments.commandNode.xmlAttributes["event"] />
</cfif>
<cfif StructKeyExists(arguments.commandNode.xmlAttributes, "url")>
<cfset redirectUrl = arguments.commandNode.xmlAttributes["url"] />
</cfif>
<cfif StructKeyExists(arguments.commandNode.xmlAttributes, "args")>
<cfset args = arguments.commandNode.xmlAttributes["args"] />
</cfif>
<cfif StructKeyExists(arguments.commandNode.xmlAttributes, "persist")>
<cfset persist = arguments.commandNode.xmlAttributes["persist"] />
</cfif>
<cfif StructKeyExists(arguments.commandNode.xmlAttributes, "persistArgs")>
<cfset persistArgs = arguments.commandNode.xmlAttributes["persistArgs"] />
</cfif>
<cfif StructKeyExists(arguments.commandNode.xmlAttributes, "module")>
<cfset moduleName = arguments.commandNode.xmlAttributes["module"] />
<cfelse>
<cfset moduleName = getAppManager().getModuleName() />
</cfif>
<cfif StructKeyExists(arguments.commandNode.xmlAttributes, "statusType")>
<cfset statusType = arguments.commandNode.xmlAttributes["statusType"] />
</cfif>
<cfset command = CreateObject("component", "MachII.framework.commands.RedirectCommand").init(eventName, eventParameter, redirectPersistParameter, moduleName, redirectUrl, args, persist, persistArgs, statusType) />
<cfreturn command />
</cffunction>
| setupViewPage |
|---|
private ViewPageCommand setupViewPage( any commandNode )
Sets up a view-page command.
Parameters:
| any commandNode |
Code:
<cffunction name="setupViewPage" access="private" returntype="MachII.framework.commands.ViewPageCommand" output="false"
hint="Sets up a view-page command.">
<cfargument name="commandNode" type="any" required="true" />
<cfset var command = "" />
<cfset var viewName = arguments.commandNode.xmlAttributes["name"] />
<cfset var contentKey = "" />
<cfset var contentArg = "" />
<cfset var appendContent = "" />
<cfif StructKeyExists(arguments.commandNode.xmlAttributes, "contentKey")>
<cfset contentKey = commandNode.xmlAttributes["contentKey"] />
</cfif>
<cfif StructKeyExists(arguments.commandNode.xmlAttributes, "contentArg")>
<cfset contentArg = commandNode.xmlAttributes["contentArg"] />
</cfif>
<cfif StructKeyExists(arguments.commandNode.xmlAttributes, "append")>
<cfset appendContent = arguments.commandNode.xmlAttributes["append"] />
</cfif>
<cfset command = CreateObject("component", "MachII.framework.commands.ViewPageCommand").init(viewName, contentKey, contentArg, appendContent) />
<cfreturn command />
</cffunction>