Class DefaultDisableConditionsEvaluator
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.runtime.model.disableconditions.DefaultDisableConditionsEvaluator
- All Implemented Interfaces:
DisableConditionsEvaluator,LogEnabled,Component
public class DefaultDisableConditionsEvaluator
extends AbstractLogEnabled
implements Component, DisableConditionsEvaluator
Abstract evaluator for
DisableConditions-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean_resultIsSufficient(boolean andOperator, boolean result) Check if the given result is sufficient to evaluate the current disable conditionbooleanRecursively evaluate theDisableConditionsof the given model item, against the given values.<T> booleanevaluateDisableConditions(ModelItem definition, String dataPath, Optional<String> oldDataPath, Map<String, Object> values, T object, Map<String, Object> contextualParameters) Recursively evaluate theDisableConditionsof the given model item, against the given values.<T> booleanevaluateDisableConditions(ModelItem definition, String dataPath, T object) Recursively evaluate theDisableConditionsof the given model item, against the values stored in the given objectprotected <T> booleanevaluateDisableConditions(ModelItem definition, DisableConditions<? extends DisableCondition> disableConditions, String dataPath, Optional<String> oldDataPath, Map<String, Object> values, Optional<T> object, Map<String, Object> contextualParameters) Recursively evaluate the givenDisableConditionsagainst the given valuesMethods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
The Avalon role
-
-
Constructor Details
-
DefaultDisableConditionsEvaluator
public DefaultDisableConditionsEvaluator()
-
-
Method Details
-
evaluateDisableConditions
public boolean evaluateDisableConditions(ModelItem definition, String dataPath, Map<String, Object> values) throws UndefinedItemPathException, BadItemTypeExceptionDescription copied from interface:DisableConditionsEvaluatorRecursively evaluate theDisableConditionsof the given model item, against the given values.- Specified by:
evaluateDisableConditionsin interfaceDisableConditionsEvaluator- Parameters:
definition- the definition of the evaluated datadataPath- the path of the evaluated data. Needed to get the value to compare as condition ids are relative to this onevalues- values to check conditions on- Returns:
trueif the disable conditions aretrue,falseotherwise- Throws:
UndefinedItemPathException- If no item is found corresponding to one of the conditionsBadItemTypeException- If the item referenced by one of the conditions is not an element
-
evaluateDisableConditions
public <T> boolean evaluateDisableConditions(ModelItem definition, String dataPath, T object) throws UndefinedItemPathException, BadItemTypeException Description copied from interface:DisableConditionsEvaluatorRecursively evaluate theDisableConditionsof the given model item, against the values stored in the given object- Specified by:
evaluateDisableConditionsin interfaceDisableConditionsEvaluator- Type Parameters:
T- Type of object holding the data to evaluate- Parameters:
definition- the definition of the evaluated datadataPath- the path of the evaluated data. Needed to get the value to compare as condition ids are relative to this oneobject- the object holding the data to evaluate and the condition value- Returns:
trueif the disable conditions aretrue,falseotherwise- Throws:
UndefinedItemPathException- If no item is found corresponding to one of the conditionsBadItemTypeException- If the item referenced by one of the conditions is not an element
-
evaluateDisableConditions
public <T> boolean evaluateDisableConditions(ModelItem definition, String dataPath, Optional<String> oldDataPath, Map<String, Object> values, T object, Map<String, throws UndefinedItemPathException, BadItemTypeExceptionObject> contextualParameters) Description copied from interface:DisableConditionsEvaluatorRecursively evaluate theDisableConditionsof the given model item, against the given values. If the value of the condition is not present in the givenMap, search in the stored values in the given object- Specified by:
evaluateDisableConditionsin interfaceDisableConditionsEvaluator- Type Parameters:
T- Type of object holding the data to evaluate- Parameters:
definition- the definition of the evaluated datadataPath- the path of the evaluated data. Needed to get the value to compare as condition ids are relative to this oneoldDataPath- the old path of the evaluated data. Needed to get stored value if the data has been movedvalues- values to check conditions onobject- the object holding the data to evaluate and the condition valuecontextualParameters- the contextual parameters- Returns:
trueif the disable conditions aretrue,falseotherwise- Throws:
UndefinedItemPathException- If no item is found corresponding to one of the conditionsBadItemTypeException- If the item referenced by one of the conditions is not an element
-
evaluateDisableConditions
protected <T> boolean evaluateDisableConditions(ModelItem definition, DisableConditions<? extends DisableCondition> disableConditions, String dataPath, Optional<String> oldDataPath, Map<String, Object> values, Optional<T> object, Map<String, throws UndefinedItemPathException, BadItemTypeExceptionObject> contextualParameters) Recursively evaluate the givenDisableConditionsagainst the given values- Type Parameters:
T- Type of object holding the data to evaluate- Parameters:
definition- the definition of the evaluated datadisableConditions- the conditions to evaluatedataPath- the path of the evaluated data. Needed to get the value to compare as condition ids are relative to this oneoldDataPath- the old path of the evaluated data. Needed to get stored value if the data has been movedvalues- values to check conditions onobject- the object holding the data to evaluate and the condition valuecontextualParameters- the contextual parameters- Returns:
trueif the disable conditions aretrue,falseotherwise- Throws:
UndefinedItemPathException- If no item is found corresponding to one of the given conditionsBadItemTypeException- If the item referenced by one of the conditions is not an element
-
_resultIsSufficient
Check if the given result is sufficient to evaluate the current disable condition- Parameters:
andOperator- the conditions operatorresult- the result of the current condition- Returns:
trueif the result of evaluation is sufficient,falseotherwise
-