public
Last active

Aerogear Scaffolding with AG Controller stuff

  • Download Gist
gistfile1.md
Markdown

1. Install Forge

Instructions can be found here : http://forge.jboss.org/docs/using/

2. Install feature branch of ag-controller

AG Controller scaffolding needs some features only available in a branch : Clone this repo :

https://github.com/sebastienblanc/aerogear-controller

and check out this branch :

git checkout AEROGEAR-1006

and build:

mvn clean install

3. Create a Forge script

To go faster and avoid typing too much commands you can use a forge script, copy/paste the following in a text file and save it as scaffold.fsh (or whatever name you want)

new-project --named scaffoldtester;
persistence setup --provider HIBERNATE --container JBOSS_AS7;
validation setup --provider JAVA_EE;
entity --named Customer;
field string --named firstName;
field temporal --type DATE --named dateOfBirth;
entity --named DiscountVoucher;
field string --named voucherCode;
entity --named StoreOrder;
field string --named product;
field int --named amount;
constraint Min --onProperty amount --min 1;
constraint Max --onProperty amount --max 50;
field string --named remarks;
constraint Size --onProperty remarks --max 100;
field manyToOne --named customer --fieldType com.example.scaffoldtester.model.Customer.java;
field oneToOne --named voucher --fieldType com.example.scaffoldtester.model.DiscountVoucher.java;
@/*cd ../Customer.java*/;
@/*field oneToMany --named orders --fieldType com.example.scaffoldtester.model.StoreOrder.java*/;
rest setup --activatorType WEB_XML;
rest endpoint-from-entity --contentType application/json com.example.scaffoldtester.model.*;
scaffold setup --scaffoldType html5-aerogear;
scaffold from-entity com.example.scaffoldtester.model.*;

Please feel free after a first test to change the values, names, relations but try to keep consistent in the package naming (remember COC)

4 Start forge

forge

5 Install the Aerogear with controller plugin

Once in the Forge Shell type (forge is part of the command to type) :

forge git-plugin git://github.com/sebastienblanc/scaffold-html5 --ref ag-controller

6 Run the script

run scaffold.fsh

Just press enter for each prompt (defaults are okay)

7 Build the app

mvn clean install

8 Deploy the App

Enjoy !

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.