Package de.xima.fc.mdl
Class DeletionReason
java.lang.Object
de.xima.fc.mdl.DeletionReason
- All Implemented Interfaces:
Serializable
Model representing a 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:
-
Constructor Summary
ConstructorsConstructorDescriptionDeletionReason
(Map<String, String> reasonMap) Creates a new reason map with a user defined mapping. -
Method Summary
Modifier and TypeMethodDescriptionstatic DeletionReason
forEntities
(String deletionReason, String entityName, List<Long> idList) This method creates a newDeletionReason
object with the given reason text and the combination of entity name and the list of id of the deleted entities.static DeletionReason
This method creates a newDeletionReason
instance with the given reason text and the combination of entity name and the id of the entity.static DeletionReason
forEntityType
(String deletionReason, Class<? extends de.xima.cmn.dao.interfaces.IEntity<?>> entity) This method creates a newDeletionReason
object with the given reason text and the combination of entity name and the id of the entity.getReasonByEntity
(Class<? extends de.xima.cmn.dao.interfaces.IEntity<?>> entity, long id) Gets the reason for a specific entity.getReasonByEntityType
(Class<? extends de.xima.cmn.dao.interfaces.IEntity<?>> entity) Gets the reason for a specific type of entity.
-
Constructor Details
-
DeletionReason
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 Details
-
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
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 newDeletionReason
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 protocolentity
- 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 newDeletionReason
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 protocolentity
- 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 newDeletionReason
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 protocolentityName
- class name of the entityidList
- list of IDs of the entities- Returns:
- object with the given parameters
-