On 11/2/07, Mike Kear <[EMAIL PROTECTED]> wrote:
> How?      How do I pass in this current user's session.userbean to the DAO
> as an argument?

You don't. That doesn't make sense. A DAO is a service object, a
singleton, that is created once at application startup (well, it's
created on-demand but the principle is the same). You can't pass in a
per-session object to a per-application object.

Here's how I would handle the audit trail.

First off, I'd have a userService that has methods: isLoggedIn() and
getUser() that return true iff the user is logged in and the
session-cached user bean respectively.

Second, I'd write the userService into the DAO, probably via setter
injection (to avoid potential circular references):

<bean id="MerchMajorCategoryDAO"
class="admin.cfcs.Merchandise.MerchMajorCategoryDAO">
            <constructor-arg name="argsConfiguration"><ref
bean="ConfigurationBean" /></constructor-arg>
            <property name="userService"><ref bean="userService" /></property>
</bean>

(and MechMajorCategoryDAO.cfc would have a setUserService() method)

Third, inside the DAO, I'd check variables.userService.isLoggedIn()
and, if true, call variables.userService.getUser().getUserId() to get
the ID of the user making the change.

Does that help?
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

Reply via email to