You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Marc Lustig <ma...@marclustig.com> on 2003/02/18 22:57:07 UTC
intake: mapping the group against 2 objects possible?
This is the standard code to populate the group with the data from a bo, so
that the form-data displays the existing values:
#set($group=$intake.SomeGroup.mapTo($bo))
Q: is it possible to map the group against two different objects?
What's the proper way to do that?
Thanks.
Marc
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: intake: mapping the group against 2 objects possible?
Posted by Bill <bh...@collaborativefusion.com>.
I dont think you can do that.
Why would you want to do that?
-b
On Tue, 2003-02-18 at 16:57, Marc Lustig wrote:
> This is the standard code to populate the group with the data from a bo, so
> that the form-data displays the existing values:
>
> #set($group=$intake.SomeGroup.mapTo($bo))
>
> Q: is it possible to map the group against two different objects?
>
> What's the proper way to do that?
>
> Thanks.
>
> Marc
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: AW: intake: mapping the group against 2 objects possible?
Posted by Bill <bh...@collaborativefusion.com>.
I second the motion! :)
On Wed, 2003-02-19 at 14:17, Marc Lustig wrote:
> Chris, I'd be very much interested to have a look on how you modeled this.
> I'm sure others would benefit as well. Could you contribute a howto that
> explains the solution roughly ?
>
>
> > -----Ursprungliche Nachricht-----
> > Von: Chris K Chew [mailto:chris@fenetics.com]
> > Gesendet: Mittwoch, 19. Februar 2003 18:10
> > An: Turbine Users List
> > Betreff: RE: intake: mapping the group against 2 objects possible?
> >
> >
> > We usually write a facade/adaptor class for complex Intake
> > groups. There is
> > something like an init() method which loads the constituent base objects,
> > and the get/set methods simply pass the call on to the proper constituent.
> >
> > It works well for us and simplifies the screen/action classes.
> >
> > Chris
> >
> > -----Original Message-----
> > From: Marc Lustig [mailto:ml@marclustig.com]
> > Sent: Wednesday, February 19, 2003 4:13 AM
> > To: Turbine Users List
> > Subject: AW: intake: mapping the group against 2 objects possible?
> >
> >
> >
> > > -----Ursprungliche Nachricht-----
> > > Von: Scott Eade [mailto:seade@backstagetech.com.au]
> > > Gesendet: Dienstag, 18. Februar 2003 23:04
> > > An: turbine-user
> > > Betreff: Re: intake: mapping the group against 2 objects possible?
> > >
> > >
> > > On 19/02/2003 8:57 AM, "Marc Lustig" <ma...@marclustig.com> wrote:
> > >
> > > > This is the standard code to populate the group with the data
> > > from a bo, so
> > > > that the form-data displays the existing values:
> > > >
> > > > #set($group=$intake.SomeGroup.mapTo($bo))
> > > >
> > > > Q: is it possible to map the group against two different objects?
> > > >
> > > > What's the proper way to do that?
> > >
> > > Have you tried it? I suspect it will just work.
> >
> > It didn't really.
> > I solved this by handling with two different groups, one for each of the
> > BO's. This required to create another Intake group and setProperties() in
> > the action for both groups. That's not a bad solution.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: turbine-user-help@jakarta.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: turbine-user-help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
RE: intake: mapping the group against 2 objects possible?
Posted by Chris K Chew <ch...@fenetics.com>.
It is pretty simple, really, just using the Facade Pattern (Gang Of Four).
If you don't actively use patterns, now would be a great time to start.
Check out these links for more info:
http://www.cs.ucsb.edu/~cappello/50/lectures/patterns/Facade.html
http://unicoi.kennesaw.edu/~jbamford/csis4650/uml/GoF_Patterns/facade.htm
http://store.yahoo.com/softpro/0-201-48567-2.html -- Refactoring, Martin
Fowler
http://c2.com/cgi/wiki
Okay, off the soap box...
Say I have a complex intake group called Account that will gather
information for both a Customer and a ShippingAddress object. I want only
one form submittal so that the user doesn't have to go through a wizard, but
I also want separate objects because Addresses are stored separately. Below
is a rough example of the Adaptor class and Intake group declaration.
public class IntakeCustomerAccountFacade implements Retrievable
{
private Customer customer = new Customer();
private ShippingAddress shipping = new ShippingAddress();
public IntakeCustomerAccountFacade ()
{
}
public IntakeCustomerAccountFacade (Customer cust,ShippingAddress ship)
{
customer = cust;
shipping = ship;
}
<...get/SetQueryKey() methods...>
public void setName(String arg)
{
customer.setName(arg);
}
public String getName()
{
shipping.getName()
}
public void setShippingStreetAddress(String arg)
{
shipping.setStreetAddress(arg);
}
public String getShippingStreetAddress()
{
shipping.getStreetAddress()
}
}
<group mapToObject="com.mycompany.om.IntakeCustomerAccountFacade">
<field name="Name" key="name" type="String"/>
<field name="ShippingStreetAddress" key="shstaddr" type="String"/>
</group>
I hope this helps,
Chris
-----Original Message-----
From: Marc Lustig [mailto:ml@marclustig.com]
Sent: Wednesday, February 19, 2003 12:18 PM
To: Turbine Users List
Subject: AW: intake: mapping the group against 2 objects possible?
Chris, I'd be very much interested to have a look on how you modeled this.
I'm sure others would benefit as well. Could you contribute a howto that
explains the solution roughly ?
> -----Ursprungliche Nachricht-----
> Von: Chris K Chew [mailto:chris@fenetics.com]
> Gesendet: Mittwoch, 19. Februar 2003 18:10
> An: Turbine Users List
> Betreff: RE: intake: mapping the group against 2 objects possible?
>
>
> We usually write a facade/adaptor class for complex Intake
> groups. There is
> something like an init() method which loads the constituent base objects,
> and the get/set methods simply pass the call on to the proper constituent.
>
> It works well for us and simplifies the screen/action classes.
>
> Chris
>
> -----Original Message-----
> From: Marc Lustig [mailto:ml@marclustig.com]
> Sent: Wednesday, February 19, 2003 4:13 AM
> To: Turbine Users List
> Subject: AW: intake: mapping the group against 2 objects possible?
>
>
>
> > -----Ursprungliche Nachricht-----
> > Von: Scott Eade [mailto:seade@backstagetech.com.au]
> > Gesendet: Dienstag, 18. Februar 2003 23:04
> > An: turbine-user
> > Betreff: Re: intake: mapping the group against 2 objects possible?
> >
> >
> > On 19/02/2003 8:57 AM, "Marc Lustig" <ma...@marclustig.com> wrote:
> >
> > > This is the standard code to populate the group with the data
> > from a bo, so
> > > that the form-data displays the existing values:
> > >
> > > #set($group=$intake.SomeGroup.mapTo($bo))
> > >
> > > Q: is it possible to map the group against two different objects?
> > >
> > > What's the proper way to do that?
> >
> > Have you tried it? I suspect it will just work.
>
> It didn't really.
> I solved this by handling with two different groups, one for each of the
> BO's. This required to create another Intake group and setProperties() in
> the action for both groups. That's not a bad solution.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
AW: intake: mapping the group against 2 objects possible?
Posted by Marc Lustig <ml...@marclustig.com>.
Chris, I'd be very much interested to have a look on how you modeled this.
I'm sure others would benefit as well. Could you contribute a howto that
explains the solution roughly ?
> -----Ursprungliche Nachricht-----
> Von: Chris K Chew [mailto:chris@fenetics.com]
> Gesendet: Mittwoch, 19. Februar 2003 18:10
> An: Turbine Users List
> Betreff: RE: intake: mapping the group against 2 objects possible?
>
>
> We usually write a facade/adaptor class for complex Intake
> groups. There is
> something like an init() method which loads the constituent base objects,
> and the get/set methods simply pass the call on to the proper constituent.
>
> It works well for us and simplifies the screen/action classes.
>
> Chris
>
> -----Original Message-----
> From: Marc Lustig [mailto:ml@marclustig.com]
> Sent: Wednesday, February 19, 2003 4:13 AM
> To: Turbine Users List
> Subject: AW: intake: mapping the group against 2 objects possible?
>
>
>
> > -----Ursprungliche Nachricht-----
> > Von: Scott Eade [mailto:seade@backstagetech.com.au]
> > Gesendet: Dienstag, 18. Februar 2003 23:04
> > An: turbine-user
> > Betreff: Re: intake: mapping the group against 2 objects possible?
> >
> >
> > On 19/02/2003 8:57 AM, "Marc Lustig" <ma...@marclustig.com> wrote:
> >
> > > This is the standard code to populate the group with the data
> > from a bo, so
> > > that the form-data displays the existing values:
> > >
> > > #set($group=$intake.SomeGroup.mapTo($bo))
> > >
> > > Q: is it possible to map the group against two different objects?
> > >
> > > What's the proper way to do that?
> >
> > Have you tried it? I suspect it will just work.
>
> It didn't really.
> I solved this by handling with two different groups, one for each of the
> BO's. This required to create another Intake group and setProperties() in
> the action for both groups. That's not a bad solution.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
RE: intake: mapping the group against 2 objects possible?
Posted by Chris K Chew <ch...@fenetics.com>.
We usually write a facade/adaptor class for complex Intake groups. There is
something like an init() method which loads the constituent base objects,
and the get/set methods simply pass the call on to the proper constituent.
It works well for us and simplifies the screen/action classes.
Chris
-----Original Message-----
From: Marc Lustig [mailto:ml@marclustig.com]
Sent: Wednesday, February 19, 2003 4:13 AM
To: Turbine Users List
Subject: AW: intake: mapping the group against 2 objects possible?
> -----Ursprungliche Nachricht-----
> Von: Scott Eade [mailto:seade@backstagetech.com.au]
> Gesendet: Dienstag, 18. Februar 2003 23:04
> An: turbine-user
> Betreff: Re: intake: mapping the group against 2 objects possible?
>
>
> On 19/02/2003 8:57 AM, "Marc Lustig" <ma...@marclustig.com> wrote:
>
> > This is the standard code to populate the group with the data
> from a bo, so
> > that the form-data displays the existing values:
> >
> > #set($group=$intake.SomeGroup.mapTo($bo))
> >
> > Q: is it possible to map the group against two different objects?
> >
> > What's the proper way to do that?
>
> Have you tried it? I suspect it will just work.
It didn't really.
I solved this by handling with two different groups, one for each of the
BO's. This required to create another Intake group and setProperties() in
the action for both groups. That's not a bad solution.
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
AW: intake: mapping the group against 2 objects possible?
Posted by Marc Lustig <ml...@marclustig.com>.
> -----Ursprungliche Nachricht-----
> Von: Scott Eade [mailto:seade@backstagetech.com.au]
> Gesendet: Dienstag, 18. Februar 2003 23:04
> An: turbine-user
> Betreff: Re: intake: mapping the group against 2 objects possible?
>
>
> On 19/02/2003 8:57 AM, "Marc Lustig" <ma...@marclustig.com> wrote:
>
> > This is the standard code to populate the group with the data
> from a bo, so
> > that the form-data displays the existing values:
> >
> > #set($group=$intake.SomeGroup.mapTo($bo))
> >
> > Q: is it possible to map the group against two different objects?
> >
> > What's the proper way to do that?
>
> Have you tried it? I suspect it will just work.
It didn't really.
I solved this by handling with two different groups, one for each of the
BO's. This required to create another Intake group and setProperties() in
the action for both groups. That's not a bad solution.
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: intake: mapping the group against 2 objects possible?
Posted by Scott Eade <se...@backstagetech.com.au>.
On 19/02/2003 8:57 AM, "Marc Lustig" <ma...@marclustig.com> wrote:
> This is the standard code to populate the group with the data from a bo, so
> that the form-data displays the existing values:
>
> #set($group=$intake.SomeGroup.mapTo($bo))
>
> Q: is it possible to map the group against two different objects?
>
> What's the proper way to do that?
Have you tried it? I suspect it will just work.
Cheers,
Scott
--
Scott Eade
Backstage Technologies Pty. Ltd.
http://www.backstagetech.com.au
.Mac Chat/AIM: seade at mac dot com
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org