Permalink
108 lines (84 sloc) 4.07 KB
// Create project
project setup --topLevelPackage com.disid.restful --projectName restfulshop
// Setup JPA
jpa setup --provider HIBERNATE --database HYPERSONIC_IN_MEMORY
// Create entities without relations
// Address
entity jpa --class ~.model.Address
field string --fieldName street
field string --fieldName city
field number --fieldName streetNumber --type Integer --min 1
// Category
entity jpa --class ~.model.Category --entityFormatMessage category_format
field string --fieldName name --sizeMin 3 --sizeMax 30
field string --fieldName description
// Customer
entity jpa --class ~.model.Customer --entityFormatExpression "#{firstName} #{lastName}"
field string --fieldName firstName
field string --fieldName lastName
// Product
entity jpa --class ~.model.Product --entityFormatExpression #{name}
field string --fieldName name
field string --fieldName description
// CustomerOrder
entity jpa --class ~.model.CustomerOrder --entityFormatExpression #{shipAddress}
field date --fieldName orderDate --type java.util.Date --dateTimeFormatPattern "dd/MM/yyyy"
field date --fieldName shippedDate --type java.util.Date --dateTimeFormatPattern "dd/MM/yyyy"
field string --fieldName shipAddress
// OrderDetailPK
//embeddable --class ~.model.OrderDetailPK --serializable
//field number --fieldName id --type Integer
//field number --fieldName customerOrderId --type Long --column customerOrderId
// OrderDetail
//entity jpa --class ~.model.OrderDetail --identifierType ~.model.OrderDetailPK
entity jpa --class ~.model.OrderDetail
field number --fieldName quantity --type Integer
// Customer relations
focus --class ~.model.Customer
field reference --fieldName address --type ~.model.Address --aggregation false --joinColumnName my_customer
field set --fieldName orders --type ~.model.CustomerOrder --joinTable my_customer_orders --joinColumns my_order --referencedColumns id --inverseJoinColumns my_customer --inverseReferencedColumns id
// Category relations
focus --class ~.model.Category
field set --fieldName products --type ~.model.Product --cardinality MANY_TO_MANY --aggregation --joinTable my_products_categories --joinColumns my_product --referencedColumns id --inverseJoinColumns my_category --inverseReferencedColumns id
// CostumerOrder relations
focus --class ~.model.CustomerOrder
field set --fieldName details --type ~.model.OrderDetail --cardinality ONE_TO_MANY --aggregation false
// Product relations
focus --class ~.model.Product
field set --fieldName orderDetails --type ~.model.OrderDetail
// Generate repositories
repository jpa --all
// Generate service layer
service --all
// Generate finders
dto --class ~.model.CustomerFindByFirstNameAndLastName
field string --fieldName firstName
field string --fieldName lastName
finder add --entity ~.model.Customer --name findByFirstNameAndLastName --formBean ~.model.CustomerFindByFirstNameAndLastName
// Generate web layer
web mvc setup
web mvc language --code es
web mvc controller --all
web mvc view setup --type THYMELEAF
web mvc controller --all --responseType THYMELEAF
// Publishing finders in web layer
web mvc finder --entity ~.model.Customer
web mvc finder --entity ~.model.Customer --responseType THYMELEAF
// detail OneToMany aggregation
web mvc detail --entity ~.model.Customer --field orders
web mvc detail --entity ~.model.Customer --field orders --responseType THYMELEAF --views list,findByFirstNameAndLastName
// detail ManyToMany aggregation
web mvc detail --entity ~.model.Category --field products
web mvc detail --entity ~.model.Category --field products --responseType THYMELEAF
// detail OneToMany composition
web mvc detail --entity ~.model.CustomerOrder --field details
web mvc detail --entity ~.model.CustomerOrder --field details --responseType THYMELEAF
// Unit tests
test unit --class ~.model.Product
test unit --class ~.model.CustomerOrder
test unit --class ~.model.Address
// Integration tests
test integration --class ~.repository.CustomerRepository
test integration --class ~.repository.CategoryRepository
test integration --class ~.web.CustomerOrdersCollectionThymeleafController
test integration --class ~.web.CustomerOrdersCollectionJsonController