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

    • Constructor Detail

      • BaseEntityLogHandlerImpl

        public BaseEntityLogHandlerImpl()
    • Method Detail

      • canViewPropertiesLog

        public final 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.
        Specified by:
        canViewPropertiesLog in interface EntityLogHandler<E extends BaseEntity,​DTO extends EntityDTO>
      • 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.
      • resolveOwnerEntityLogHandler

        protected <BE extends BaseEntity,​EDTO extends EntityDTO> EntityLogHandler<BE,​EDTO> resolveOwnerEntityLogHandler​(EntityLog entityLog)
        Resolves the entity log handler for the owner entity of the given entity log. Entities like Phone can have different owner entity classes (Operator or User in Phone case)