XxxController_Roo_GvNIXDatatables.aj not updated for changes in the Xxxcontroller.java class

106 views Asked by At

XxxController_Roo_GvNIXDatatables.aj not updated for changes in the Xxxcontroller.java class. When adding "update=false, delete=false" to the controller class, the XxxController_Roo_Controller.aj is updated by removing the update and delete methods, however for the XxxController_Roo_GvNIXDatatables.aj this is not the case. This in turn leads to errors, as described below. An example As an example I have the Spring roo script below

"project --topLevelPackage com.springsource.petclinic

jpa setup --provider HIBERNATE --database HYPERSONIC_IN_MEMORY

entity jpa --class ~.domain.Pet --sequenceName PET_SEQ
field string --fieldName name --notNull --sizeMin 1
field number --fieldName weight --type java.lang.Float --notNull --min 0

web mvc setup
web mvc all --package ~.web

web mvc jquery setup
web mvc jquery all

web mvc datatables setup
web mvc bootstrap setup

web mvc datatables add --type ~.web.PetController

In some use cases, like transactions, you don't want the user to update or delete, so I changed the PetController.java class by adding "update=false, delete=false". So old:

@RequestMapping("/pets")
@Controller
@RooWebScaffold(path = "pets", formBackingObject = Pet.class)
@GvNIXWebJQuery
@GvNIXDatatables(ajax = true)
public class PetController {
}

new:

@RequestMapping("/pets")
@Controller
@RooWebScaffold(path = "pets", formBackingObject = Pet.class, update=false, delete=false)
@GvNIXWebJQuery
@GvNIXDatatables(ajax = true)
public class PetController {
}

The effect is that in PetController_Roo_Controller.aj file the methods for update and delete are removed.

public String PetController.update(@Valid Pet pet, BindingResult bindingResult, Model uiModel, HttpServletRequest httpServletRequest) {
public String PetController.updateForm(@PathVariable("id") Long id, Model uiModel) {
public String PetController.delete(@PathVariable("id") Long id, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model uiModel) {

HOWEVER In the PetController_Roo_GvNIXDatatables.aj file, the update and delete method are not removed. This results in the errors:

  1. The method update(Pet, BindingResult, Model, HttpServletRequest) is undefined for the type PetController
  2. The method delete(Long, Integer, Integer, Model) is undefined for the type PetController

Questions:

  1. Is my assumption correct that both aspectJ files should be treated the same?
  2. Is there a workaround? I don't want to push-in, because, in my opinion they should not be there. And removing the code from the PetController_Roo_GvNIXDatatables.aj does not help, because they are inserted the next time I start the Roo shell automatically, which btw is correct.
1

There are 1 answers

2
jcgarcia On BEST ANSWER

At first, thanks for your report and your interest on gvNIX project.

In the second place, you are right. Datatables aspectJ file should be updated when Controller is configured to remove some actions like update or create.

Unfortunately, there is not workaround without push-in.

I will take in mind this issue for next version of gvNIX.

Best Regards and thank you again!