Announcement Announcement Module
Collapse
No announcement yet.
web mvc json all - Controller_Json.aj generation dependent on class field data. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • web mvc json all - Controller_Json.aj generation dependent on class field data.

    I have a roo script that creates 3 classes with roo scaffolding. The presence of the generated roo json scaffolding is field dependent. IOW, whether I get the json .aj files or not depends on the presence of data fields. I'm sure this can't be intentional.

    Here's the script, there are 3 hierarchical entities, Top, Middle and Bottom, each containing a ref to the upper and a set of the lower.

    Code:
    project --topLevelPackage com.fish.food
    dependency add --groupId org.codehaus.jackson --artifactId jackson-jaxrs --version 1.8.4
    persistence setup --provider HIBERNATE --database POSTGRES --databaseName tentacles --hostName localhost --userName squid --password calamari --transactionManager 
    logging setup --level DEBUG --package PERSISTENCE 
    logging setup --level DEBUG --package PROJECT 
    logging setup --level DEBUG --package ALL_SPRING 
    
    entity --class ~.domain.Top
    entity --class ~.domain.Middle
    entity --class ~.domain.Bottom
    
    entity --class ~.domain.Top
    field string --fieldName name 
    field set --fieldName middles --type ~.domain.Middle --cardinality ONE_TO_MANY
    
    entity --class ~.domain.Middle
    field string --fieldName name 
    field reference --type ~.domain.Top --fieldName top --cardinality MANY_TO_ONE 
    field set --fieldName bottoms --type ~.domain.Bottom --cardinality ONE_TO_MANY 
    field string --fieldName description --notNull
    field string --fieldName pageId --notNull
    
    entity --class ~.domain.Bottom
    field string --fieldName name
    field reference --type ~.domain.Middle --fieldName middle --cardinality MANY_TO_ONE 
    field string --fieldName description --notNull
    field string --fieldName tags
    field string --fieldName pageId --notNull
    
    json all
    web mvc json setup
    web mvc json all --package ~.web
    The way it stands now it generates Controller_Json.af only for Middle and Bottom entities:

    Code:
    Created SRC_MAIN_WEBAPP/WEB-INF/views/login.jspx
    web mvc json all --package ~.web
    Created SRC_MAIN_JAVA/com/fish/food/web
    Created SRC_MAIN_JAVA/com/fish/food/web/MiddleController.java
    Created SRC_MAIN_JAVA/com/fish/food/web/BottomController.java
    Created SRC_MAIN_JAVA/com/fish/food/web/TopController.java
    Created SRC_MAIN_JAVA/com/fish/food/web/BottomController_Roo_Controller_Json.aj
    Created SRC_MAIN_JAVA/com/fish/food/web/MiddleController_Roo_Controller_Json.aj
    Note that the .aj is missing from Top.

    The thing that differentiates whether this file is generated or not is the presence/absence of:
    Code:
       field string --fieldName pageId --notNull
    Remove this line and there is no generated Controller_Json.af for that entity, add it and it comes back again.

    I'm using the nightly 1.2 snapshot from 8/29, the 8/30 does the same thing.

    -Bruce
Working...
X