Class DynamicDaoHelperImpl
java.lang.Object
org.broadleafcommerce.common.util.dao.DynamicDaoHelperImpl
- All Implemented Interfaces:
DynamicDaoHelper
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionClass<?>[]
getAllPolymorphicEntitiesFromCeiling
(Class<?> ceilingClass, boolean includeUnqualifiedPolymorphicEntities, boolean useCache) Get all the polymorphic types known to Hibernate for the ceiling class provided.protected Class<?>[]
getCachedPolymorphicEntityList
(Map<Class<?>, Class<?>[]> polymorphicEntityCache, Class<?> ceilingClass) getIdentifier
(Object entity) The value of the Hibernate registered identifier property for the entity instance.getIdField
(Class<?> clazz) The Field that represents the Hibernate registered identifier property for the entity class.getIdMetadata
(Class<?> entityClass, jakarta.persistence.EntityManager entityManager) Retrieve information about the id property for the entity class and the data type of that property.static Class<?>
getNonProxyImplementationClassIfNecessary
(Class<?> candidate) getPropertyNames
(Class<?> entityClass) Retrieve the list of property names known to Hibernate for the entity class.List<org.hibernate.type.Type>
getPropertyTypes
(Class<?> entityClass) Retrieve the list of property types (Type
known to Hibernate for the entity class.Class<?>[]
getUpDownInheritance
(Class<?> testClass, boolean includeUnqualifiedPolymorphicEntities, boolean useCache) 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).boolean
isExcludeClassFromPolymorphism
(Class<?> clazz) Discover is a class should be excluded from a polymorphic list.Class<?>[]
sortEntities
(Class<?> ceilingClass, List<Class<?>> entities) Sort a list of polymorphic types with the most derived appearing first.
-
Field Details
-
HIBERNATE_PROXY
- See Also:
-
LOCK_OBJECT
-
POLYMORPHIC_ENTITY_CACHE
-
POLYMORPHIC_ENTITY_CACHE_WO_EXCLUSIONS
-
JAVASSIST_PROXY_KEY_PHRASE
- See Also:
-
-
Constructor Details
-
DynamicDaoHelperImpl
public DynamicDaoHelperImpl()
-
-
Method Details
-
getNonProxyImplementationClassIfNecessary
-
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 interfaceDynamicDaoHelper
includeUnqualifiedPolymorphicEntities
- Some entities may be excluded from polymorphism (Abstract class and those marked withAdminPresentationClass.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
-
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 interfaceDynamicDaoHelper
- Parameters:
testClass
- An entity class to look for polymorphic types both above and belowincludeUnqualifiedPolymorphicEntities
- Some entities may be excluded from polymorphism (Abstract class and those marked withAdminPresentationClass.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
Description copied from interface:DynamicDaoHelper
Sort a list of polymorphic types with the most derived appearing first.- Specified by:
sortEntities
in interfaceDynamicDaoHelper
- Returns:
-
isExcludeClassFromPolymorphism
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 withAdminPresentationClass.excludeFromPolymorphism()
.- Specified by:
isExcludeClassFromPolymorphism
in interfaceDynamicDaoHelper
- 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 HibernateType
instance for the property (e.g.LongType
).- Specified by:
getIdMetadata
in interfaceDynamicDaoHelper
- Returns:
-
getPropertyNames
Description copied from interface:DynamicDaoHelper
Retrieve the list of property names known to Hibernate for the entity class.- Specified by:
getPropertyNames
in interfaceDynamicDaoHelper
- Returns:
-
getPropertyTypes
Description copied from interface:DynamicDaoHelper
Retrieve the list of property types (Type
known to Hibernate for the entity class.- Specified by:
getPropertyTypes
in interfaceDynamicDaoHelper
- Returns:
-
getIdentifier
Description copied from interface:DynamicDaoHelper
The value of the Hibernate registered identifier property for the entity instance.- Specified by:
getIdentifier
in interfaceDynamicDaoHelper
- Returns:
-
getIdField
Description copied from interface:DynamicDaoHelper
The Field that represents the Hibernate registered identifier property for the entity class.- Specified by:
getIdField
in interfaceDynamicDaoHelper
- Returns:
-