Class AttributeClassHelper
- java.lang.Object
-
- pl.edu.icm.unity.engine.api.attributes.AttributeClassHelper
-
public class AttributeClassHelper extends java.lang.Object
Helper for handlingAttributesClass
es 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 Summary
Fields Modifier and Type Field Description static int
MAX_CLASSES_PER_ENTITY
-
Constructor Summary
Constructors Constructor Description AttributeClassHelper()
AttributeClassHelper(java.util.Map<java.lang.String,pl.edu.icm.unity.types.basic.AttributesClass> knownClasses, java.util.Collection<java.lang.String> assignedClasses)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkAttribtues(java.util.Collection<java.lang.String> attributes, java.util.Map<java.lang.String,pl.edu.icm.unity.types.basic.AttributeType> allTypes)
Verifies if the given attribute set is consistent with the effective ACstatic void
cleanupClass(pl.edu.icm.unity.types.basic.AttributesClass toCleanup, java.util.Map<java.lang.String,pl.edu.icm.unity.types.basic.AttributesClass> knownClasses)
All parents which are also parents of other existing parents are removed.java.util.Set<java.lang.String>
getEffectiveAllowed()
java.util.Set<java.lang.String>
getEffectiveMandatory()
boolean
isAllowed(java.lang.String attribute)
boolean
isEffectiveAllowArbitrary()
boolean
isMandatory(java.lang.String attribute)
boolean
isRestricting(AttributeClassHelper original)
-
-
-
Field Detail
-
MAX_CLASSES_PER_ENTITY
public static final int MAX_CLASSES_PER_ENTITY
- See Also:
- Constant Field Values
-
-
Method Detail
-
cleanupClass
public static void cleanupClass(pl.edu.icm.unity.types.basic.AttributesClass toCleanup, java.util.Map<java.lang.String,pl.edu.icm.unity.types.basic.AttributesClass> knownClasses) throws pl.edu.icm.unity.exceptions.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:
pl.edu.icm.unity.exceptions.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(java.util.Collection<java.lang.String> attributes, java.util.Map<java.lang.String,pl.edu.icm.unity.types.basic.AttributeType> allTypes) throws pl.edu.icm.unity.exceptions.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:
pl.edu.icm.unity.exceptions.SchemaConsistencyException
-
isAllowed
public boolean isAllowed(java.lang.String attribute)
-
isMandatory
public boolean isMandatory(java.lang.String attribute)
-
getEffectiveAllowed
public java.util.Set<java.lang.String> getEffectiveAllowed()
-
getEffectiveMandatory
public java.util.Set<java.lang.String> getEffectiveMandatory()
-
isEffectiveAllowArbitrary
public boolean isEffectiveAllowArbitrary()
-
-