You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by Erik de Hair <e....@pocos.nl> on 2020/01/17 10:30:16 UTC

Problem with using WrapperFactory on collection in integration test

Hi,

We have an order form (view model) with some collection defined as

@Collection()
@CollectionLayout(named = "Routed subnet(s)")
@Getter @Setter
private List<RoutedSubnet> routedSubnetsPC;

When I call the following method on an integration test I get an exception:

getWrapperFactory().wrap(orderForm).getRoutedSubnetsPC();

Exception:

java.lang.IllegalArgumentException: 
dummypackage.OrderForm#routedSubnetsPC: more than one ImperativeFacet 
for method getRoutedSubnetsPC , with inconsistent intents: 
[CollectionAccessorFacetViaAccessor[type=PropertyOrCollectionAccessorFacet,method=public 
java.util.List dummypackage.OrderForm.getRoutedSubnetsPC()], 
CollectionAddToFacetViaAccessor[type=CollectionAddToFacet,method=public 
java.util.List dummypackage.OrderForm.getRoutedSubnetsPC()], 
CollectionRemoveFromFacetViaAccessor[type=CollectionRemoveFromFacet,method=public 
java.util.List dummypackage.OrderForm.getRoutedSubnetsPC()], 
CollectionClearFacetViaAccessor[type=CollectionClearFacet,method=public 
java.util.List dummypackage.OrderForm.getRoutedSubnetsPC()]]

Any ideas on this?

Thanks,
Erik


UNSCRIBE

Posted by Roberto Lavalle de Juan <ro...@tellmegen.com>.
UNSCRIBE



-------- Mensaje reenviado --------
Asunto: 	Re: Problem with using WrapperFactory on collection in 
integration test
Fecha: 	Tue, 21 Jan 2020 10:05:54 +0000
De: 	Dan Haywood <da...@haywood-associates.co.uk>
Responder a: 	users@isis.apache.org
Para: 	users <us...@isis.apache.org>



Thanks, Erik, I'll take a look.


On Tue, 21 Jan 2020, 09:59 Erik de Hair, <e....@pocos.nl> wrote:

> //
>
> Hi,
>
> I was able to reproduce the problem in a sample application. I've
> created an issue [1] and shared the sample app [2]
>
> Please let me know if you need more information.
>
> Erik
>
> [1] https://issues.apache.org/jira/browse/ISIS-2269
> [2] https://github.com/erikdehair/ISIS-2269
>
>
> On 1/17/20 11:30 AM, Erik de Hair wrote:
>> Hi,
>>
>> We have an order form (view model) with some collection defined as
>>
>> @Collection()
>> @CollectionLayout(named = "Routed subnet(s)")
>> @Getter @Setter
>> private List<RoutedSubnet> routedSubnetsPC;
>>
>> When I call the following method on an integration test I get an
>> exception:
>>
>> getWrapperFactory().wrap(orderForm).getRoutedSubnetsPC();
>>
>> Exception:
>>
>> java.lang.IllegalArgumentException:
>> dummypackage.OrderForm#routedSubnetsPC: more than one ImperativeFacet
>> for method getRoutedSubnetsPC , with inconsistent intents:
>>
> [CollectionAccessorFacetViaAccessor[type=PropertyOrCollectionAccessorFacet,method=public
>
>> java.util.List dummypackage.OrderForm.getRoutedSubnetsPC()],
>> CollectionAddToFacetViaAccessor[type=CollectionAddToFacet,method=public
>> java.util.List dummypackage.OrderForm.getRoutedSubnetsPC()],
>>
> CollectionRemoveFromFacetViaAccessor[type=CollectionRemoveFromFacet,method=public
>
>> java.util.List dummypackage.OrderForm.getRoutedSubnetsPC()],
>> CollectionClearFacetViaAccessor[type=CollectionClearFacet,method=public
>> java.util.List dummypackage.OrderForm.getRoutedSubnetsPC()]]
>>
>> Any ideas on this?
>>
>> Thanks,
>> Erik
>>
>


Re: Problem with using WrapperFactory on collection in integration test

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Here's why that might be the solution.

Within the metamodel we support the concept of mutable collections. This
dates back to the early days of the framework, where one could drag-n-drop
objects into collections to create associations.

When I implemented the wicket viewer I never got around to implementing
that feature, and then later on it seemed that having actions to add or
remove from collections seemed a better approach all round.

However, the wrapper factory does try to support mutable collections.
What's happening here in your code is that the OneToManyAssociation has
three facets attached to it, because given the underlying mutable
collection, it could be used either to access it (is read its contents), or
to add(), or to remove().

Another way to fix your issue would be to write some addToXxx() and
removeFromXxx() methods, because then those additional troublesome facets
would move to those actions instead.

Hope that helps, and works.

Thx,
Dan.


On Fri, 24 Jan 2020, 10:19 Dan Haywood, <da...@haywood-associates.co.uk>
wrote:

> Hi Erik,
>
> If you mark the collection as non-editable, then I suspect this might fix
> it. Could you give that a try?
>
> Thx
> Dan
>
>
>
> On Tue, 21 Jan 2020, 10:05 Dan Haywood, <da...@haywood-associates.co.uk>
> wrote:
>
>> Thanks, Erik, I'll take a look.
>>
>>
>> On Tue, 21 Jan 2020, 09:59 Erik de Hair, <e....@pocos.nl> wrote:
>>
>>> //
>>>
>>> Hi,
>>>
>>> I was able to reproduce the problem in a sample application. I've
>>> created an issue [1] and shared the sample app [2]
>>>
>>> Please let me know if you need more information.
>>>
>>> Erik
>>>
>>> [1] https://issues.apache.org/jira/browse/ISIS-2269
>>> [2] https://github.com/erikdehair/ISIS-2269
>>>
>>>
>>> On 1/17/20 11:30 AM, Erik de Hair wrote:
>>> > Hi,
>>> >
>>> > We have an order form (view model) with some collection defined as
>>> >
>>> > @Collection()
>>> > @CollectionLayout(named = "Routed subnet(s)")
>>> > @Getter @Setter
>>> > private List<RoutedSubnet> routedSubnetsPC;
>>> >
>>> > When I call the following method on an integration test I get an
>>> > exception:
>>> >
>>> > getWrapperFactory().wrap(orderForm).getRoutedSubnetsPC();
>>> >
>>> > Exception:
>>> >
>>> > java.lang.IllegalArgumentException:
>>> > dummypackage.OrderForm#routedSubnetsPC: more than one ImperativeFacet
>>> > for method getRoutedSubnetsPC , with inconsistent intents:
>>> >
>>> [CollectionAccessorFacetViaAccessor[type=PropertyOrCollectionAccessorFacet,method=public
>>>
>>> > java.util.List dummypackage.OrderForm.getRoutedSubnetsPC()],
>>> >
>>> CollectionAddToFacetViaAccessor[type=CollectionAddToFacet,method=public
>>> > java.util.List dummypackage.OrderForm.getRoutedSubnetsPC()],
>>> >
>>> CollectionRemoveFromFacetViaAccessor[type=CollectionRemoveFromFacet,method=public
>>>
>>> > java.util.List dummypackage.OrderForm.getRoutedSubnetsPC()],
>>> >
>>> CollectionClearFacetViaAccessor[type=CollectionClearFacet,method=public
>>> > java.util.List dummypackage.OrderForm.getRoutedSubnetsPC()]]
>>> >
>>> > Any ideas on this?
>>> >
>>> > Thanks,
>>> > Erik
>>> >
>>>
>>

Re: Problem with using WrapperFactory on collection in integration test

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Hi Erik,

If you mark the collection as non-editable, then I suspect this might fix
it. Could you give that a try?

Thx
Dan



On Tue, 21 Jan 2020, 10:05 Dan Haywood, <da...@haywood-associates.co.uk>
wrote:

> Thanks, Erik, I'll take a look.
>
>
> On Tue, 21 Jan 2020, 09:59 Erik de Hair, <e....@pocos.nl> wrote:
>
>> //
>>
>> Hi,
>>
>> I was able to reproduce the problem in a sample application. I've
>> created an issue [1] and shared the sample app [2]
>>
>> Please let me know if you need more information.
>>
>> Erik
>>
>> [1] https://issues.apache.org/jira/browse/ISIS-2269
>> [2] https://github.com/erikdehair/ISIS-2269
>>
>>
>> On 1/17/20 11:30 AM, Erik de Hair wrote:
>> > Hi,
>> >
>> > We have an order form (view model) with some collection defined as
>> >
>> > @Collection()
>> > @CollectionLayout(named = "Routed subnet(s)")
>> > @Getter @Setter
>> > private List<RoutedSubnet> routedSubnetsPC;
>> >
>> > When I call the following method on an integration test I get an
>> > exception:
>> >
>> > getWrapperFactory().wrap(orderForm).getRoutedSubnetsPC();
>> >
>> > Exception:
>> >
>> > java.lang.IllegalArgumentException:
>> > dummypackage.OrderForm#routedSubnetsPC: more than one ImperativeFacet
>> > for method getRoutedSubnetsPC , with inconsistent intents:
>> >
>> [CollectionAccessorFacetViaAccessor[type=PropertyOrCollectionAccessorFacet,method=public
>>
>> > java.util.List dummypackage.OrderForm.getRoutedSubnetsPC()],
>> > CollectionAddToFacetViaAccessor[type=CollectionAddToFacet,method=public
>> > java.util.List dummypackage.OrderForm.getRoutedSubnetsPC()],
>> >
>> CollectionRemoveFromFacetViaAccessor[type=CollectionRemoveFromFacet,method=public
>>
>> > java.util.List dummypackage.OrderForm.getRoutedSubnetsPC()],
>> > CollectionClearFacetViaAccessor[type=CollectionClearFacet,method=public
>> > java.util.List dummypackage.OrderForm.getRoutedSubnetsPC()]]
>> >
>> > Any ideas on this?
>> >
>> > Thanks,
>> > Erik
>> >
>>
>

Re: Problem with using WrapperFactory on collection in integration test

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Thanks, Erik, I'll take a look.


On Tue, 21 Jan 2020, 09:59 Erik de Hair, <e....@pocos.nl> wrote:

> //
>
> Hi,
>
> I was able to reproduce the problem in a sample application. I've
> created an issue [1] and shared the sample app [2]
>
> Please let me know if you need more information.
>
> Erik
>
> [1] https://issues.apache.org/jira/browse/ISIS-2269
> [2] https://github.com/erikdehair/ISIS-2269
>
>
> On 1/17/20 11:30 AM, Erik de Hair wrote:
> > Hi,
> >
> > We have an order form (view model) with some collection defined as
> >
> > @Collection()
> > @CollectionLayout(named = "Routed subnet(s)")
> > @Getter @Setter
> > private List<RoutedSubnet> routedSubnetsPC;
> >
> > When I call the following method on an integration test I get an
> > exception:
> >
> > getWrapperFactory().wrap(orderForm).getRoutedSubnetsPC();
> >
> > Exception:
> >
> > java.lang.IllegalArgumentException:
> > dummypackage.OrderForm#routedSubnetsPC: more than one ImperativeFacet
> > for method getRoutedSubnetsPC , with inconsistent intents:
> >
> [CollectionAccessorFacetViaAccessor[type=PropertyOrCollectionAccessorFacet,method=public
>
> > java.util.List dummypackage.OrderForm.getRoutedSubnetsPC()],
> > CollectionAddToFacetViaAccessor[type=CollectionAddToFacet,method=public
> > java.util.List dummypackage.OrderForm.getRoutedSubnetsPC()],
> >
> CollectionRemoveFromFacetViaAccessor[type=CollectionRemoveFromFacet,method=public
>
> > java.util.List dummypackage.OrderForm.getRoutedSubnetsPC()],
> > CollectionClearFacetViaAccessor[type=CollectionClearFacet,method=public
> > java.util.List dummypackage.OrderForm.getRoutedSubnetsPC()]]
> >
> > Any ideas on this?
> >
> > Thanks,
> > Erik
> >
>

Re: Problem with using WrapperFactory on collection in integration test

Posted by Erik de Hair <e....@pocos.nl>.
//

Hi,

I was able to reproduce the problem in a sample application. I've 
created an issue [1] and shared the sample app [2]

Please let me know if you need more information.

Erik

[1] https://issues.apache.org/jira/browse/ISIS-2269
[2] https://github.com/erikdehair/ISIS-2269


On 1/17/20 11:30 AM, Erik de Hair wrote:
> Hi,
>
> We have an order form (view model) with some collection defined as
>
> @Collection()
> @CollectionLayout(named = "Routed subnet(s)")
> @Getter @Setter
> private List<RoutedSubnet> routedSubnetsPC;
>
> When I call the following method on an integration test I get an 
> exception:
>
> getWrapperFactory().wrap(orderForm).getRoutedSubnetsPC();
>
> Exception:
>
> java.lang.IllegalArgumentException: 
> dummypackage.OrderForm#routedSubnetsPC: more than one ImperativeFacet 
> for method getRoutedSubnetsPC , with inconsistent intents: 
> [CollectionAccessorFacetViaAccessor[type=PropertyOrCollectionAccessorFacet,method=public 
> java.util.List dummypackage.OrderForm.getRoutedSubnetsPC()], 
> CollectionAddToFacetViaAccessor[type=CollectionAddToFacet,method=public 
> java.util.List dummypackage.OrderForm.getRoutedSubnetsPC()], 
> CollectionRemoveFromFacetViaAccessor[type=CollectionRemoveFromFacet,method=public 
> java.util.List dummypackage.OrderForm.getRoutedSubnetsPC()], 
> CollectionClearFacetViaAccessor[type=CollectionClearFacet,method=public 
> java.util.List dummypackage.OrderForm.getRoutedSubnetsPC()]]
>
> Any ideas on this?
>
> Thanks,
> Erik
>