In torque generated objects the getQueryKey is usually a string
representation of the primary key used to store the object in the db and
"" if the bo is new. though occasionally with some objects that are not
persisted, i use setQueryKey to assign the key based on their position
in a list.
john mcnally
"Dan K." wrote:
>
> Thanks John! Much appreciated! If you can, do you think you can
> elaborate on the role of the setQueryKey/getQueryKey methods of the
> Retrievable interface? Isn't it a pain to have to keep track of the
> unique query key for each group/bo in a form (set in the template) and
> also track it in the action class? I'm trying to look for a simpler and
> more straight-forward solultion if one exists? Thanks so much again!
>
> Regards,
> Dan
>
> On Mon, 8 Apr 2002, John McNally wrote:
>
> > Scott has explained things in detail, but here's my short answer.
> >
> > The first line gives you a business object that implements Retrievable.
> > The second line takes the properties from the bo and copies them to the
> > fields in an intake group. If the group has a field defined with the
> > name = "Foo" then you could use this in a form:
> >
> > <input type="text" name="$group.Foo.Key" value="$group.Foo" />
> >
> > john mcnally
> >
> > "Dan K." wrote:
> > >
> > > Hi Scott,
> > >
> > > cool thanks, yes that helped (I appreciate your response!)
> > > However, my main problem is what do I need to do in the template files?
> > > According to the intake-service doc, under the "Attribute Value example"
> > > section, I am suppose to have the following 2 lines (as well as others
> > > but I don't quite understand these 2 lines):
> > >
> > > ## what do these lines do really?
> > > #set ( $attributeValue = $issue.AttributeValue("URL") )
> > > #set ( $group = $intake.AttributeValue.mapTo($attributeValue) )
> > >
> > > I don't use scarab and the first line references something from it.
> > > I believe John McNally (?) or someone else here is an expert on scarab
> > > and I was hoping s/he might able to enlighten me...but s/he has yet to
> > > respond unfortunately. Do you know what these lines are about, or what I
> > > need to put in the template to get this all working?
> > >
> > > Many thanks again Scott!
> > >
> > > Regards,
> > > Dan
> > >
> > > On Mon, 8 Apr 2002, Weaver, Scott wrote:
> > >
> > > > > How does one use the "mapTo" feature of intake to map form data to
> > > > > business objects (manually created, not by torque)? Here are
> > > > > the steps
> > > > > I think I need to get it done so far...
> > > >
> > > > For your business objects to be intake-compatible they must implement the
> > > > org.apache.turbine.om.Retrievable interface or if you are using the
> > > > decoupled fulcrum Intake service, org.apache.fulcrum.intake.Retrievable.
> > > >
> > > > Intake uses introspection to set the values of your B/O's from HTML form
> > > > fields and vice-versa. The fields defined within a group need to be able to
> > > > be mapped into your B/O. In most cases you will set "name" attribute to
> > > > match the property within your B/O. If you want the field name to be
> > > > something other than the B/O's property's name it maps to, you will need to
> > > > supply the "mapToProperty" attribute of that field to be the same as the
> > > > property in your B/O.
> > > >
> > > >
> > > > hth,
> > > > Scott
> > > >
> > > >
> > > >
> > > >
> > > > > -----Original Message-----
> > > > > From: Dan K. [mailto:[EMAIL PROTECTED]]
> > > > > Sent: Friday, April 05, 2002 6:30 PM
> > > > > To: [EMAIL PROTECTED]
> > > > > Subject: intake's mapTo usage?
> > > > >
> > > > >
> > > > >
> > > > > Hi,
> > > > >
> > > > > I've read up the intake-service documentation but it's quite
> > > > > confusing and
> > > > > the mail archive doesn't really address my newbie intake question:
> > > > >
> > > > > How does one use the "mapTo" feature of intake to map form data to
> > > > > business objects (manually created, not by torque)? Here are
> > > > > the steps
> > > > > I think I need to get it done so far...
> > > > >
> > > > > In the intake.xml file:
> > > > > - there must be a group tag with the "name", "key", and "mapToObject"
> > > > > attribute set, similar to:
> > > > > <group name="MyGroup" key="MyGroupKey" mapToObject="MyBusinessObject">
> > > > >
> > > > > - the mapToObject="MyBusinessObject" has a corresponding
> > > > > MyBusinessObject.java with appropriate get/set methods for
> > > > > the attributes
> > > > > in question. Is this right?
> > > > >
> > > > > - add in some fields to the group (with their rules), similar to:
> > > > > <field name="Username" key="Username" type="String">
> > > > > <rule name="required" value="true">Username is required</rule>
> > > > > ...some more rules if desired...
> > > > > </field>
> > > > >
> > > > > In the corresponding "Action" class:
> > > > > - get an instance of the intake object from the context, and set the
> > > > > business object with the corresponding group field values from intake,
> > > > > similar to:
> > > > > IntakeTool intake = (IntakeTool)context.get("intake");
> > > > > Group group = intake.get("MyGroup", IntakeTool.DEFAULT_KEY);
> > > > > MyBusinessObject myBO = new MyBusinessObject();
> > > > > if (group.isAllValid()) {
> > > > > group.setProperties(myBO);
> > > > > }
> > > > > // at this point, myBO should be populated with the
> > > > > correct attribute
> > > > > // values, right? So I can print it out like this:
> > > > > System.out.println("myBO = "+myBO.toString());
> > > > >
> > > > > In the template file (.vm file):
> > > > > - include this in a <form> tag:
> > > > > $intake.declareGroups()
> > > > > - and then what?
> > > > >
> > > > > I noticed in the intake-service doc it says to do something
> > > > > similar to:
> > > > > #set ( $attributeValue = $issue.AttributeValue("URL") )
> > > > > #set ( $group = $intake.AttributeValue.mapTo($attributeValue) )
> > > > >
> > > > > But that's something from scarab, of which I have no clue
> > > > > about...especially the first #set statement.
> > > > >
> > > > > If someone can detail this out, then I'd appreciate it very much! TIA.
> > > > > I'm sure it'll be useful as a basis for an "intake quick start how-to"
> > > > > as well.
> > > > >
> > > > > Regards,
> > > > > Dan
> > > > >
> > > > >
> > > > > --
> > > > > To unsubscribe, e-mail:
> > > > > <mailto:[EMAIL PROTECTED]>
> > > > > For additional commands, e-mail:
> > > > > <mailto:[EMAIL PROTECTED]>
> > > > >
> > > >
> > >
> > > --
> > > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> >
> > --
> > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> >
>
> --
> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>