Win a copy of Pipeline as Code this week in the Cloud/Virtualization forum!

Guillermo Gefaell

Greenhorn
+ Follow
since Feb 05, 2014
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Guillermo Gefaell

Hi!

I've been working a bit in getting a "Zero project" with some usual java frameworks that works out out of the box with minimal configuration. Is not aimed to profesional or production environments, but can get you working in a prototype fast without the cumberstone work of putting all the pieces to work. It's open source of course and can be downloaded/cloned at github. Any idea will be welcome.



Stack
Spring 5, Primefaces 6.2 + PF Extension,s Spring Data + Hibernate 5, Spring Security, Junit, H2, MySQL 8, Liquibase, MapStruct

What does includes?

   A backend project for the data access and service layers, with all Database related stuff in it.
   An api layer with interfaces and DTOS.
   A frontend project for the view and its managedbeans, security, i18n and jetty for runing.
   A basic model for user login, register and update user info.

The good

   DTOs and entity mapping with MapStruct
   Facebook login example and register
   User with login and register using email
   Jetty ready for fast development
   Forgot password email
   Cluster markes for Primefaces map (see http://ggefaell.blogspot.cl/2015/07/marker-clusterer-in-primefaces-gmap.html)
   Image resize using Scalr library (great open source library that uses Java 2D functions for scaling https://github.com/thebuzzmedia/imgscalr)
   Fileupload ready for PF uploadfile
   Liquibase for database changes.
   Use of Maven SQL plugin for cleaning and loading the local database.
   Junit with inmemory H2 database ready to run.
   Integration Junits to the local database.
   Password encryption
   Async mail sending
   Cron jobs using Spring @Scheduled
   Prettyfaces for permanent URL links and URl rewriting
   Font awsome icons
   Ehcache for Hibernate second level cache
   File service for writing to disk files uploaded by the users.
   Nice js lightbox library included
   Multilanguage

The bad

Not really a production ready archetype. More like a fast prototype and to play around with java fw. Poor documentation right now on the goodies and how to make them work.

The Ugly

No pretty default template or pretty layout to start working. Just a basic template with a Mainlayout an ui:composition. Some examples are still missing like the lightbox or the cluster marker for gmaps.

Hope you like it.
2 years ago
I have uploaded full code and a little, non-working, example to get the idea behind this.
https://github.com/konum/Vidyq
Hi

In my current job they are defining a new corporate architecture for java development. It is something like this:

-ProjectView: JSF view layer. Uses delegates on the ProjectClient layer.
-ProjectClient: Defines Delegates and Facades. It does de lookup for the EJBs of the business layer.
-ProjectBusiness: Implements the Facades defined by the client layer as remotes EJBs. It also containes the model and the DAO layer.

One of the main problems of this architecture is that you have to write a lot of code in different layers just to get some query done.

My concern
Let's say we have an entity Car with attributes horsePower, numberOfDoors, engineType and releaseDate. Now, we need in the view to search the cars with 3 doors and more than 120hp. With the initial vision of the architecture I should write the functions needed in all layers that take this to arguments.

But if I need with 3 doors and more than 120hp or diesel engine? The answer was: build another function. Thats one in the delegate, on the facade interface, the facade impl and in the dao.

But our entities don't have 4 fields. More like 30. IMHO is going to be chaos and people dying when we start writing full apps, with hundreds of functions all over the place.

My solution
I've created a prototype inspired in queryDsl to create dynamic queries from the view that follows the layer pattern so you could write something like this in a manager bean from JSF. Just one class needs to be created in the ProjectClient layer.





The prototype generates a JPA query with parameters at the end but, this could be easeily adapted as only the DAO knows what query builder is using.

It has been a nice exercise of abstraction but, Is there any existing framework or library that allows to do this? Any pattern to look for? Have you faced similar problem on your jobs.

I can upload full code with GNU licesing if someone is interested.
Hi!

I want to share a little maven plugin I've developed to promute junit testing in the team. It scans the entire src/test/java (or other) folder of your project searching for the @author tag of javadoc, getting the author name and increasing the count for it. At the end it generates a html page with the results. The prize is up to the team (in our case it was a work free evening!)

The @author tag must be enclosed in a javadoc block like:



Or



It generates a simple html page with the results.

To use it follow this steps:

1. Add the plugin to your project's pom (the plugin is maven central repo).

2. Run mvn junitward:awards on your project.
3. The results are generated in the folder /target/junitaward/junitAward.html

Opcional parameters
Ther are three optional parameters:



testsFolder = Define the root folder for searching Junit. Default is src/test/java

testsSince = Displays results for test made since this date. The test must have @date in its javadoc. Default date pattern is dd-MM-yyyy. Without this parameter all test are given in the result.

datePatter = Allow to change date pattern. Default is dd-MM-yyyy. Only useful if testsSince is set.

The full code is at github: https://github.com/konum/JUnit-Awards/

Hope you like it!
6 years ago
Hi!

It's my first post here, although i been leeching knowledge from here for a while. So, thanks! As my first post i want to share a little app i've done. I work in a project that, from time to time, the change the XSD for the WS. These XSD need some changes before I can use xjc on them, and then the java generated classes need some changes to get them working right. Doing this by hand was tedious and long, so I've made this little app to do all the work for me. It's quite simple, and everything it's confiogurable via plain text files.

The app follows this steps.

0. Backus up the XSD to source/temp.
1. Delete previously generated files.
2. Apply rules in preprocessXSD.txt to the XSD in the origin path.
3. Execute command in exec.txt
4. Apply rules in processClasses.txt to generated code.
5. Copy files to destination path.
6. Restores backup.

I've tried to attach the manual and some rule files, but it's says txt files are not alowed. I've pasted the manual here: http://pastebin.com/0i6dbKTz

The main and onlye class:



7 years ago