Spring Roo
  1. Spring Roo
  2. ROO-318

Add Strategy nature to Entity/Finder

    Details

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

      Description

      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);

        Activity

        Hide
        Raúl Arabaolaza added a comment -

        I suggest to expand the Strategy mechanism to the scalfolding addons too. Currently Roo only supports JSP (with Tiles) for the UI, this support is implemented in a core addon, so it´s no easy for end users to modify Roo to use JSF or Flex for example. If the scalfonding is implemented following a Strategy patern users could easily provide third party addons and use it in daily use of Roo, allowing the coexistence of diferent scalfolding addons in a single install of Roo.

        From my point of view and experience, UI is one of the pieces that needs more time to be developed, and code generation solutions currently available fail to solve this part (at least most of this part), implementing a UI custom strategy addon could easily help in UI development.

        Show
        Raúl Arabaolaza added a comment - I suggest to expand the Strategy mechanism to the scalfolding addons too. Currently Roo only supports JSP (with Tiles) for the UI, this support is implemented in a core addon, so it´s no easy for end users to modify Roo to use JSF or Flex for example. If the scalfonding is implemented following a Strategy patern users could easily provide third party addons and use it in daily use of Roo, allowing the coexistence of diferent scalfolding addons in a single install of Roo. From my point of view and experience, UI is one of the pieces that needs more time to be developed, and code generation solutions currently available fail to solve this part (at least most of this part), implementing a UI custom strategy addon could easily help in UI development.

        Attached Strategy proposal. Look at README.html to set up the proof of concept.

        Show
        Jose Manuel Vivó ( Chema ) - DiSiD Technologies S.L. added a comment - Attached Strategy proposal. Look at README.html to set up the proof of concept.

        This is a UML diagram for better understanding of proposal

        Show
        Jose Manuel Vivó ( Chema ) - DiSiD Technologies S.L. added a comment - This is a UML diagram for better understanding of proposal

          People

          • Assignee:
            Unassigned
            Reporter:
            Dan Alford
          • Votes:
            11 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated: