Firstly,

Thanks to Sean, Joe, Nando, Agha and Doug.

Doug, your explanation really cleared a lot of things up.  I will try and explain how I resolved this issue, and please tell me if I’m doing this correctly or not.

I ended creating a dealer object, which has a bunch of setters and getters for each field.  In addition the dealer object has methods which pass the dealer object to the DealerTO (does a create object and initializes the DealerTO with dealer data).  Then finally my dealer object has a function which fudges the formdata around and calls the dealer’s set methods.

Finally, my dealer manager has a function which I call after a form submit.  This function “doSubmit”, initializes a dealer object with the form data, then it calls the dealer function which fudges form data, then lastly it calls the dealer function which passes the dealer object to the TO, and returns the TO.

Here is the function in the manager

<cffunction name="doNewSubmit" access="public" returntype="Ali.GAfb4CFC.com.dmsTO" output="yes">

            <cfset var dms = createObject("component","Ali.GAfb4CFC.com.dms").init(argumentcollection=arguments) />

            <cfset dms.processNewAppData(argumentcollection=arguments) />

            <cfset dmsData = dms.getDMSTO() />

<cfreturn dmsData />

</cffunction>

By jove, I think I’ve finally got it.  Again if I’m a bit off on something, please let me know. 

Thanks again to all.

Cheers,

Ali

Doug Keen
Thu, 06 Jan 2005 12:22:52 -0800

Well, the way I like to do it is to have all my business rules and
object collaboration logic in my business objects (e.g., Dealer).  The
manager objects really only implement the "use cases" and coordinate
communication between your business objects, TO's, DAO's, etc.  For
example, you're Dealer object could have the following public methods:
 
DealerTO getTO( ) // returns instance data of this Dealer as a TO
void setTO( DealerTO ) // sets instance data of this Dealer according
to input TO
void setKioskKey( numeric )
Sale sellMerchandise( Customer, SaleTermsTO ) // contains all business
rules and logic associated with selling merchandise
 
DealerManager might have public methods like:
 
void createDealer( DealerTO )
void updateDealer( DealerTO )
void executeSale( dealerID, customerID, SaleTermsTO)
 
The implementation of "executeSale" might look something like:
var dealer = DealerDAO.getDealer(dealerID);
var buyer = CustomerDAO.getCustomer(customerID);
var sale = dealer.sellMerchandise(buyer, saleTermsTO);
SaleDAO.createSale( sale.getTO() );
 
Again, this might not be the ideal way to do things in your situation,
but it seems to have worked in my world.  Does that help clarify
things?

 

Reply via email to