Class AttributeClassHelper
java.lang.Object
pl.edu.icm.unity.engine.api.attributes.AttributeClassHelper
Helper for handling
AttributesClass
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
-
Constructor Summary
ConstructorDescriptionAttributeClassHelper
(Map<String, pl.edu.icm.unity.base.attribute.AttributesClass> knownClasses, Collection<String> assignedClasses) -
Method Summary
Modifier and TypeMethodDescriptionvoid
checkAttribtues
(Collection<String> attributes, Map<String, pl.edu.icm.unity.base.attribute.AttributeType> allTypes) Verifies if the given attribute set is consistent with the effective ACstatic void
cleanupClass
(pl.edu.icm.unity.base.attribute.AttributesClass toCleanup, Map<String, pl.edu.icm.unity.base.attribute.AttributesClass> knownClasses) All parents which are also parents of other existing parents are removed.boolean
boolean
boolean
isMandatory
(String attribute) boolean
isRestricting
(AttributeClassHelper original)
-
Field Details
-
MAX_CLASSES_PER_ENTITY
public static final int MAX_CLASSES_PER_ENTITY- See Also:
-
-
Constructor Details
-
AttributeClassHelper
public AttributeClassHelper() -
AttributeClassHelper
public AttributeClassHelper(Map<String, pl.edu.icm.unity.base.attribute.AttributesClass> knownClasses, Collection<String> assignedClasses)
-
-
Method Details
-
cleanupClass
public static void cleanupClass(pl.edu.icm.unity.base.attribute.AttributesClass toCleanup, Map<String, pl.edu.icm.unity.base.attribute.AttributesClass> knownClasses) throws IllegalTypeExceptionAll 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
- 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, pl.edu.icm.unity.base.attribute.AttributeType> allTypes) throws SchemaConsistencyExceptionVerifies 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
-
isMandatory
-
getEffectiveAllowed
-
getEffectiveMandatory
-
isEffectiveAllowArbitrary
public boolean isEffectiveAllowArbitrary()
-