You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by Arturo Ulises Castañeda Estrada <ar...@sisorg.com.mx> on 2016/04/15 20:24:38 UTC
list parameters
Hi Dan
I'm trying to pass an list as parameter to a method for consume in a WS but i get the error that does not support list as parameter.
org.apache.isis.core.commons.exceptions.UnknownTypeException: collections not supported as parameters: domainapp.dom.simple.sequence.SequenceItemRepository#addItemsToSequence(domainapp.dom.simple.sequence.Sequence,java.util.List)
What can i do to set an list instead of iterate object by object for persist?
Re: list parameters
Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Um, maybe.
To clarify: what I mean is to define an action that accepts a string
parameter, and then have your RO client post a data structure (eg json) as
that string. You'll likely need to escape any quotes etc. In the action
itself, use a library such as jackson to unmarshall into an object graph,
which can then be processed.
eg:
public void upload(String customerBookmarks) {
List<string> list = fromJson(customerBookmarks);
List<Customer> customers = list.stream().map(x =>
(Customer)bookmarkService.lookup(x)).collect(Collectors.toList());
...
}
and in the RO client:
var jsonStr = "[ 'com.mycompany.myapp.Customer:1', 'com.mycompany.myapp.
Customer:2', 'com.mycompany.myapp.Customer:3' ]";
$roService.upload(jsonStr);
HTH
Dan
On 18 April 2016 at 17:32, Arturo Ulises Castañeda Estrada <
arturo.castaneda@sisorg.com.mx> wrote:
> Ok, then i can pass the object json and the server gets the parameter to
> be serialized?
>
> ________________________________________
> De: Dan Haywood <da...@haywood-associates.co.uk>
> Enviado: domingo, 17 de abril de 2016 07:54 a. m.
> Para: users
> Asunto: Re: list parameters
>
> Yeah, actions with list parameters aren't yet supported in the Isis
> metamodel, so therefore not in the Wicket viewer nor the REST API.
>
> The best workaround I can give you is to define your own data structure, eg
> a json list or XML document, serialize this to a string, and define an
> action that takes that string. You can use things like bookmarks
> ("com.mycompany.myapp.Customer:1") as a way to pass references to objects
> around; the BookmarkService can be used to create/consume these.
>
> HTH
> Dan
>
>
> On 15 April 2016 at 19:24, Arturo Ulises Castañeda Estrada <
> arturo.castaneda@sisorg.com.mx> wrote:
>
> > Hi Dan
> >
> >
> > I'm trying to pass an list as parameter to a method for consume in a WS
> > but i get the error that does not support list as parameter.
> >
> >
> > org.apache.isis.core.commons.exceptions.UnknownTypeException: collections
> > not supported as parameters:
> >
> domainapp.dom.simple.sequence.SequenceItemRepository#addItemsToSequence(domainapp.dom.simple.sequence.Sequence,java.util.List)
> >
> >
> > What can i do to set an list instead of iterate object by object for
> > persist?
> >
>
Re: list parameters
Posted by Arturo Ulises Castañeda Estrada <ar...@sisorg.com.mx>.
Ok, then i can pass the object json and the server gets the parameter to be serialized?
________________________________________
De: Dan Haywood <da...@haywood-associates.co.uk>
Enviado: domingo, 17 de abril de 2016 07:54 a. m.
Para: users
Asunto: Re: list parameters
Yeah, actions with list parameters aren't yet supported in the Isis
metamodel, so therefore not in the Wicket viewer nor the REST API.
The best workaround I can give you is to define your own data structure, eg
a json list or XML document, serialize this to a string, and define an
action that takes that string. You can use things like bookmarks
("com.mycompany.myapp.Customer:1") as a way to pass references to objects
around; the BookmarkService can be used to create/consume these.
HTH
Dan
On 15 April 2016 at 19:24, Arturo Ulises Castañeda Estrada <
arturo.castaneda@sisorg.com.mx> wrote:
> Hi Dan
>
>
> I'm trying to pass an list as parameter to a method for consume in a WS
> but i get the error that does not support list as parameter.
>
>
> org.apache.isis.core.commons.exceptions.UnknownTypeException: collections
> not supported as parameters:
> domainapp.dom.simple.sequence.SequenceItemRepository#addItemsToSequence(domainapp.dom.simple.sequence.Sequence,java.util.List)
>
>
> What can i do to set an list instead of iterate object by object for
> persist?
>
Re: list parameters
Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Yeah, actions with list parameters aren't yet supported in the Isis
metamodel, so therefore not in the Wicket viewer nor the REST API.
The best workaround I can give you is to define your own data structure, eg
a json list or XML document, serialize this to a string, and define an
action that takes that string. You can use things like bookmarks
("com.mycompany.myapp.Customer:1") as a way to pass references to objects
around; the BookmarkService can be used to create/consume these.
HTH
Dan
On 15 April 2016 at 19:24, Arturo Ulises Castañeda Estrada <
arturo.castaneda@sisorg.com.mx> wrote:
> Hi Dan
>
>
> I'm trying to pass an list as parameter to a method for consume in a WS
> but i get the error that does not support list as parameter.
>
>
> org.apache.isis.core.commons.exceptions.UnknownTypeException: collections
> not supported as parameters:
> domainapp.dom.simple.sequence.SequenceItemRepository#addItemsToSequence(domainapp.dom.simple.sequence.Sequence,java.util.List)
>
>
> What can i do to set an list instead of iterate object by object for
> persist?
>