Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Conditionally calling a listener's method within an event
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Phil Ewington - iModel Ltd.  
View profile  
 More options Nov 9, 11:07 am
From: "Phil Ewington - iModel Ltd." <phil.ewing...@i-model.co.uk>
Date: Mon, 09 Nov 2009 16:07:12 +0000
Local: Mon, Nov 9 2009 11:07 am
Subject: Conditionally calling a listener's method within an event

Hi All,

Totally new to Mach II, building first app and got a question about the
events.

I have an event to create a registration and want to conditionally call
another method in my listener if the registration is based upon a
referral. The following shows my event-handler, the second notify
command being the conditional method...

<event-handler event="createIndividual" access="private">
        <notify listener="IndividualListener" method="createIndividual" />
        <notify listener="IndividualListener"
method="createIndividualReferral" />
        <view-page name="home" contentArg="layout.content" />
        <announce event="layoutpage" copyEventArgs="true" />
</event-handler>

My thinking is...

1) I could write the conditional call within my service layer. Not happy
about this as the functionality gets 'hidden' away from other developers.
2) I could use a filter and have different event handlers to handle the
result. I have lots of these types of conditions in my events and would
rather not have a huge collection of event-handlers unless of course I
have no option/no better way of doing it.

Is there a specific/preferred way to achieve this using Mach II? Any
help will be much appreciated.

Kind regards,

Phil.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Matthew Woodward  
View profile  
 More options Nov 9, 11:38 am
From: Matthew Woodward <m...@mattwoodward.com>
Date: Mon, 09 Nov 2009 08:38:32 -0800
Local: Mon, Nov 9 2009 11:38 am
Subject: Re: [Mach-II] Conditionally calling a listener's method within an event

On Mon, 09 Nov 2009 16:07:12 +0000, "Phil Ewington - iModel Ltd."

<phil.ewing...@i-model.co.uk> wrote:
> Totally new to Mach II, building first app and got a question about the
> events.

Welcome to Mach-II!

> I have an event to create a registration and want to conditionally call
> another method in my listener if the registration is based upon a
> referral.

If the other method in your listener is never called independently, you
probably want this other method in your service, not in your listener.

> My thinking is...

> 1) I could write the conditional call within my service layer. Not happy
> about this as the functionality gets 'hidden' away from other developers.

I would conditionally make a call to your service layer from within your
listener. At least that's what seems right to me based on what you're
saying thus far.

> 2) I could use a filter and have different event handlers to handle the
> result. I have lots of these types of conditions in my events and would
> rather not have a huge collection of event-handlers unless of course I
> have no option/no better way of doing it.

That sounds unnecessarily complicated.

I may not have the full picture, but in your listener method I'd probably
do:
<cfif isReferral> <!--- or however you determine if it's a referral --->
  <cfset getMyService().doReferralStuff(event.getArg("arg1"),
event.getArg("arg2")) />
</cfif>

That way you can pass whatever event arguments you need to as part of the
referral bit.

Definitely let me know if I'm missing a piece of the puzzle.
--
Matthew Woodward
m...@mattwoodward.com
http://mpwoodward.posterous.com
identi.ca/Twitter: @mpwoodward

Please do not send me proprietary file formats such as Word, PowerPoint,
etc. as attachments.
http://www.gnu.org/philosophy/no-word-attachments.html


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Phil Ewington - iModel Ltd.  
View profile  
 More options Nov 9, 12:01 pm
From: "Phil Ewington - iModel Ltd." <phil.ewing...@i-model.co.uk>
Date: Mon, 09 Nov 2009 17:01:13 +0000
Local: Mon, Nov 9 2009 12:01 pm
Subject: Re: [Mach-II] Re: Conditionally calling a listener's method within an event

Hi Matt,

Thank you for your quick response!

In this instance the method will never get called independently so will
move to the service layer as per your suggestion as this makes perfect
sense. I will encounter further similar scenarios during development
with methods that can be called independently in which case I will call
the service layer conditionally.

Thanks for your help.

- Phil.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Matthew Woodward  
View profile  
 More options Nov 9, 12:24 pm
From: Matthew Woodward <m...@mattwoodward.com>
Date: Mon, 09 Nov 2009 09:24:04 -0800
Local: Mon, Nov 9 2009 12:24 pm
Subject: Re: [Mach-II] Re: Conditionally calling a listener's method within an event

On Mon, 09 Nov 2009 17:01:13 +0000, "Phil Ewington - iModel Ltd."

<phil.ewing...@i-model.co.uk> wrote:
> Hi Matt,

> Thank you for your quick response!

> In this instance the method will never get called independently so will
> move to the service layer as per your suggestion as this makes perfect
> sense. I will encounter further similar scenarios during development
> with methods that can be called independently in which case I will call
> the service layer conditionally.

> Thanks for your help.

No problem at all. Fire away with other questions as you dig deeper into
Mach-II.
--
Matthew Woodward
m...@mattwoodward.com
http://mpwoodward.posterous.com
identi.ca/Twitter: @mpwoodward

Please do not send me proprietary file formats such as Word, PowerPoint,
etc. as attachments.
http://www.gnu.org/philosophy/no-word-attachments.html


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google