Just starting and need some advice. I have gateway and dao cfc's for
some tables.
Rather than changing those cfc's to use CS I have
created a new cfc and injected the needed cfc's into the new cfc as
shown below. I am
thus not injecting the dependant cfc's directly into the cfc that
requires them.
Is this a reasonable approach.
<beans>
<bean id="specimenObj" class="pathTo.specimenObj">
<constructor-arg name="tblSciNameGateway">
<ref bean="tblSciNameGateway"/>
</constructor-arg>
<constructor-arg name="tblHostNameGateWay">
<ref bean="tblHostNameGateway"/>
</constructor-arg>
<constructor-arg name="tblSpecimenGateWay">
<ref bean="tblSpecimenGateWay"/> ***main table that needs
the others***
</constructor-arg>
</bean>
<bean id="tblSciNameGateWay" class="pathTo.tblSciNameGateway" />
<bean id="tblHostNameGateway" class="pathTotblHostNameGateway" />
<bean id="tblSpecimenGateWay" class="pathTo.tblSpecimenGateWay" />
</beans>
<cfcomponent output="false">
<cffunction name="init" output="false" returntype="any">
<cfargument name="tblSpecimenGateWay"
type="pathTo.tblSpecimenGateWay" required="true">
<cfargument name="tblHostNameGateway"
type="pathTo.tblHostNameGateway" required="true">
<cfargument name="tblSciNameGateWay"
type="pathTo.tblSciNameGateWay" required="true">
<cfset variables.specimen = arguments.tblSpecimenGateWay>
<cfset variables.hostName = arguments.tblHostNameGateway>
<cfset variables.sciName = arguments.tblSciNameGateWay>
<cfset variables.currentSpecimenRec = "">
</cffunction>
<cffunction name="selectSpecimen">
<cfargument name="thisId" required="true">
<cfset var oo = variables.specimen>
<cfset var thisRec = structNew()>
<cfset variables.currentSpecimenRec =
variables.specimen.getById(#arguments.thisId#)>
<cfset thisRec.HostName = selectHostName()>
<cfset thisRec.sciName = selectSciName()>
<cfreturn thisRec>
</cffunction>
<cffunction name="selectHostName">
<cfset var xx = variables.currentSpecimenRec.getHost()>
<cfset var yy = variables.HostName.getById(xx)>
<cfset var zz = yy.getHostName()>
<cfreturn zz>
</cffunction>
<cffunction name="selectSciName">
<cfset var xx =
variables.currentSpecimenRec.getSpecimenName()>
<cfset var yy = variables.SciName.getById(xx)>
<cfset var zz = yy.getName()>
<cfreturn zz>
</cffunction>
</cfcomponent>
David Farr
U.S. Dept. Agriculture, Agricultural Research Service
Systematic Botany and Mycology Laboratory
[EMAIL PROTECTED]
Voice: 301-504-5274
http://nt.ars-grin.gov/