I was doing that but I have multiple methods in my decorator. e.g:

 

getCurrentBlock()

getCurrentBuilding()

getBuildings()

etc.

 

I didnt want to have to do getLookupData() in every method.

 

Therefore I now call the method to generate the lookup data when the object
is retrieved from the service (with a check to see if it's already in the
cached object).

 

This way the decorator can just assume that the lookup data is all in place
and use it.

 

---

James  Allen

E: ja...@jamesallen.name

Blog: http://jamesallen.name

Twitter: @CFJamesAllen (Coldfusion / Web development)

Twitter: @jamesallenuk (General)

Lead developer of http://errrrrrr.com

 

From: transfer-dev@googlegroups.com [mailto:transfer-...@googlegroups.com]
On Behalf Of Mark Mandel
Sent: 14 April 2010 12:35
To: transfer-dev@googlegroups.com
Subject: Re: [transfer-dev] Re: Method to execute in decorator
post-population

 

 

On Wed, Apr 14, 2010 at 9:13 PM, James Allen <slingsho...@googlemail.com>
wrote:

Hi Mark,

14 hours day! Is that even possible!? You must be like a zombie.

I know what you mean with the first request but I was finding that I
kept having to put in the same method call in multiple methods to
ensure the data had been processed.


Confused by this statement - why don't you have:

function getLookupData()
{ 
  if(NOT lookupDataReady)
  {
     buildLookupData();
  } 
  return lookupData;
}

and if you ever only go to get - getLookupData(), noone will ever be the
wiser.

(Add appropriate locking as necessary).

Mark
 


I've now switched to simply calling the lookup creation method when I
get the landlord object in the getCurrentLandlord() service call.

Would be nice to have a method called automatically so I didn't have
to worry about it but this fit's pretty well as I always have my
object creation methods in a single place anyway.

Thanks for the advice,
James.


On Apr 14, 12:08 pm, Mark Mandel <mark.man...@gmail.com> wrote:
> I've been working 14 hour days, so my brain is totally fried...
>
> But any reason you can't create these data structures lazily? i.e. when
you
> first request them inside/outside the object.
>
> It's how I tend to do it (in any ORM strategy).
>
> Mark
>

> On Wed, Apr 14, 2010 at 8:56 PM, James Allen
<slingsho...@googlemail.com>wrote:

>
>
>
> >  I'm creating internal lookup structures based on some of the data the
> > object is composed of. I then use these when calling certain methods on
the
> > BO.
>
> > To be more specific, I have a landlord object which is composed of a
list
> > of block objects (a block being part of a building the landlord is
> > associated with). I need to be able to request the building objects for
the
> > landlord and the blocks separately. I also have other methods for
requesting
> > the 'current' building / block which is determined when the BO is
retrieved.
> > I'm trying to keep all this nicely encapsulated in the BO so being able
to
> > create my lookup tables ones when the object is retrieved would be very
> > useful.
>
> > Though talking it through now I realise that I could just trigger a
method
> > in my service when getCurrentLandlord() is called. :)
>
> > I assume there is no other way to have a method called on the decorator
> > after initial creation?
>
> > ---
>
> > *James  Allen*
>

> > *E:* ja...@jamesallen.name

>
> > *Blog:*http://jamesallen.name
>
> > *Twitter:* @CFJamesAllen (Coldfusion / Web development)
>
> > *Twitter:* @jamesallenuk (General)
>

> > Lead developer ofhttp://errrrrrr.com

>
> > *From:* transfer-dev@googlegroups.com [mailto:
> > transfer-...@googlegroups.com] *On Behalf Of *Mark Mandel
> > *Sent:* 14 April 2010 11:44
> > *To:* transfer-dev@googlegroups.com
> > *Subject:* Re: [transfer-dev] Method to execute in decorator
> > post-population
>
> > Stupid question - why?
>
> > Mark
>

> > On Wed, Apr 14, 2010 at 8:41 PM, James Allen
<slingsho...@googlemail.com>

> > wrote:
>
> > I did a lot of searching about this a while ago but not sure I found
> > the definitive answer. I basically need a way to execute a method in a
> > decorator when it is first initialised *after* population.
>
> > I asked this a few years ago and was told to look at
> > 'afterCreateMethod' in Brian Koteks TDOBeanInjector (awesome system)
> > that I currently use for bean injection. However, this does NOT
> > execute *after* bean population - only after dependent bean injection.
>
> > So is there way to trigger a method in a decorator as the very last
> > thing Transfer does when initialising a decorator?
>
> > Thanks in advance.
>
> > --
> > Before posting questions to the group please read:
>

> >http://groups.google.com/group/transfer-dev/web/how-to-ask-support-qu...

>
> > Try out the new Transfer ORM Custom Google Search:
> >http://www.google.com/cse/home?cx=002375903941309441958:2s7wbd5ocb8
>
> > You received this message because you are subscribed to the Google
Groups
> > "transfer-dev" group.
> > To post to this group, send email to transfer-dev@googlegroups.com
> > To unsubscribe from this group, send email to

> > transfer-dev+unsubscr...@googlegroups.com
<mailto:transfer-dev%2bunsubscr...@googlegroups.com>
<transfer-dev%2bunsubscr...@googlegroups.com
<mailto:transfer-dev%252bunsubscr...@googlegroups.com> >

> > For more options, visit this group at
> >http://groups.google.com/group/transfer-dev?hl=en
>
> > To unsubscribe, reply using "remove me" as the subject.
>
> > --

> > E: mark.man...@gmail.com

> > T:http://www.twitter.com/neurotic
> > W:www.compoundtheory.com
>
> > Hands-on ColdFusion ORM Training @ cf.Objective() 2010
> >www.ColdFusionOrmTraining.com/
>
> > --
> > Before posting questions to the group please read:
>

> >http://groups.google.com/group/transfer-dev/web/how-to-ask-support-qu...

>
> > Try out the new Transfer ORM Custom Google Search:
> >http://www.google.com/cse/home?cx=002375903941309441958:2s7wbd5ocb8
>
> > You received this message because you are subscribed to the Google
Groups
> > "transfer-dev" group.
> > To post to this group, send email to transfer-dev@googlegroups.com
> > To unsubscribe from this group, send email to

> > transfer-dev+unsubscr...@googlegroups.com
<mailto:transfer-dev%2bunsubscr...@googlegroups.com>
<transfer-dev%2bunsubscr...@googlegroups.com
<mailto:transfer-dev%252bunsubscr...@googlegroups.com> >

> > For more options, visit this group at
> >http://groups.google.com/group/transfer-dev?hl=en
>
> > --
> > Before posting questions to the group please read:
>

> >http://groups.google.com/group/transfer-dev/web/how-to-ask-support-qu...

>
> > Try out the new Transfer ORM Custom Google Search:
> >http://www.google.com/cse/home?cx=002375903941309441958:2s7wbd5ocb8
>
> > You received this message because you are subscribed to the Google
Groups
> > "transfer-dev" group.
> > To post to this group, send email to transfer-dev@googlegroups.com
> > To unsubscribe from this group, send email to

> > transfer-dev+unsubscr...@googlegroups.com
<mailto:transfer-dev%2bunsubscr...@googlegroups.com>
<transfer-dev%2bunsubscr...@googlegroups.com
<mailto:transfer-dev%252bunsubscr...@googlegroups.com> >

> > For more options, visit this group at
> >http://groups.google.com/group/transfer-dev?hl=en
>
> --

> E: mark.man...@gmail.com

> T:http://www.twitter.com/neurotic
> W:www.compoundtheory.com
>

> Hands-on ColdFusion ORM Training @ cf.Objective()
2010www.ColdFusionOrmTraining.com/


--
Before posting questions to the group please read:
http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions
-on-transfer

Try out the new Transfer ORM Custom Google Search:
http://www.google.com/cse/home?cx=002375903941309441958:2s7wbd5ocb8

You received this message because you are subscribed to the Google Groups
"transfer-dev" group.
To post to this group, send email to transfer-dev@googlegroups.com
To unsubscribe from this group, send email to
transfer-dev+unsubscr...@googlegroups.com
<mailto:transfer-dev%2bunsubscr...@googlegroups.com> 
For more options, visit this group at
http://groups.google.com/group/transfer-dev?hl=en




-- 
E: mark.man...@gmail.com
T: http://www.twitter.com/neurotic
W: www.compoundtheory.com

Hands-on ColdFusion ORM Training @ cf.Objective() 2010
www.ColdFusionOrmTraining.com/

-- 
Before posting questions to the group please read:
http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions
-on-transfer
 
Try out the new Transfer ORM Custom Google Search:
http://www.google.com/cse/home?cx=002375903941309441958:2s7wbd5ocb8
 
You received this message because you are subscribed to the Google Groups
"transfer-dev" group.
To post to this group, send email to transfer-dev@googlegroups.com
To unsubscribe from this group, send email to
transfer-dev+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/transfer-dev?hl=en

-- 
Before posting questions to the group please read:
http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions-on-transfer

Try out the new Transfer ORM Custom Google Search:
http://www.google.com/cse/home?cx=002375903941309441958:2s7wbd5ocb8

You received this message because you are subscribed to the Google Groups 
"transfer-dev" group.
To post to this group, send email to transfer-dev@googlegroups.com
To unsubscribe from this group, send email to 
transfer-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/transfer-dev?hl=en

Reply via email to