Class DynamicDaoHelperImpl

java.lang.Object
org.broadleafcommerce.common.util.dao.DynamicDaoHelperImpl
All Implemented Interfaces:
DynamicDaoHelper

public class DynamicDaoHelperImpl extends Object implements DynamicDaoHelper
  • Field Details

    • HIBERNATE_PROXY

      public static final String HIBERNATE_PROXY
      See Also:
    • LOCK_OBJECT

      public static final Object LOCK_OBJECT
    • POLYMORPHIC_ENTITY_CACHE

      public static final Map<Class<?>,Class<?>[]> POLYMORPHIC_ENTITY_CACHE
    • POLYMORPHIC_ENTITY_CACHE_WO_EXCLUSIONS

      public static final Map<Class<?>,Class<?>[]> POLYMORPHIC_ENTITY_CACHE_WO_EXCLUSIONS
    • JAVASSIST_PROXY_KEY_PHRASE

      public static final String JAVASSIST_PROXY_KEY_PHRASE
      See Also:
  • Constructor Details

    • DynamicDaoHelperImpl

      public DynamicDaoHelperImpl()
  • Method Details

    • getNonProxyImplementationClassIfNecessary

      public static Class<?> getNonProxyImplementationClassIfNecessary(Class<?> candidate)
    • getAllPolymorphicEntitiesFromCeiling

      public Class<?>[] getAllPolymorphicEntitiesFromCeiling(Class<?> ceilingClass, boolean includeUnqualifiedPolymorphicEntities, boolean useCache)
      Description copied from interface: DynamicDaoHelper
      Get all the polymorphic types known to Hibernate for the ceiling class provided. The ceiling class should be an entity class registered in Hibernate (or a specific interface unique to that entity class). The returned array is sorted with the most derived entities appearing first in the list.
      Specified by:
      getAllPolymorphicEntitiesFromCeiling in interface DynamicDaoHelper
      includeUnqualifiedPolymorphicEntities - Some entities may be excluded from polymorphism (Abstract class and those marked with AdminPresentationClass.excludeFromPolymorphism()). Override that exlusion behavior.
      useCache - Cache the polymorphic types discovered for the ceilingClass.
      Returns:
      The list of Hibernate registered entities that derive from the ceilingClass (including the ceilingClass)
    • getCachedPolymorphicEntityList

      protected Class<?>[] getCachedPolymorphicEntityList(Map<Class<?>,Class<?>[]> polymorphicEntityCache, Class<?> ceilingClass)
    • getUpDownInheritance

      public Class<?>[] getUpDownInheritance(Class<?> testClass, boolean includeUnqualifiedPolymorphicEntities, boolean useCache)
      Description copied from interface: DynamicDaoHelper
      Retrieve a complete polymorphic type list for an entity class, even if the entity class is not the ceiling class (or root of the hierarchy). This allows you to possibly provide a mid-level entity class and get back a list of entity classes both above and below the testClass. The type list passed back is ordered with the ceiling class appearing first and the most derived classes appearing last.
      Specified by:
      getUpDownInheritance in interface DynamicDaoHelper
      Parameters:
      testClass - An entity class to look for polymorphic types both above and below
      includeUnqualifiedPolymorphicEntities - Some entities may be excluded from polymorphism (Abstract class and those marked with AdminPresentationClass.excludeFromPolymorphism()). Override that exlusion behavior.
      useCache - Cache the polymorphic types discovered for the ceilingClass.
      Returns:
      The list of Hibernate registered entities that appear above and below the testClass in an entity inheritance hierarchy
    • sortEntities

      public Class<?>[] sortEntities(Class<?> ceilingClass, List<Class<?>> entities)
      Description copied from interface: DynamicDaoHelper
      Sort a list of polymorphic types with the most derived appearing first.
      Specified by:
      sortEntities in interface DynamicDaoHelper
      Returns:
    • isExcludeClassFromPolymorphism

      public boolean isExcludeClassFromPolymorphism(Class<?> clazz)
      Description copied from interface: DynamicDaoHelper
      Discover is a class should be excluded from a polymorphic list. Exclusion is generally enforced if the class is abstract or if the class is marked with AdminPresentationClass.excludeFromPolymorphism().
      Specified by:
      isExcludeClassFromPolymorphism in interface DynamicDaoHelper
      Returns:
    • getIdMetadata

      public Map<String,Object> getIdMetadata(Class<?> entityClass, jakarta.persistence.EntityManager entityManager)
      Description copied from interface: DynamicDaoHelper
      Retrieve information about the id property for the entity class and the data type of that property. This will return a Map containing two members. The first will be keyed with the String "name" and will be the name of the id property on the entity class. The second will be keyed with the String "type" and will be the Hibernate Type instance for the property (e.g. LongType).
      Specified by:
      getIdMetadata in interface DynamicDaoHelper
      Returns:
    • getPropertyNames

      public List<String> getPropertyNames(Class<?> entityClass)
      Description copied from interface: DynamicDaoHelper
      Retrieve the list of property names known to Hibernate for the entity class.
      Specified by:
      getPropertyNames in interface DynamicDaoHelper
      Returns:
    • getPropertyTypes

      public List<org.hibernate.type.Type> getPropertyTypes(Class<?> entityClass)
      Description copied from interface: DynamicDaoHelper
      Retrieve the list of property types (Type known to Hibernate for the entity class.
      Specified by:
      getPropertyTypes in interface DynamicDaoHelper
      Returns:
    • getIdentifier

      public Serializable getIdentifier(Object entity)
      Description copied from interface: DynamicDaoHelper
      The value of the Hibernate registered identifier property for the entity instance.
      Specified by:
      getIdentifier in interface DynamicDaoHelper
      Returns:
    • getIdField

      public Field getIdField(Class<?> clazz)
      Description copied from interface: DynamicDaoHelper
      The Field that represents the Hibernate registered identifier property for the entity class.
      Specified by:
      getIdField in interface DynamicDaoHelper
      Returns: