Class EntityTypeUtil

java.lang.Object
org.apache.ofbiz.entity.util.EntityTypeUtil

public final class EntityTypeUtil extends 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 Details

    • isType

      public static boolean isType(Collection<GenericValue> thisCollection, String typeRelation, GenericValue targetType)
    • getDescendantTypes

      public static List<GenericValue> getDescendantTypes(GenericValue typeValue)
    • isType

      public static boolean isType(GenericValue thisType, GenericValue targetType)
    • hasParentType

      public static boolean hasParentType(Delegator delegator, String entityName, String primaryKey, String childType, String parentTypeField, 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.