Entity modification tracking

Jspresso extension supports a simple and powerful implementation to manage tracking of data modification  :

  • Each time some entity is updated, a new tracking record is saved
  • The tracking record contains :
    • The user login of the logged in user
    • The date of the modification
    • All modified properties “before” and “after” values, except fields marked as “excluded”

How to manage it :

  • Create an Interface extending “IModificationTracker”
  • Declare a delegate class for “org.jspresso.contrib.model.tracking.service.IModificationTrackerService”
  • Make your entity extends your new interface

For example :

  • Create the delegate class and implements
    • Inherit from “IModificationTrackerServiceDelegate”
    • Setup local to use to format tracking data (dates, decimal, enumeration) : “getTrackingLocale”
    • Setup list of non-tracked properties : “getTrackingExcludedProperties”
    • Implements method to translate login to readable user name : “translateLogin”

For example :

  • Add the modification tracking view : “Tracking.view”

For example :

Here is how it will looks like :

  • Display all tracking events
    • Updated date
    • Updated by (as translated by “translateLogin” method)
    • Revision number
    • List of modified properties with “before” and “after” values
    • Available actions :
      • Filter per user login
      • Filter per modification date
      • Export as CSV file

  • Advanced features #1 : filter per user by adding a LOV action
    • Add a computed field referencing your “User” entity
    • Override the tracking filter view to use this field as filter

Advanced features #1 : put focus on modified properties UI

  • Add dynamic color when property is modified
  • Add dynamic tooltip to display properties modification history

  • Add computed fields for color and tooltip (for example “priceBackground” and “priceTooltip”)

  • Use this field as background (or foreground) and description :

The full source code above is available from github : https://github.com/jspresso/hrsample-ee

Requirements :

  • Jspresso-extension 2.12.2 or above


Leave a Reply