Monday, December 26, 2022

Jsf 2.x Spring 5 Hibernate Primefaces 11 Web application skelton / generator

Versions


Date Version Remarks
12-26-2022 0.1-SNAPSHOT First version
06-23-2024 1.0 Mavenized project

 

JSF generator

This post aims to offer to j2ee developers easy way to develop jsf/spring/primfaces applications by making downloadable:
1- An skelton of a basic securized application
2- A generator for CRUD web pages and java classes in different layers from view to model.


1- Used architecture is a  typical MVC implementation usually used in j2ee web applications:


View <----->  Backing beans (bean package)
    |                                    |
    |                      Service or business layer
    |                           (service package) <---Implementation
    |                                    |
    |                               Dao layer <---Implementation
    |                                    |
    |                                 Model  <----> DB 
    |
----|--------------------------------------------------------------------------------------------------------------------
    |                                     Spring security
----|----------------------------------------------------------------------------------------------------------------------        |                                                              
    |
Web browser

Generic Dao class was developeled to make easier complex queries manipulation
Hibernate is used as JPA implementation


Project workspace on sourceforge is

https://sourceforge.net/projects/jsf-project-generator/

First of all to make things most attractive... that's the final result
(User test / test123)










Skelton is downloadable here (Maven project)



2- Generator
generator is a simple tool to generate the above layers for CRUD operation on a specific data entity

Steps to generate files for an entity
1- We need to compile the entity !!!
    Copy the entity into folder group-id/artifact-id/model
    Example Product.java class for com.thinkopen group-id
                                                  skelton artifact-id
     will be copied to JSF-GENERATOR-FOLDER/com/thinopen/skelton/model



  2-turn operationCode parameter in config.properties file to "script"
             groupId=com.thinkopen
             artifactId=skelton
             classes=Product:
   in case of many classes put them all on the same line ":" separated


 
3- run
      java -jar generator.jar
      output will be



4- Compilation:
run command script ./script.sh.bat





If all right we will have a successful compilation message.

5- Generate all files:
Turn operationCode to all



6-run  java -jar generator.jar as last step

---> All generated will be in output folder, copy and put then in your project tree.