| Package: MachII.framework.commands |
| Inherits from: framework.EventCommand |
| An EventCommand for creating and populating a bean in the current event. |
| Method Summary | |
|---|---|
| public void | init(string beanName, string beanType, string beanFields) |
| public boolean | execute(Event event, EventContext eventContext) |
| private string | getBeanFields() |
| private string | getBeanName() |
| private string | getBeanType() |
| private BeanUtil | getBeanUtil() |
| public boolean | isBeanFieldsDefined() |
| private void | setBeanFields(string beanFields) |
| private void | setBeanName(string beanName) |
| private void | setBeanType(string beanType) |
| private void | setBeanUtil(BeanUtil beanUtil) |
| Methods inherited from framework.EventCommand: setParameter , getParameter , setParameters |
|---|
| Method Detail |
|---|
| execute |
|---|
public boolean execute( Event event, EventContext eventContext )
Parameters:
| Event event |
| EventContext eventContext |
Code:
<cffunction name="execute" access="public" returntype="boolean"> <cfargument name="event" type="MachII.framework.Event" required="true" /> <cfargument name="eventContext" type="MachII.framework.EventContext" required="true" /> <cfset var bean = "" /> <cfif isBeanFieldsDefined()> <cfset bean = getBeanUtil().createBean(getBeanType()) /> <cfset getBeanUtil().setBeanFields(bean, getBeanFields(), arguments.event.getArgs()) /> <cfelse> <cfset bean = getBeanUtil().createBean(getBeanType(), arguments.event.getArgs()) /> </cfif> <cfset arguments.event.setArg(getBeanName(), bean, getBeanType()) /> <cfreturn true /> </cffunction>
| getBeanFields |
|---|
private string getBeanFields( )
Parameters:
Code:
<cffunction name="getBeanFields" access="private" returntype="string" output="false"> <cfreturn variables.beanFields /> </cffunction>
| getBeanName |
|---|
private string getBeanName( )
Parameters:
Code:
<cffunction name="getBeanName" access="private" returntype="string" output="false"> <cfreturn variables.beanName /> </cffunction>
| getBeanType |
|---|
private string getBeanType( )
Parameters:
Code:
<cffunction name="getBeanType" access="private" returntype="string" output="false"> <cfreturn variables.beanType /> </cffunction>
| getBeanUtil |
|---|
private BeanUtil getBeanUtil( )
Parameters:
Code:
<cffunction name="getBeanUtil" access="private" returntype="MachII.util.BeanUtil" output="false"> <cfreturn variables.beanUtil /> </cffunction>
| init |
|---|
public void init( string beanName, string beanType, string beanFields )
Parameters:
| string beanName |
| string beanType |
| string beanFields |
Code:
<cffunction name="init" access="public" returntype="void" output="false">
<cfargument name="beanName" type="string" required="true" />
<cfargument name="beanType" type="string" required="true" />
<cfargument name="beanFields" type="string" required="true" />
<cfset setBeanName(arguments.beanName) />
<cfset setBeanType(arguments.beanType) />
<cfset setBeanFields(arguments.beanFields) />
<cfset setBeanUtil( CreateObject('component','MachII.util.BeanUtil') ) />
</cffunction>
| isBeanFieldsDefined |
|---|
public boolean isBeanFieldsDefined( )
Parameters:
Code:
<cffunction name="isBeanFieldsDefined" access="public" returntype="boolean" output="false"> <cfreturn NOT getBeanFields() EQ '' /> </cffunction>
| setBeanFields |
|---|
private void setBeanFields( string beanFields )
Parameters:
| string beanFields |
Code:
<cffunction name="setBeanFields" access="private" returntype="void" output="false"> <cfargument name="beanFields" type="string" required="true" /> <cfset variables.beanFields = arguments.beanFields /> </cffunction>
| setBeanName |
|---|
private void setBeanName( string beanName )
Parameters:
| string beanName |
Code:
<cffunction name="setBeanName" access="private" returntype="void" output="false"> <cfargument name="beanName" type="string" required="true" /> <cfset variables.beanName = arguments.beanName /> </cffunction>
| setBeanType |
|---|
private void setBeanType( string beanType )
Parameters:
| string beanType |
Code:
<cffunction name="setBeanType" access="private" returntype="void" output="false"> <cfargument name="beanType" type="string" required="true" /> <cfset variables.beanType = arguments.beanType /> </cffunction>
| setBeanUtil |
|---|
private void setBeanUtil( BeanUtil beanUtil )
Parameters:
| BeanUtil beanUtil |
Code:
<cffunction name="setBeanUtil" access="private" returntype="void" output="false"> <cfargument name="beanUtil" type="MachII.util.BeanUtil" required="true" /> <cfset variables.beanUtil = arguments.beanUtil /> </cffunction>