On 7/22/10 3:17 PM, Tony Giaccone wrote:
>
>
> I'm doing a form submission as a way to enter information into a Sling
> repository. I need a little advice on how to approach the following problem.
>
> I have an order and the order has line times, and the line times are ordinal.
>
> I want to end up with a node for the Order, and as children of that order, a
> node for each line item. In xml the structure would look like:
>
>
> <order>
> <name>Bob Smith</name>
> <accountNumber>12345</accountNumber>
> <lineItems>
> <lineItem id=1>
> <qty>1</qty>
> <desc>Widget</desc>
> <price>1.99</price>
> <lineTotal>1.99</price>
> </lineItem>
> <lineItem id=2>
> <qty>2</qty>
> <desc>Bar</desc>
> <price>2.00</price>
> <lineTotal>4.00</price>
> </lineItem>
> </lineItems>
> </order>
>
>
> So I'd like to break this xml down into three nodes. One for the order, and
> one for each of the line items.
>
> The problem I'm having is that I don't want to give each line item a unique
> name. Does a node have to have a unique name?
Theoretically, no, each node does not need a unique name if you use same
name siblings.
However, the SlingPostServlet doesn't support SNS in the
ModifyOperation. It might in the ImportOperation, but I don't know.
>
> If not, how do I construct name value pairs to represent these different
> nodes and prevent the data from the second line item
> ending up in the first one? Do I have to do three separate posts one for each
> node?
I would treat this as four nodes:
/orders/{orderID} - the order
/orders/{orderID}/lineItems - a sling:OrderableFolder
/orders/{orderID}/lineItems/1 - the first item
/orders/{orderID}/lineItems/2 - the second item
You should be able to create all of these with a single post.
HTH,
Justin
>
> Not sure how this should work.
>
>
> Tony