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 conditionboolean
Recursively evaluate theDisableConditions
of the given model item, against the given values.<T> boolean
evaluateDisableConditions
(ModelItem definition, String dataPath, Optional<String> oldDataPath, Map<String, Object> values, T object, Map<String, Object> contextualParameters) Recursively evaluate theDisableConditions
of the given model item, against the given values.<T> boolean
evaluateDisableConditions
(ModelItem definition, String dataPath, T object) Recursively evaluate theDisableConditions
of the given model item, against the values stored in the given objectprotected <T> boolean
evaluateDisableConditions
(ModelItem definition, DisableConditions disableConditions, String dataPath, Optional<String> oldDataPath, Map<String, Object> values, Optional<T> object, Map<String, Object> contextualParameters) Recursively evaluate the givenDisableConditions
against 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:DisableConditionsEvaluator
Recursively evaluate theDisableConditions
of the given model item, against the given values.- Specified by:
evaluateDisableConditions
in 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:
true
if the disable conditions aretrue
,false
otherwise- 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:DisableConditionsEvaluator
Recursively evaluate theDisableConditions
of the given model item, against the values stored in the given object- Specified by:
evaluateDisableConditions
in 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:
true
if the disable conditions aretrue
,false
otherwise- 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:DisableConditionsEvaluator
Recursively evaluate theDisableConditions
of 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:
evaluateDisableConditions
in 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:
true
if the disable conditions aretrue
,false
otherwise- 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 disableConditions, String dataPath, Optional<String> oldDataPath, Map<String, Object> values, Optional<T> object, Map<String, throws UndefinedItemPathException, BadItemTypeExceptionObject> contextualParameters) Recursively evaluate the givenDisableConditions
against 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:
true
if the disable conditions aretrue
,false
otherwise- 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:
true
if the result of evaluation is sufficient,false
otherwise
-