Uploaded image for project: 'Causeway'
  1. Causeway
  2. CAUSEWAY-801

Action method taking domain object paramater gets triggered automatically whenever instances of that object type is accessed

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • core-1.5.0
    • core-1.6.0
    • Core, Viewer Wicket
    • None

    Description

      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.

      Attachments

        Activity

          People

            danhaywood Daniel Keir Haywood
            ranganath.chittari Ranganath Chittari
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: