Package org.ametys.cms.data.holder
Class DataHolderDisableConditionsEvaluator<T extends ModelAwareDataHolder>
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.runtime.model.disableconditions.AbstractDisableConditionsEvaluator<T>
org.ametys.cms.data.holder.DataHolderDisableConditionsEvaluator<T>
- Type Parameters:
T- Type of data holder holding the data to evaluate
- All Implemented Interfaces:
DisableConditionsEvaluator<T>,LogEnabled,Component,Serviceable
public class DataHolderDisableConditionsEvaluator<T extends ModelAwareDataHolder>
extends AbstractDisableConditionsEvaluator<T>
implements Serviceable
Evaluator for
DisableConditions on model aware DataHolder-
Nested Class Summary
Nested classes/interfaces inherited from class org.ametys.runtime.model.disableconditions.AbstractDisableConditionsEvaluator
AbstractDisableConditionsEvaluator.DefinitionAndValue -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final StringThe contextual parameter key for ametys objectprotected static final StringThe contextual parameter key for old condition pathprotected SystemPropertyExtensionPointThe system property extension pointstatic final StringThe Avalon rolestatic final StringThe contextual parameter key for synchronization context -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean_containsElementValue(ModelItem definition, String dataName, Map<String, Object> values, Map<String, Object> contextualParameters) Check if the valuesMapcontains a value for the conditionprotected boolean_doesCompositeContainValue(CompositeDefinition compositeDefinition, String compositeName, String subConditionDataPath, Map<String, Object> values, Map<String, Object> contextualParameters) Check if the valuesMapcontains a value for the conditionprotected boolean_doesRepeaterContainValue(RepeaterDefinition repeaterDefinition, String repeaterNameAndPositionSegment, String subConditionDataPath, Map<String, Object> values, Map<String, Object> contextualParameters) Check if the valuesMapcontains a value for the condition_getConditionDefinitionAndValue(ModelItem definition, DisableCondition condition, String dataPath, Optional<String> oldDataPath, Map<String, Object> values, Optional<T> ametsyObject, Map<String, Object> contextualParameters) Retrieve the value corresponding to the identifier of the condition, and its typeprotected Object_getElementValueFromMap(ModelItem definition, String dataName, Map<String, Object> values, Map<String, Object> contextualParameters) Retrieves the condition value from the valuesMapprotected Object_getValueFromComposite(CompositeDefinition compositeDefinition, String compositeName, String subConditionDataPath, Map<String, Object> values, Map<String, Object> contextualParameters) Retrieves the condition value in the given composite, from the valuesMapprotected Object_getValueFromContentValue(ContentElementDefinition contentElementDefinition, String dataName, String subConditionDataPath, Map<String, Object> values, Map<String, Object> contextualParameters) Retrieves the condition value in the given content value, from the valuesMapprotected Object_getValueFromRepeater(RepeaterDefinition repeaterDefinition, String repeaterNameAndPositionSegment, String subConditionDataPath, Map<String, Object> values, Map<String, Object> contextualParameters) Retrieves the condition value in the given repeater, from the valuesMapprotected Object_getValueFromSynchronizableValue(ModelItem definition, Object value, SynchronizationContext synchronizationContext, Map<String, Object> contextualParameters) Returns the value of the synchronized value corresponding of the given valueprotected booleancontainsValue(ModelItemAccessor modelItemAccessor, String conditionDataPath, Map<String, Object> values, Map<String, Object> contextualParameters) Check if the valuesMapcontains a value for the conditionprotected ModelItemgetModelItem(ModelItemAccessor modelItemAccessor, String conditionDataPath, Map<String, Object> contextualParameters) Retrieves the model itemprotected ObjectgetStoredValue(String conditionDataPath, Optional<String> oldConditionDataPath, T ametysObject, Map<String, Object> contextualParameters) Retrieves the condition value from data stored in the given objectprotected ObjectgetValueFromMap(ModelItemAccessor modelItemAccessor, String conditionDataPath, Map<String, Object> values, Map<String, Object> contextualParameters) Retrieves the condition value from the valuesMapvoidservice(ServiceManager manager) Methods inherited from class org.ametys.runtime.model.disableconditions.AbstractDisableConditionsEvaluator
_emptyStringToNull, _resultIsSufficient, evaluateDisableCondition, evaluateDisableConditions, evaluateDisableConditions, evaluateDisableConditions, evaluateDisableConditions, evaluateDisableConditionValueMethods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
The Avalon role -
SYNCHRONIZATION_CONTEXT_PARAMETER_KEY
The contextual parameter key for synchronization context- See Also:
-
__AMETYS_OBJECT_PARAMETER_KEY
The contextual parameter key for ametys object- See Also:
-
__OLD_CONDITION_PATH_PARAMETER_KEY
The contextual parameter key for old condition path- See Also:
-
_systemPropertyExtensionPoint
The system property extension point
-
-
Constructor Details
-
DataHolderDisableConditionsEvaluator
public DataHolderDisableConditionsEvaluator()
-
-
Method Details
-
service
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
getModelItem
protected ModelItem getModelItem(ModelItemAccessor modelItemAccessor, String conditionDataPath, Map<String, Object> contextualParameters) throws UndefinedItemPathExceptionDescription copied from class:AbstractDisableConditionsEvaluatorRetrieves the model item- Overrides:
getModelItemin classAbstractDisableConditionsEvaluator<T extends ModelAwareDataHolder>- Parameters:
modelItemAccessor- the relative accessor to the given data pathconditionDataPath- the data path of the model item to retrievecontextualParameters- the contextual parameters- Returns:
- the model item
- Throws:
UndefinedItemPathException- If no item is found for the given path
-
_getConditionDefinitionAndValue
protected AbstractDisableConditionsEvaluator.DefinitionAndValue _getConditionDefinitionAndValue(ModelItem definition, DisableCondition condition, String dataPath, Optional<String> oldDataPath, Map<String, Object> values, Optional<T> ametsyObject, Map<String, Object> contextualParameters) Description copied from class:AbstractDisableConditionsEvaluatorRetrieve the value corresponding to the identifier of the condition, and its type- Overrides:
_getConditionDefinitionAndValuein classAbstractDisableConditionsEvaluator<T extends ModelAwareDataHolder>- Parameters:
definition- the definition containing the conditioncondition- the conditiondataPath- the path of the evaluated dataoldDataPath- the old path of the evaluated data. Needed to get stored value if the data has been movedvalues- values to check conditions onametsyObject- the object holding the data to evaluate and the condition valuecontextualParameters- the contextual parameters- Returns:
- the
AbstractDisableConditionsEvaluator.DefinitionAndValuecorresponding to the condition identifier
-
containsValue
protected boolean containsValue(ModelItemAccessor modelItemAccessor, String conditionDataPath, Map<String, Object> values, Map<String, throws BadItemTypeExceptionObject> contextualParameters) Check if the valuesMapcontains a value for the condition- Specified by:
containsValuein classAbstractDisableConditionsEvaluator<T extends ModelAwareDataHolder>- Parameters:
modelItemAccessor- the relative accessor to the given condition pathconditionDataPath- the absolute data path of the conditionvalues- the valuesMapcontextualParameters- the contextual parameters- Returns:
trueif there is a value (even empty) for the condition in the valuesMap,falseotherwise- Throws:
BadItemTypeException- if a value does not correspond to the model of given object
-
_doesCompositeContainValue
protected boolean _doesCompositeContainValue(CompositeDefinition compositeDefinition, String compositeName, String subConditionDataPath, Map<String, Object> values, Map<String, Object> contextualParameters) Check if the valuesMapcontains a value for the condition- Parameters:
compositeDefinition- the composite definitioncompositeName- the name of the compositesubConditionDataPath- the data path of the condition, relative to the compositevalues- the valuesMapcontextualParameters- the contextual parameters- Returns:
trueif there is a value (even empty) for the condition in the composite value,falseotherwise- Throws:
BadItemTypeException- if the found value is not a composite
-
_doesRepeaterContainValue
protected boolean _doesRepeaterContainValue(RepeaterDefinition repeaterDefinition, String repeaterNameAndPositionSegment, String subConditionDataPath, Map<String, Object> values, Map<String, throws BadItemTypeExceptionObject> contextualParameters) Check if the valuesMapcontains a value for the condition- Parameters:
repeaterDefinition- the repeater definitionrepeaterNameAndPositionSegment- the segment of the repeater, containing repeater name and entry positionsubConditionDataPath- the data path of the condition, relative to the repeatervalues- the valuesMapcontextualParameters- the contextual parameters- Returns:
trueif there is a value (even empty) for the condition in the repeater value,falseotherwise- Throws:
BadItemTypeException- if the found value is not a repeater
-
_containsElementValue
protected boolean _containsElementValue(ModelItem definition, String dataName, Map<String, Object> values, Map<String, Object> contextualParameters) Check if the valuesMapcontains a value for the condition- Parameters:
definition- the definition of the condition elementdataName- the name of the condition elementvalues- the valuesMapcontextualParameters- the contextual parameters- Returns:
trueif there is a value (even empty),falseotherwise
-
getValueFromMap
protected Object getValueFromMap(ModelItemAccessor modelItemAccessor, String conditionDataPath, Map<String, Object> values, Map<String, throws BadItemTypeExceptionObject> contextualParameters) Retrieves the condition value from the valuesMap- Specified by:
getValueFromMapin classAbstractDisableConditionsEvaluator<T extends ModelAwareDataHolder>- Parameters:
modelItemAccessor- the relative accessor to the given condition pathconditionDataPath- the absolute data path of the conditionvalues- the valuesMapcontextualParameters- the contextual parameters- Returns:
- the condition value found in the values
Map - Throws:
BadItemTypeException- if a value does not correspond to the model of given object
-
_getValueFromComposite
protected Object _getValueFromComposite(CompositeDefinition compositeDefinition, String compositeName, String subConditionDataPath, Map<String, Object> values, Map<String, throws BadItemTypeExceptionObject> contextualParameters) Retrieves the condition value in the given composite, from the valuesMap- Parameters:
compositeDefinition- the composite definitioncompositeName- the name of the compositesubConditionDataPath- the data path of the condition, relative to the compositevalues- the valuesMapcontextualParameters- the contextual parameters- Returns:
- the condition value if found in the values
Map - Throws:
BadItemTypeException- if the found value is not a composite
-
_getValueFromRepeater
protected Object _getValueFromRepeater(RepeaterDefinition repeaterDefinition, String repeaterNameAndPositionSegment, String subConditionDataPath, Map<String, Object> values, Map<String, throws BadItemTypeExceptionObject> contextualParameters) Retrieves the condition value in the given repeater, from the valuesMap- Parameters:
repeaterDefinition- the repeater definitionrepeaterNameAndPositionSegment- the segment of the repeater, containing repeater name and entry positionsubConditionDataPath- the data path of the condition, relative to the repeatervalues- the valuesMapcontextualParameters- the contextual parameters- Returns:
- the condition value if found in the values
Map - Throws:
BadItemTypeException- if the found value is not a repeater
-
_getValueFromContentValue
protected Object _getValueFromContentValue(ContentElementDefinition contentElementDefinition, String dataName, String subConditionDataPath, Map<String, Object> values, Map<String, Object> contextualParameters) Retrieves the condition value in the given content value, from the valuesMap- Parameters:
contentElementDefinition- the content element definitiondataName- the name of the content datasubConditionDataPath- the data path of the condition, relative to the content valuevalues- the valuesMapcontextualParameters- the contextual parameters- Returns:
- the condition value if found in the values
Map
-
_getElementValueFromMap
protected Object _getElementValueFromMap(ModelItem definition, String dataName, Map<String, Object> values, Map<String, Object> contextualParameters) Retrieves the condition value from the valuesMap -
_getValueFromSynchronizableValue
protected Object _getValueFromSynchronizableValue(ModelItem definition, Object value, SynchronizationContext synchronizationContext, Map<String, Object> contextualParameters) Returns the value of the synchronized value corresponding of the given value- Parameters:
definition- the definition of the condition elementvalue- the valuesynchronizationContext- the synchronization contextcontextualParameters- the contextual parameters- Returns:
- the value of the synchronized value
-
getStoredValue
protected Object getStoredValue(String conditionDataPath, Optional<String> oldConditionDataPath, T ametysObject, Map<String, Object> contextualParameters) Description copied from class:AbstractDisableConditionsEvaluatorRetrieves the condition value from data stored in the given object- Specified by:
getStoredValuein classAbstractDisableConditionsEvaluator<T extends ModelAwareDataHolder>- Parameters:
conditionDataPath- the absolute data path of the conditionoldConditionDataPath- the absolute old data path of the conditionametysObject- the object holding the data to evaluate and the condition valuecontextualParameters- the contextual parameters- Returns:
- the condition value from data stored in the object
-