Interface EntityLogHandler<E extends BaseEntity,​DTO extends EntityDTO>

    • Method Detail

      • applyLogFilters

        void applyLogFilters​(DBQuery<?> query,
                             EntityPropertyLogQuery params)
        Apply filters to the given query to ensure only the entity log the logged user can view are returned
      • areEquals

        boolean areEquals​(E oldEntity,
                          E newEntity,
                          PropertyAccess access,
                          Object oldValue,
                          Object newValue)
        Returns true if the old and new values extracted from its corresponding entities must be considered equals.
      • canViewEntityLog

        boolean canViewEntityLog​(long entityId)
        Returns whether the logged user can view the log of the given entity.
      • canViewPropertiesLog

        boolean canViewPropertiesLog​(EntityLog entityLog)
        Returns true if the logged user can view the properties log of the given EntityLog. If the given entityLog's entity was removed, it checks if there is an owner entity and if it is visible.
      • getEntityClass

        Class<E> getEntityClass()
        The entity class related to this handler
      • getEntityLogName

        String getEntityLogName​(E oldEntity,
                                E newEntity,
                                EntityLogEvent event)
        Return the name of the entity log being generated.
      • getType

        EntityLogType getType()
        The log type this handler manages.
      • isLogEnabled

        boolean isLogEnabled​(E entity)
        Returns true if the log is enabled for this specific entity instance.
      • isPrivateEntity

        boolean isPrivateEntity​(E entity)
        Return true if the given entity was marked as private
      • onBeforeLog

        List<EntityPropertyLog> onBeforeLog​(E oldEntity,
                                            E newEntity,
                                            List<EntityPropertyLog> propertyLogs,
                                            EntityLogEvent event)
        Allows perform custom logic before logging (i.e saving) the given property logs. The returned list will be final logs to be saved (subclasses can add / remove logs). In case of EntityLogEvent.CREATE event the result list will contain only one element, this is for that case we only log one line just to indicate when and who created the entity.
      • resolveLogDescriptor

        EntityLogDescriptor<? extends DTO> resolveLogDescriptor​(E entity)
        Return the descriptor with the mappings for each DTO property.