Announcement Announcement Module
No announcement yet.
Removing methods from scaffold'ed Controllers Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Removing methods from scaffold'ed Controllers

    I have an Abstract Entity. In Roo Shell I did something like this:
    controller scaffold --entity ~domain.AbstractEntity --class ~web.AbstractEntitytController
    This worked fine, except the code that was generated in the AspectJ file corresponding to the Controller has an error in it:
        @RequestMapping(params = "form", method = RequestMethod.GET)
        public String AbstractEntityController.createForm(Model model) {
            model.addAttribute("abstractEntity", new AbstractEntity());
            return "abstractEntity/create";
    The gen-code wants to create an instance of an Abstract Class, a big no-no. In this case, I don't care about creating AbstractEntity's anyway, I only want the List functionality, so I whack the method...

    ...problem is, Roo re-generates the code next time I touch AbstractEntity again.

    I know that by adding the following to your Controller:
    @RooWebScaffold(automaticallyMaintainView = false)
    You can instruct Roo to keep its hands off the Controller code...but this isn't a good option long-term. What would be nice is if I can instruct Roo somehow as to what Controller methods I want. For instance, I could say I want "list" and "delete", but not "insert".

    Is this possible? Has anyone else ran into this problem? I can add the stated flag to the Controller for now, whack the offending method, and keep on about my day, but I would rather do this right.