Class BaseEntityLogHandlerImpl<E extends BaseEntity,​DTO extends EntityDTO>

    • Constructor Detail

      • BaseEntityLogHandlerImpl

        public BaseEntityLogHandlerImpl()
    • Method Detail

      • createEntityPropertyLog

        protected EntityPropertyLog createEntityPropertyLog​(String name,
                                                            String propertyName,
                                                            String oldValue,
                                                            String newValue)
        Creates a new property log WITHOUT setting the order.
        Clients of this code must set the correct order before adding it to the generated logs list.
      • customLogForCreation

        protected boolean customLogForCreation()
        By default the built-in log generation for the create event is applied. Subclasses can overwrite this method if they need to do some custom logic in the doOnBeforeLog method
        Returns:
      • doApplyLogFilters

        protected Set<EntityLogType> doApplyLogFilters​(DBQuery<?> query,
                                                       long entityId)
        Subclasses can implement this method to add specific filters to the query when searching for logs of an entity. Also, if other log types must be included in the query result then they must be returned.
        Parameters:
        query - the query to add the filters
        entityId - the id of the entity for which we're searching its logs
        Returns:
        the list of other types that must be included in the result (e.g for users we include the addresses and phones logs). Null/empty means no other types are included.
      • getEntityToViewLog

        protected abstract E getEntityToViewLog​(long entityId)
        Returns the entity with the given id ONLY if the logged user can view its logs. Otherwise it MUST return null.
      • getRelatedUser

        protected BasicUser getRelatedUser​(E entity)
        Subclasses can implement this method to return the related user of the entity Returns the associated user to the given entity.