You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by ch...@wipro.com on 2014/06/11 14:21:09 UTC

Action method with Domain object parameter triggers automatically.

Hi,

I have application security service which creates permission to manage particular entity(OmSite). Its action method is:

    @Bookmarkable
    @MemberOrder(sequence = "9")
    @Named("Create Site Permission")
    public OmPermission createSitePermission(final @Named("Choose a site") OmSite site) {
        final OmPermission obj = newTransientInstance(OmPermission.class);
        obj.setPermission(SecurityUtil.formatSitePermission(site.getOrgId(), site.getSiteId()));
        obj.setSite(site);
        persistIfNotAlready(obj);
        return obj;
    }


As you can see this method takes OmSite instance to create a permission to that instance. And OmPermission has foreign key to OmSite. This action is displayed in service menu and its working fine.

But the problem I am facing is when I access the list of OmSite objects in other UI pages.  This action method is getting triggered automatically and inserts bulk OmPermissions for all those List<OmSite> objects.


This action method createSitePermission should be invoked only if it is clicked manually, but it gets triggered automatically whenever OmSite is accesed in some other places.

Could you please look into this issue.

Br
Ranganath Varma

The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.

www.wipro.com

RE: Action method with Domain object parameter triggers automatically.

Posted by ch...@wipro.com.
https://issues.apache.org/jira/browse/ISIS-801
created for this issue.

-----Original Message-----
From: Dan Haywood [mailto:dan@haywood-associates.co.uk] 
Sent: Wednesday, June 11, 2014 6:39 PM
To: users
Subject: Re: Action method with Domain object parameter triggers automatically.

even though we have a workaround, could you raise a ticket for this?
Definitely is a bug.

thx
Dan



On 11 June 2014 14:05, <ch...@wipro.com> wrote:

> Annotating @NotContributed prevented it from invoking automatically.
>
>
> >>What other UI pages exactly?  I'm guessing you have an action that
> returns a list of these OmSites?  Or is it when OmSite is in a 
> collection of some other entity?  (ie is this a standalone or a 
> parented collection of
> >>OmSites?)
> Yes, both.
>
>
> I will install git client to push demo app for any issues again
>
> Thanks
>
>
> -----Original Message-----
> From: Dan Haywood [mailto:dan@haywood-associates.co.uk]
> Sent: Wednesday, June 11, 2014 6:17 PM
> To: users
> Subject: Re: Action method with Domain object parameter triggers 
> automatically.
>
> On 11 June 2014 13:21, <ch...@wipro.com> wrote:
>
> > Hi,
> >
> > I have application security service which creates permission to 
> > manage particular entity(OmSite). Its action method is:
> >
> >     @Bookmarkable
> >     @MemberOrder(sequence = "9")
> >     @Named("Create Site Permission")
> >     public OmPermission createSitePermission(final @Named("Choose a
> > site") OmSite site) {
> >         final OmPermission obj =
> > newTransientInstance(OmPermission.class);
> >
> > obj.setPermission(SecurityUtil.formatSitePermission(site.getOrgId(),
> > site.getSiteId()));
> >         obj.setSite(site);
> >         persistIfNotAlready(obj);
> >         return obj;
> >     }
> >
> >
> > As you can see this method takes OmSite instance to create a 
> > permission to that instance. And OmPermission has foreign key to 
> > OmSite. This action is displayed in service menu and its working fine.
> >
> > But the problem I am facing is when I access the list of OmSite 
> > objects in other UI pages.
>
>
> What other UI pages exactly?  I'm guessing you have an action that 
> returns a list of these OmSites?  Or is it when OmSite is in a 
> collection of some other entity?  (ie is this a standalone or a 
> parented collection of
> OmSites?)
>
>
>
>
>
> > This action method is getting triggered automatically and inserts 
> > bulk OmPermissions for all those List<OmSite> objects.
> >
> >
> Clearly that shouldn't happen.  One possible work-around: annotate the 
> action as @NotContributed.
>
> >
> >
>
>
> > Could you please look into this issue.
> >
> >
> I will do.  But (just to repeat myself), if you can provide a sample 
> app demonstrating the problem up on github, it makes it that much 
> easier / motivates me to do so.
>
>
> Dan
>
>
>
> > Br
> > Ranganath Varma
> >
> > The information contained in this electronic message and any 
> > attachments to this message are intended for the exclusive use of 
> > the
> > addressee(s) and may contain proprietary, confidential or privileged 
> > information. If you are not the intended recipient, you should not 
> > disseminate, distribute or copy this e-mail. Please notify the 
> > sender immediately and destroy all copies of this message and any attachments.
> >
> > WARNING: Computer viruses can be transmitted via email. The 
> > recipient should check this email and any attachments for the presence of viruses.
> > The company accepts no liability for any damage caused by any virus 
> > transmitted by this email.
> >
> > www.wipro.com
> >
>
> The information contained in this electronic message and any 
> attachments to this message are intended for the exclusive use of the 
> addressee(s) and may contain proprietary, confidential or privileged 
> information. If you are not the intended recipient, you should not 
> disseminate, distribute or copy this e-mail. Please notify the sender 
> immediately and destroy all copies of this message and any attachments.
>
> WARNING: Computer viruses can be transmitted via email. The recipient 
> should check this email and any attachments for the presence of viruses.
> The company accepts no liability for any damage caused by any virus 
> transmitted by this email.
>
> www.wipro.com
>

The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.

www.wipro.com

Re: Action method with Domain object parameter triggers automatically.

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
even though we have a workaround, could you raise a ticket for this?
Definitely is a bug.

thx
Dan



On 11 June 2014 14:05, <ch...@wipro.com> wrote:

> Annotating @NotContributed prevented it from invoking automatically.
>
>
> >>What other UI pages exactly?  I'm guessing you have an action that
> returns a list of these OmSites?  Or is it when OmSite is in a collection
> of some other entity?  (ie is this a standalone or a parented collection of
> >>OmSites?)
> Yes, both.
>
>
> I will install git client to push demo app for any issues again
>
> Thanks
>
>
> -----Original Message-----
> From: Dan Haywood [mailto:dan@haywood-associates.co.uk]
> Sent: Wednesday, June 11, 2014 6:17 PM
> To: users
> Subject: Re: Action method with Domain object parameter triggers
> automatically.
>
> On 11 June 2014 13:21, <ch...@wipro.com> wrote:
>
> > Hi,
> >
> > I have application security service which creates permission to manage
> > particular entity(OmSite). Its action method is:
> >
> >     @Bookmarkable
> >     @MemberOrder(sequence = "9")
> >     @Named("Create Site Permission")
> >     public OmPermission createSitePermission(final @Named("Choose a
> > site") OmSite site) {
> >         final OmPermission obj =
> > newTransientInstance(OmPermission.class);
> >
> > obj.setPermission(SecurityUtil.formatSitePermission(site.getOrgId(),
> > site.getSiteId()));
> >         obj.setSite(site);
> >         persistIfNotAlready(obj);
> >         return obj;
> >     }
> >
> >
> > As you can see this method takes OmSite instance to create a
> > permission to that instance. And OmPermission has foreign key to
> > OmSite. This action is displayed in service menu and its working fine.
> >
> > But the problem I am facing is when I access the list of OmSite
> > objects in other UI pages.
>
>
> What other UI pages exactly?  I'm guessing you have an action that returns
> a list of these OmSites?  Or is it when OmSite is in a collection of some
> other entity?  (ie is this a standalone or a parented collection of
> OmSites?)
>
>
>
>
>
> > This action method is getting triggered automatically and inserts bulk
> > OmPermissions for all those List<OmSite> objects.
> >
> >
> Clearly that shouldn't happen.  One possible work-around: annotate the
> action as @NotContributed.
>
> >
> >
>
>
> > Could you please look into this issue.
> >
> >
> I will do.  But (just to repeat myself), if you can provide a sample app
> demonstrating the problem up on github, it makes it that much easier /
> motivates me to do so.
>
>
> Dan
>
>
>
> > Br
> > Ranganath Varma
> >
> > The information contained in this electronic message and any
> > attachments to this message are intended for the exclusive use of the
> > addressee(s) and may contain proprietary, confidential or privileged
> > information. If you are not the intended recipient, you should not
> > disseminate, distribute or copy this e-mail. Please notify the sender
> > immediately and destroy all copies of this message and any attachments.
> >
> > WARNING: Computer viruses can be transmitted via email. The recipient
> > should check this email and any attachments for the presence of viruses.
> > The company accepts no liability for any damage caused by any virus
> > transmitted by this email.
> >
> > www.wipro.com
> >
>
> The information contained in this electronic message and any attachments
> to this message are intended for the exclusive use of the addressee(s) and
> may contain proprietary, confidential or privileged information. If you are
> not the intended recipient, you should not disseminate, distribute or copy
> this e-mail. Please notify the sender immediately and destroy all copies of
> this message and any attachments.
>
> WARNING: Computer viruses can be transmitted via email. The recipient
> should check this email and any attachments for the presence of viruses.
> The company accepts no liability for any damage caused by any virus
> transmitted by this email.
>
> www.wipro.com
>

RE: Action method with Domain object parameter triggers automatically.

Posted by ch...@wipro.com.
Annotating @NotContributed prevented it from invoking automatically.


>>What other UI pages exactly?  I'm guessing you have an action that returns a list of these OmSites?  Or is it when OmSite is in a collection of some other entity?  (ie is this a standalone or a parented collection of
>>OmSites?) 
Yes, both.


I will install git client to push demo app for any issues again

Thanks


-----Original Message-----
From: Dan Haywood [mailto:dan@haywood-associates.co.uk] 
Sent: Wednesday, June 11, 2014 6:17 PM
To: users
Subject: Re: Action method with Domain object parameter triggers automatically.

On 11 June 2014 13:21, <ch...@wipro.com> wrote:

> Hi,
>
> I have application security service which creates permission to manage 
> particular entity(OmSite). Its action method is:
>
>     @Bookmarkable
>     @MemberOrder(sequence = "9")
>     @Named("Create Site Permission")
>     public OmPermission createSitePermission(final @Named("Choose a 
> site") OmSite site) {
>         final OmPermission obj = 
> newTransientInstance(OmPermission.class);
>
> obj.setPermission(SecurityUtil.formatSitePermission(site.getOrgId(),
> site.getSiteId()));
>         obj.setSite(site);
>         persistIfNotAlready(obj);
>         return obj;
>     }
>
>
> As you can see this method takes OmSite instance to create a 
> permission to that instance. And OmPermission has foreign key to 
> OmSite. This action is displayed in service menu and its working fine.
>
> But the problem I am facing is when I access the list of OmSite 
> objects in other UI pages.


What other UI pages exactly?  I'm guessing you have an action that returns a list of these OmSites?  Or is it when OmSite is in a collection of some other entity?  (ie is this a standalone or a parented collection of
OmSites?)





> This action method is getting triggered automatically and inserts bulk 
> OmPermissions for all those List<OmSite> objects.
>
>
Clearly that shouldn't happen.  One possible work-around: annotate the action as @NotContributed.

>
>


> Could you please look into this issue.
>
>
I will do.  But (just to repeat myself), if you can provide a sample app demonstrating the problem up on github, it makes it that much easier / motivates me to do so.


Dan



> Br
> Ranganath Varma
>
> The information contained in this electronic message and any 
> attachments to this message are intended for the exclusive use of the 
> addressee(s) and may contain proprietary, confidential or privileged 
> information. If you are not the intended recipient, you should not 
> disseminate, distribute or copy this e-mail. Please notify the sender 
> immediately and destroy all copies of this message and any attachments.
>
> WARNING: Computer viruses can be transmitted via email. The recipient 
> should check this email and any attachments for the presence of viruses.
> The company accepts no liability for any damage caused by any virus 
> transmitted by this email.
>
> www.wipro.com
>

The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.

www.wipro.com

Re: Action method with Domain object parameter triggers automatically.

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
On 11 June 2014 13:21, <ch...@wipro.com> wrote:

> Hi,
>
> I have application security service which creates permission to manage
> particular entity(OmSite). Its action method is:
>
>     @Bookmarkable
>     @MemberOrder(sequence = "9")
>     @Named("Create Site Permission")
>     public OmPermission createSitePermission(final @Named("Choose a site")
> OmSite site) {
>         final OmPermission obj = newTransientInstance(OmPermission.class);
>
> obj.setPermission(SecurityUtil.formatSitePermission(site.getOrgId(),
> site.getSiteId()));
>         obj.setSite(site);
>         persistIfNotAlready(obj);
>         return obj;
>     }
>
>
> As you can see this method takes OmSite instance to create a permission to
> that instance. And OmPermission has foreign key to OmSite. This action is
> displayed in service menu and its working fine.
>
> But the problem I am facing is when I access the list of OmSite objects in
> other UI pages.


What other UI pages exactly?  I'm guessing you have an action that returns
a list of these OmSites?  Or is it when OmSite is in a collection of some
other entity?  (ie is this a standalone or a parented collection of
OmSites?)





> This action method is getting triggered automatically and inserts bulk
> OmPermissions for all those List<OmSite> objects.
>
>
Clearly that shouldn't happen.  One possible work-around: annotate the
action as @NotContributed.

>
>


> Could you please look into this issue.
>
>
I will do.  But (just to repeat myself), if you can provide a sample app
demonstrating the problem up on github, it makes it that much easier /
motivates me to do so.


Dan



> Br
> Ranganath Varma
>
> The information contained in this electronic message and any attachments
> to this message are intended for the exclusive use of the addressee(s) and
> may contain proprietary, confidential or privileged information. If you are
> not the intended recipient, you should not disseminate, distribute or copy
> this e-mail. Please notify the sender immediately and destroy all copies of
> this message and any attachments.
>
> WARNING: Computer viruses can be transmitted via email. The recipient
> should check this email and any attachments for the presence of viruses.
> The company accepts no liability for any damage caused by any virus
> transmitted by this email.
>
> www.wipro.com
>