Intro
Primefaces provides cool rendering facilities on one hand.Minuteproject provides reverse-engineering facilities base on relational database but also on sql statement, on the other hand.
Now you have a query and you want to have a primefaces app!... without writing any (ANY) line of code.
This article is for YOU.
If you download Minuteproject 0.8.2+ you can have an example on how-to do it (delivered as a demo).
This article tracks the steps to follow as well as explaining the demo.
Enrichment
You can consult the entire configuration instatement-driven-development
Minuteproject provides a enrichment area where you can set up your sql queries.Here is the snippet part correspondinng to the query enrichment inside the statement-model node.
.... <statement-model> <queries> <query name="get addresses by criteria" id="c"> <query-body><value> <![CDATA[select * from address where latitude between ? and ? and longitude between ? and ? and lcase(city) like ?]]> </value></query-body> <query-params> <query-param name="latitude_lower_limit" is-mandatory="false" type="DOUBLE" sample="37"></query-param> <query-param name="latitude_upper_limit" type="DOUBLE" sample="38"></query-param> <query-param name="longitude_lower_limit" type="DOUBLE" sample="-122"></query-param> <query-param name="longitude_upper_limit" type="DOUBLE" sample="-123"></query-param> <query-param name="city" type="STRING" sample="'S'" convert="lowercase,append%" default="%"/> </query-params> </query> </queries> </statement-model> </model>
You specify the name of the query which will be used to create
- DTO class
- JSF menu entry
- JSF URL
- JSF form name
- DTO variable
- JSF form entries with validation
Empower primefaces with minuteproject sdd templates
Primefaces needs to have new templates about what to generate coming from SDD.This is given in the track
<target refname="SDD-beans" outputdir-root="../output/JSF-Spring/JPA2" fileName="mp-template-config-SDD-beans.xml" templatedir-root="../../template/framework/bean"> </target>
Steps
Set-up
- Download last version of Minuteproject.
- Unzip in
directory - Start sample petshop DB:
/sample/start-petshop-database.cmd/sh - Go to
/config/demo - Run demo-JSF-Spring-primefaces.cmd/sh
- Go to
/target/mp-bsla - Run install-maven.cmd (it installs a MVN dependency for spring DAO that is not yet (sic) in mvn-central)
- Go to
/demo/output/JSF-Spring - Run 'mvn clean package'
- Run all demos and package.
Generated code
You have a JSF primeface 3.3 app with cupertino theme offering Create, List, Delete on entities and with I/O screen of each query here (GetAddressesByCriteriaInput).The generated code is decomposed into 3 maven project:
- You have JPA2 backend+ DTOs for each SDD query I/O
- You have Spring 3 integration with CRUD DAO on top of entity and DAO for SDD query DTOs.
- You have a JSF front-end integrated with spring
Deployment
Setup
The resulting application is petshopApp.war inIt is ready to be dropped on tomcat or other JEE container.
But before take care that your EL (expression language jar spec and impl) are 2.2.
On tomcat (check that
- el-api-2.2.jar
- el-impl-2.2.jar
- http://stackoverflow.com/questions/7565431/unable-to-start-with-primefaces
- http://stackoverflow.com/questions/11680141/maven-jsf-primefaces-el-nullpointerexception-relating-to-the-primefaces-balises
Deploy
Start tomcat (Drop petshopApp.war in
Result
Here is a little UC where we create an address and we retrieve it base on the ad-hoc sdd query.Create address
List addresses
SDD in action: Use specific criteria to address
Check validation
Future
This is not enough...Why not having multiple statement that works together to produce for example a master-detail or dashboard-master-detail?... primefaces provides nice toolset for that.
Break current limitations
- SDD in the current form is sql oriented, but nothing prevent from having it REST URL resource oriented.
- Add validations, mapping, convertions on I/O params.
- Provide presentation defaulting
- Provide navigation between SDD components
- Add filtering and improved query builder
You have to mention your previous job names as well as organization names in your resume.
ReplyDeleteSample Resume Template