Ranganath Chittari created ISIS-801:
---------------------------------------

             Summary: Action method taking domain object paramater gets 
triggered automatically whenever instances of that object type is accessed
                 Key: ISIS-801
                 URL: https://issues.apache.org/jira/browse/ISIS-801
             Project: Isis
          Issue Type: Bug
            Reporter: Ranganath Chittari
            Assignee: Dan Haywood
            Priority: Critical


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.

For ex:
an action that returns a list of these OmSite, 
when OmSite is in a collection of some other entity,
When new OmSite is created.

Workaround for this issue is annotate @NotContributed  to that action method, 
it will prevent from invoking this method whenever its parameter instance is 
accessed.

BR
Ranganath Varma


Could you please look into this issue.




--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to