Class AttributeClassHelper

java.lang.Object
pl.edu.icm.unity.engine.api.attributes.AttributeClassHelper

public class AttributeClassHelper extends Object
Helper for handling AttributesClasses of an entity. A single virtual 'class' is created from the classes provided as arguments. With it checking of attributes is fast.

Additionally static utility methods are provided allowing to clean up the duplicated entries in ACs.

Author:
K. Benedyczak
  • Field Details

    • MAX_CLASSES_PER_ENTITY

      public static final int MAX_CLASSES_PER_ENTITY
      See Also:
  • Constructor Details

  • Method Details

    • cleanupClass

      public static void cleanupClass(AttributesClass toCleanup, Map<String,AttributesClass> knownClasses) throws IllegalTypeException
      All parents which are also parents of other existing parents are removed. All allowed/mandatory attributes which are allowed/required by parent classes are removed.
      Parameters:
      knownClasses -
      toCleanup -
      Throws:
      IllegalTypeException
    • isRestricting

      public boolean isRestricting(AttributeClassHelper original)
      Parameters:
      original -
      Returns:
      true only if the this effective class is more restrictive then the given argument, i.e. it has more mandatory attributes or less allowed.
    • checkAttribtues

      public void checkAttribtues(Collection<String> attributes, Map<String,AttributeType> allTypes) throws SchemaConsistencyException
      Verifies if the given attribute set is consistent with the effective AC
      Parameters:
      attributes -
      allTypes - if not null, then it is used skip checking of attribute allowance in case of system attributes (i.e. those with instances immutable flag).
      Throws:
      SchemaConsistencyException
    • isAllowed

      public boolean isAllowed(String attribute)
    • isMandatory

      public boolean isMandatory(String attribute)
    • getEffectiveAllowed

      public Set<String> getEffectiveAllowed()
    • getEffectiveMandatory

      public Set<String> getEffectiveMandatory()
    • isEffectiveAllowArbitrary

      public boolean isEffectiveAllowArbitrary()