Created
January 23, 2012 22:53
-
-
Save mojavelinux/1666087 to your computer and use it in GitHub Desktop.
Forge script of generate point of sale application
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@/* Disables interactive commands */; | |
set ACCEPT_DEFAULTS true; | |
@/* Create a new project in the current directory */; | |
new-project; | |
@/* Turn our Java project into a Web project with JSF, CDI, EJB, JPA and BV */; | |
scaffold setup --scaffoldType faces; | |
persistence setup --provider HIBERNATE --container JBOSS_AS7; | |
validation setup --provider HIBERNATE_VALIDATOR; | |
@/* Create some JPA @Entities on which to base our application */; | |
entity --named Customer --package ~.domain; | |
field string --named firstName; | |
field string --named lastName; | |
field temporal --type DATE --named birthDate; | |
entity --named Item; | |
field string --named name; | |
field number --named price --type java.lang.Double; | |
field int --named stock; | |
cd ..; | |
@/* Create more entities, also add a relationship between Customer and their Orders */; | |
entity --named ProductOrder; | |
field manyToOne --named customer --fieldType ~.domain.Customer.java --inverseFieldName orders; | |
cd ../Customer.java; | |
entity --named Profile; | |
field string --named bio; | |
field string --named preferredName; | |
field string --named notes; | |
entity --named Address; | |
field string --named street; | |
field string --named city; | |
entity --named ZipCode; | |
field int --named code; | |
cd ../Address.java; | |
@/* Add more relationships between our @Entities */; | |
field manyToOne --named zip --fieldType ~.domain.ZipCode.java; | |
cd ..; | |
cd Customer.java; | |
field manyToMany --named addresses --fieldType ~.domain.Address.java; | |
cd ..; | |
cd Address.java; | |
cd ../Customer.java; | |
field oneToOne --named profile --fieldType ~.domain.Profile.java; | |
cd ..; | |
cd ProductOrder.java; | |
field manyToMany --named items --fieldType ~.domain.Item.java; | |
cd ..; | |
cd ProductOrder.java; | |
field manyToOne --named shippingAddress --fieldType ~.domain.Address.java; | |
cd ..; | |
@/* Generate the UI for all of our @Entities at once */; | |
scaffold from-entity ~.domain.* --scaffoldType faces --overwrite; | |
cd ~~; | |
@/* Setup JAX-RS, and create CRUD endpoints */; | |
rest setup; | |
rest endpoint-from-entity ~.domain.*; | |
@/* Build the project */; | |
build; | |
@/* Return to the project root directory and leave it in your hands */; | |
cd ~~; | |
echo "Project Info:"; project; | |
@/* Reenable interactive commands */; | |
set ACCEPT_DEFAULTS false; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment