I have application security service which creates permission to manage particular entity(OmSite). Its action method is:
@MemberOrder(sequence = "9")
@Named("Create Site Permission")
public OmPermission createSitePermission(final @Named("Choose a site") OmSite site)
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.
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.
Could you please look into this issue.