Skip to content

Instantly share code, notes, and snippets.

@matzew
Forked from sebastienblanc/gist:5222680
Created March 28, 2013 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matzew/5263365 to your computer and use it in GitHub Desktop.
Save matzew/5263365 to your computer and use it in GitHub Desktop.

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 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment