Class EntityTypeUtil


  • public final class EntityTypeUtil
    extends java.lang.Object
    Makes it easier to deal with entities that follow the extensibility pattern and that can be of various types as identified in the database.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.List<GenericValue> getDescendantTypes​(GenericValue typeValue)  
      static boolean hasParentType​(Delegator delegator, java.lang.String entityName, java.lang.String primaryKey, java.lang.String childType, java.lang.String parentTypeField, java.lang.String parentType)
      A generic method to be used on Type enities, e.g.
      static boolean isType​(java.util.Collection<GenericValue> thisCollection, java.lang.String typeRelation, GenericValue targetType)  
      static boolean isType​(GenericValue thisType, GenericValue targetType)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • isType

        public static boolean isType​(java.util.Collection<GenericValue> thisCollection,
                                     java.lang.String typeRelation,
                                     GenericValue targetType)
      • hasParentType

        public static boolean hasParentType​(Delegator delegator,
                                            java.lang.String entityName,
                                            java.lang.String primaryKey,
                                            java.lang.String childType,
                                            java.lang.String parentTypeField,
                                            java.lang.String parentType)
        A generic method to be used on Type enities, e.g. ProductType. Recurse to the root level in the type hierarchy and checks if the specified type childType has parentType as its parent somewhere in the hierarchy.
        Parameters:
        delegator - The Delegator object.
        entityName - Name of the Type entity on which check is performed.
        primaryKey - Primary Key field of the Type entity.
        childType - Type value for which the check is performed.
        parentTypeField - Field in Type entity which stores the parent type.
        parentType - Value of the parent type against which check is performed.
        Returns:
        boolean value based on the check results.