Class DataLogReactor<T extends BusinessEvent<?>>

java.lang.Object
overit.geocall.bl.BusinessTask<T>
overit.geocall.basic.bl.DataLogReactor<T>
Type Parameters:
T - The event used to retrieve the information.
All Implemented Interfaces:
Serializable, Tool
Direct Known Subclasses:
BTAssumeRoleChangeLog, BTCompanyCreateLog, BTCompanyUpdateLog, BTConfigChangeLog, BTDaemonDataLog, BTDeleteSecretLog, BTDeleteSecretValueLog, BTEditSecretLog, BTGenerateSecretLog, BTGenerateSecretValueLog, BTGISServiceDataLog, BTSystemSettingDataLog, BTUserTypeAuthPolicyUpdateLog, BTUserTypeCreateLog, BTUserTypeGrantsLog, BTUserTypeUpdateLog

public abstract class DataLogReactor<T extends BusinessEvent<?>> extends BusinessTask<T>
Abstract class that manages the insertion of data logs. This class simplify the insertion of data logs inside the db. It's only needed to implement the abstract methods in order to operate properly. Here is a code snippet that illustrate a typical use of this task:

 {@literal @}Geocall.Event(UserTypeUpdateEvent.class)
 public class BTUserTypeUpdateLog extends DataLogReactor<UserTypeUpdateEvent> {

     {@literal @}Override
     protected String getType() {
         return "User type";
     }

     {@literal @}Override
     protected String getData(UserTypeUpdateEvent event) {
         return event.getUserType().extract(true).toString();
     }

     {@literal @}Override
     protected Long getObjectId(UserTypeUpdateEvent event) {
         return event.getUserType().getId();
     }

     {@literal @}Override
     protected Long getFactory(UserTypeUpdateEvent event) {
         return event.getUserType().getFactory()!=null ? event.getUserType().getFactory() : Identity.current().getFactory();
     }
 }
See Also:
  • Constructor Details

    • DataLogReactor

      public DataLogReactor()
  • Method Details

    • body

      protected void body(T event, PoolKit pk) throws DAException, DAValidateException
      Description copied from class: BusinessTask
      Implements this method to write the specific task logic to handle the input parameter.
      Specified by:
      body in class BusinessTask<T extends BusinessEvent<?>>
      Parameters:
      event - the object upon which the task will works on
      pk - the poolkit containing the reference to the database connection that can be used
      Throws:
      DAException - in case of database error
      DAValidateException - in case of database validation error
    • getType

      protected abstract String getType(T event)
      Gets the type's name of the data log.
      Parameters:
      event - Event used to retrieve the information about the object to log.
      Returns:
      The type's name of the data log.
    • getData

      protected abstract String getData(T event)
      Gets the data to log.
      Parameters:
      event - Event used to retrieve the information about the object to log.
      Returns:
      String representing all the data to log inside the db.
    • getObjectId

      protected abstract Long getObjectId(T event)
      Gets the unique id associated to the object.
      Parameters:
      event - Event used to retrieve the information about the object to log.
      Returns:
      The unique id associated to the object.
    • getFactory

      protected abstract Long getFactory(T event)
      Gets the id of the factory. Possibly the one associated with the object to log.
      Parameters:
      event - Event used to retrieve the information about the object to log.
      Returns:
      The id associated to the factory.