Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Ideally, we would have a parser at the server side (Java) which would replace the placeholders with context sensitive data and then serve spit out HTML reports to the Client.

Some of the advantages of having the parser at the server side would be

  • Better performance
  • We can carry out various optimizations like fetching values for only those placeholders which are present in the particular document etc

The Restful URL service for server side document generation would look similar to

/{entityName}/user.defined.report/{reportId}?entityId=10&parse=true

where

  • {entityName}

...

  • =

...

  • Name

...

  • of

...

  • the

...

  • entity

...

  • (Client,

...

  • Loan

...

  • etc)

...

  • {reportId}

...

  • =

...

  • The

...

  • Identifier

...

  • for

...

  • the

...

  • report

...

  • template

...

  • entityId

...

  • =

...

  • (Optional

...

  • Query

...

  • param)

...

  • Identifier

...

  • for

...

  • compound

...

  • Entities

...

  • (Ex:

...

  • The

...

  • Loan

...

  • Product

...

  • Id

...

  • for

...

  • a

...

  • Loan)
  • parse=

...

  • An Optional

...

  • Query

...

  • param, when present causes the server to replace placeholders with actual values. When not specified, the server would return the actual report Template (used for reading the actual template as a part of CRUD operations on "m_report_templates" table)

2.2 Client side Parser

Alternatively, we could also have services an additional service at the server side (in addition to CRUD services for "m_report_templates" table) that exposes the context sensitive data and a Client side parser that would take care of merging the report template with the actual values exposed by the RESTful service for (so the actual report is created at the client side)

The Restful service would have a URL similar to 

/{entityName}/report.params?entityId=10

and return all possible reporting parameters for the selected  "entityName"

3         Database changes

We could store the HTML templates directly in the database (as they would be quite small)

Table: “m_userreport_documents”templates”

Column Name

Data Type

Description

Id

Int

 

Entity_Type

Varchar(45)

An enumeration of allowed entities (Clients, Loans)

Entity_ID

int

Required only for “compound Entity’s”. Ex: ID of the Loan Product if the selected entity_type is a Loan

Document_name

Varchar(45)

The name of the document

Template

LongText

The HTML template for the document

...