javaarchitecturesystem-designtemplate-method-pattern

implementation of template method pattern in the real world scenario


I have requirement as below to build report building system.

  1. I should be able to create connection, where connection can be different database or same database.
  2. connection entity consist of connectionID,userName of the dabase, password

  3. I should be able to manage these connection such as create, delete and update connections.

Report builder should use this connection object to build a report and generate difference type of outputs such as xml,pdf,excel csv etc...

  1. Report builder should take input as connectionID and database query and output type such as xml,csv etc...
  2. report should saved/persisted in the db so that I can execute report multiple time. 3.System should support create, delete update report functionality.

when I execute a the report followings steps should repeated for each each report. Steps are

  1. get the connection object from the given report ID and connection ID.
  2. execute query.
  3. process result set.
  4. generate report.

I am planing to use template method pattern since building report steps are fixed and implementation may change.

Can any one explain how to build construction of these objects/ and where I need to fit dao layer or in other words, in what object dao should be composed into.

can anyone give skeleton of java class with brief description about method functionality and its composition. Since I am new to the design pattern, Unable to fit in the real world application.

technology stacks are: spring REST and spring DATA JPA and Hibernate ORM.


Solution

  • Why are you trying to build your own reporting framework from scratch? The fact that you are asking for this level of guidance on stackoverflow tells me that you need to find a ready-made solution, and customize it for your needs. See this question for some advice on which framework to select.