can you pass a variable to a listener in mach-ii.xml?

0 views
Skip to first unread message

kwfricke

unread,
Nov 15, 2008, 8:32:20 AM11/15/08
to Mach-II for CFML
Here is what i have...perhaps I am going about this all wrong.

we have a system with multiple types of groups. Each group has a
group type code in the database record. We have built a function in
grp_listener named getGrpList which returns ALL of the groups
regardless of group type code. However, we would like to display a
list of groups that have a group type code of 'TEAM'. would we create
a seperate function in the grp_listener name getGrpTeamList or would
we simply pass a variable to the listener to tell it to narrow the
query?

Does this make sense?

I guess the bottom line is how many functions do we want to put in our
listener? Should the be specific to the action or broad like the
example below?

Thank you.

Kevin

Dave Shuck

unread,
Nov 15, 2008, 9:59:20 AM11/15/08
to mach-ii-for...@googlegroups.com
If you are just planning on returning a query in all cases, I would
probably create a single method with an optional argument that accepts
list of codes. If no list of codes is passed it will retrieve all groups.

There is also nothing wrong with having separate methods such as:

getAllGroups()
getGroupsByCode()

Under the covers they may be doing just as I described above, but would
perhaps be more obvious as to their intended usage.

As to the question of the ideal number of methods in your listeners, I
would say that is much less of an issue than the problem of trying to
cram too much business logic into your listeners as opposed to
offloading that to your service layer, or the problem of having your
methods become to big and complex when they could be broken down into
smaller pieces.

~Dave
Reply all
Reply to author
Forward
0 new messages