Class HasReferenceException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
de.xima.cmn.dao.exceptions.AbstractDaoRuntimeException
de.xima.cmn.dao.exceptions.DatabaseAccessException
de.xima.fc.exceptions.HasReferenceException
All Implemented Interfaces:
de.xima.cmn.dao.exceptions.interfaces.IDaoException, Serializable

public class HasReferenceException extends de.xima.cmn.dao.exceptions.DatabaseAccessException
An exception that indicates that a certain operation cannot be performed on an entity, due to that entity still being reference by other entities.

The operation is usually a delete operation. For example, a file cannot be deleted in case that file is still used by a workflow action.

Author:
XIMA MEDIA GmbH
See Also:
  • Constructor Details

    • HasReferenceException

      public HasReferenceException(de.xima.cmn.dao.interfaces.IEntity<Long> entity)
      Creates a new reference exception for when some entities still reference a certain entity.
      Parameters:
      entity - The entity that is still referenced by other entities.
    • HasReferenceException

      public HasReferenceException(de.xima.cmn.dao.interfaces.IEntity<Long> entity, Throwable cause)
      Creates a new reference exception for when some entities still reference a certain entity.
      Parameters:
      entity - The entity that is still referenced by other entities.
      cause - An exception that is the cause of this exception.
    • HasReferenceException

      public HasReferenceException(de.xima.cmn.dao.interfaces.IEntity<Long> entity, String message)
      Creates a new reference exception for when some entities still reference a certain entity.
      Parameters:
      entity - The entity that is still referenced by other entities.
      message - A localized error message.
    • HasReferenceException

      public HasReferenceException(de.xima.cmn.dao.interfaces.IEntity<Long> entity, Collection<? extends de.xima.cmn.dao.interfaces.IEntity<Long>> entities)
      Creates a new reference exception for when some entities still reference a certain entity.
      Parameters:
      entity - The entity that is still referenced by other entities.
      entities - A list of entities that still reference the given entity.
    • HasReferenceException

      public HasReferenceException(de.xima.cmn.dao.interfaces.IEntity<Long> entity, de.xima.cmn.dao.interfaces.IEntity<Long>... entities)
      Creates a new reference exception for when some entities still reference a certain entity.
      Parameters:
      entity - The entity that is still referenced by other entities.
      entities - A list of entities that still reference the given entity.
    • HasReferenceException

      public HasReferenceException(de.xima.cmn.dao.interfaces.IEntity<Long> entity, String message, Throwable cause)
      Creates a new reference exception for when some entities still reference a certain entity.
      Parameters:
      entity - The entity that is still referenced by other entities.
      message - A localized error message.
      cause - An exception that is the cause of this exception.
    • HasReferenceException

      public HasReferenceException(de.xima.cmn.dao.interfaces.IEntity<Long> entity, Throwable cause, String messageKey)
      Creates a new reference exception for when some entities still reference a certain entity.
      Parameters:
      entity - The entity that is still referenced by other entities.
      cause - An exception that is the cause of this exception.
      messageKey - I18N key for constructing a localized error message
    • HasReferenceException

      public HasReferenceException(de.xima.cmn.dao.interfaces.IEntity<Long> entity, Throwable cause, de.xima.cmn.dao.interfaces.IEntity<Long>... entities)
      Creates a new reference exception for when some entities still reference a certain entity.
      Parameters:
      entity - The entity that is still referenced by other entities.
      cause - An exception that is the cause of this exception.
      entities - A list of entities that still reference the given entity.
    • HasReferenceException

      public HasReferenceException(de.xima.cmn.dao.interfaces.IEntity<Long> entity, Throwable cause, Collection<? extends de.xima.cmn.dao.interfaces.IEntity<Long>> entities)
      Creates a new reference exception for when some entities still reference a certain entity.
      Parameters:
      entity - The entity that is still referenced by other entities.
      cause - An exception that is the cause of this exception.
      entities - A list of entities that still reference the given entity.
    • HasReferenceException

      public HasReferenceException(de.xima.cmn.dao.interfaces.IEntity<Long> entity, String messageKey, Serializable... params)
      Creates a new reference exception for when some entities still reference a certain entity.
      Parameters:
      entity - The entity that is still referenced by other entities.
      messageKey - I18N key for constructing a localized error message
      params - Parameters for constructing a localized error message.
    • HasReferenceException

      public HasReferenceException(de.xima.cmn.dao.interfaces.IEntity<Long> entity, Throwable cause, String message, de.xima.cmn.dao.interfaces.IEntity<Long>... entities)
      Creates a new reference exception for when some entities still reference a certain entity.
      Parameters:
      entity - The entity that is still referenced by other entities.
      cause - An exception that is the cause of this exception.
      message - A localized error message.
      entities - A list of entities that still reference the given entity.
    • HasReferenceException

      public HasReferenceException(de.xima.cmn.dao.interfaces.IEntity<Long> entity, Throwable cause, String message, Collection<? extends de.xima.cmn.dao.interfaces.IEntity<Long>> entities)
      Creates a new reference exception for when some entities still reference a certain entity.
      Parameters:
      entity - The entity that is still referenced by other entities.
      cause - An exception that is the cause of this exception.
      message - A localized error message.
      entities - A list of entities that still reference the given entity.
    • HasReferenceException

      public HasReferenceException(de.xima.cmn.dao.interfaces.IEntity<Long> entity, Throwable cause, String messageKey, Serializable... params)
      Creates a new reference exception for when some entities still reference a certain entity.
      Parameters:
      entity - The entity that is still referenced by other entities.
      cause - An exception that is the cause of this exception.
      messageKey - I18N key for constructing a localized error message
      params - Parameters for constructing a localized error message.
  • Method Details

    • getRefEntities

      public Map<Class<? extends de.xima.cmn.dao.interfaces.IEntity<Long>>,Set<de.xima.cmn.dao.interfaces.IEntity<Long>>> getRefEntities()
      Returns:
      The entities that still reference the getEntity().
    • getEntity

      public de.xima.cmn.dao.interfaces.IEntity<Long> getEntity()
      Returns:
      The entity which is still referenced by other entities.
    • getDefaultMessageKey

      public String getDefaultMessageKey()
    • getDefaultErrorCode

      public String getDefaultErrorCode()
    • getLocalizedMessage

      public String getLocalizedMessage(Locale locale)
      Specified by:
      getLocalizedMessage in interface de.xima.cmn.dao.exceptions.interfaces.IDaoException
      Overrides:
      getLocalizedMessage in class de.xima.cmn.dao.exceptions.AbstractDaoRuntimeException
    • addEntites

      public void addEntites(de.xima.cmn.dao.interfaces.IEntity<Long>... entities)
      Adds the given entities to the list of referenced entities.
      Parameters:
      entities - Entities to add.
    • addEntites

      public void addEntites(Collection<? extends de.xima.cmn.dao.interfaces.IEntity<Long>> entities)
      Adds the given entities to the list of referenced entities.
      Parameters:
      entities - Entities to add.