You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by "Dan K." <da...@YorkU.CA> on 2002/04/06 01:29:48 UTC
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: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>