The fact that you're using Model-Glue should make no difference at all. If
it is, then you're thinking about it the wrong way. I see a few problems
with what you've said:

   - AOP is really meant to eliminate duplication by encapsulating a
   generic, common process so that it can be reused across many method calls or
   components. I'm not sure validation really qualifies, since it is so
   specific to the particular object or data being validated. Usual suspects
   for AOP include logging, security, and data formatting. So I'm not sure if
   what you're doing really lends itself to AOP in the first place, since I
   don't see how your code is reusable. The example you gave is hardcoding a
   call to getName() which already means this advice is really not going to
   work with other kinds of data.
   - You're right that the advice has no access to the Model-Glue event
   object. It shouldn't. You have access to whatever arguments were passed into
   the original method, and access to any return value from that method. So if
   your UserService returns an object or a struct indicating success or
   failure, along with error messages, you can manipulate that before it gets
   returned back to the controller.

Basically, if you can imagine dropping Model-Glue and having a web service
call your Service (and your advice), and having it work and return data that
the web service could use, then you're at the right conceptual level.
Whenever this won't work (for example, you're wanting the advice to have
access to the Model-Glue event object, which obviously would be extremely
difficult if the client was a web service instead of Model-Glue), it means
you aren't keeping your application layers properly encapsulated.

Hope that helps.

Brian

On 10/8/07, Robert Rawlins - Think Blue <[EMAIL PROTECTED]>
wrote:
>
>
> Now this is where I become a little confused, see, in the old days I would
> validate the data inside my controller, and if the data failed validation
> I
> would add a result of 'failed' and update the viewstate with an error
> message, then use the events xml definition to pass the user back to the
> form if the result of 'failed' was present.
>
>
> However, from what I can see here I have no access to the event object
> from
> my advice object, so I'm not able to add results or update the view state,
> All I can do is simply return a value, is that correct? How do I use the
> advice object to control the user back to the form with an error message?
> I'm feeling a little confused about it.
>
>
>
> Thanks for any 'advice' guys, I really appreciate your time.
>
>
>
> Rob
>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Check out the new features and enhancements in the
latest product release - download the "What's New PDF" now
http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:290539
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to