Uploaded image for project: 'Spring Roo'
  1. Spring Roo
  2. ROO-318

Add Strategy nature to Entity/Finder


    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:


      Per the forum discussion, it would be helpful to have a Strategy mechanism for the Entity/Finder so that addons that change the core Entity/Finders could be written instead of replacements for Entity/Finder.

      For example, ROO-191 is a request for Soft Delete functionality, which would affect the Entity ( remove) and Finders ( and deleted=false).

      Also http://forum.springsource.org/showthread.php?t=79002 refers to the ability to make Entity and Finder aware of the current user.

      If roo allows the specification of 0 to many Strategies on Entity and Finder, users could easily write addon's that accomplished this behavior without having to recreate the entire Entity/Finder addons.

      The Strategy interface would have to allow for the custom strategy to perform the following:

      1) Add fields to the Entity ( e.g. deleteFlag, user)
      2) Modify or Overwrite Entity methods ( e.g. SoftDelete would override remove with a method that would set deleteFlag=true; and then persist
      3) Allow for the default customization of Finders, so when a user creates a finder for a softDeleteStrategy entity, it would add " and deleteFlag=false" to the JPA query. For UserAwareStrategy it would get more complex, as it would have to be able to both update the JPA query string ( " and user = :user" ) and to also update the parameters on the query, e.g. query.setParameter("user",user);




            • Assignee:
              dalford Dan Alford
            • Votes:
              11 Vote for this issue
              5 Start watching this issue


              • Created: