Class DeletionReason

  • All Implemented Interfaces:
    Serializable

    public class DeletionReason
    extends Object
    implements Serializable
    Model representing a the reason for the deletion of one or more entities. The model is mainly used for transmission in order to generate the log entry correctly during deletion.
    Since:
    8.0.1
    Author:
    XIMA MEDIA GmbH
    See Also:
    Serialized Form
    • Constructor Detail

      • DeletionReason

        public DeletionReason​(Map<String,​String> reasonMap)
        Creates a new reason map with a user defined mapping.
        Parameters:
        reasonMap - Mapping between the deletion type (such as the entity name) and the reason for the deletion.
    • Method Detail

      • getReasonMap

        public Map<String,​String> getReasonMap()
        Returns:
        Mapping between the deletion type (such as the entity name) and the reason for the deletion. The returned map cannot be modified.
      • getReasonByEntity

        public String getReasonByEntity​(Class<? extends de.xima.cmn.dao.interfaces.IEntity<?>> entity,
                                        long id)
        Gets the reason for a specific entity.
        Parameters:
        entity - Type of the entity.
        id - ID of the entity.
        Returns:
        The reason for the given entity with a certain ID, or empty if no such reason exists.
      • getReasonByEntityType

        public String getReasonByEntityType​(Class<? extends de.xima.cmn.dao.interfaces.IEntity<?>> entity)
        Gets the reason for a specific type of entity.
        Parameters:
        entity - Type of the entity.
        Returns:
        The reason for the given entity type, or empty if no such reason exists.
      • forEntityType

        public static DeletionReason forEntityType​(String deletionReason,
                                                   Class<? extends de.xima.cmn.dao.interfaces.IEntity<?>> entity)
        This method creates a new DeletionReason object with the given reason text and the combination of entity name and the id of the entity.
        Parameters:
        deletionReason - reason text which is displayed in protocol
        entity - Type of the entity
        Returns:
        object with the given parameters
      • forEntity

        public static DeletionReason forEntity​(String deletionReason,
                                               de.xima.cmn.dao.interfaces.IEntity<?> entity)
        This method creates a new DeletionReason instance with the given reason text and the combination of entity name and the id of the entity.
        Parameters:
        deletionReason - reason text which is displayed in protocol
        entity - Entity that was deleted.
        Returns:
        object with the given parameters
      • forEntities

        public static DeletionReason forEntities​(String deletionReason,
                                                 String entityName,
                                                 List<Long> idList)
        This method creates a new DeletionReason object with the given reason text and the combination of entity name and the list of id of the deleted entities.
        Parameters:
        deletionReason - reason text which is displayed in protocol
        entityName - class name of the entity
        idList - list of IDs of the entities
        Returns:
        object with the given parameters