Class DefaultModifiableModelAwareDataHolder
java.lang.Object
org.ametys.plugins.repository.data.holder.impl.DefaultModelAwareDataHolder
org.ametys.plugins.repository.data.holder.impl.DefaultModifiableModelAwareDataHolder
- All Implemented Interfaces:
DataHolder,ModelAwareDataHolder,ModifiableDataHolder,ModifiableModelAwareDataHolder
- Direct Known Subclasses:
DefaultModifiableIndexableDataHolder
public class DefaultModifiableModelAwareDataHolder
extends DefaultModelAwareDataHolder
implements ModifiableModelAwareDataHolder
Default implementation for modifiable data holder with model
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Optional<LockableAmetysObject> Ametys object that can be locked on data modificationprotected Optional<? extends ModifiableModelAwareDataHolder> Parent of the currentDataHolderprotected ModifiableRepositoryDataRepository data to use to store data in the repositoryprotected ModifiableModelAwareDataHolderRootDataHolderFields inherited from class org.ametys.plugins.repository.data.holder.impl.DefaultModelAwareDataHolder
_itemContainers, _parent, _repositoryData, _rootFields inherited from interface org.ametys.plugins.repository.data.holder.ModelAwareDataHolder
ALTERNATIVE_SUFFIX, STATUS_SUFFIX -
Constructor Summary
ConstructorsConstructorDescriptionDefaultModifiableModelAwareDataHolder(ModifiableRepositoryData repositoryData, Collection<? extends ModelItemContainer> itemContainers, Optional<LockableAmetysObject> lockableAmetysObject, Optional<? extends ModifiableModelAwareDataHolder> parent, Optional<? extends ModifiableModelAwareDataHolder> root) Creates a modifiable default model aware data holderDefaultModifiableModelAwareDataHolder(ModifiableRepositoryData repositoryData, ModelItemContainer itemContainer) Creates a modifiable default model aware data holderDefaultModifiableModelAwareDataHolder(ModifiableRepositoryData repositoryData, ModelItemContainer itemContainer, Optional<LockableAmetysObject> lockableAmetysObject) Creates a modifiable default model aware data holderDefaultModifiableModelAwareDataHolder(ModifiableRepositoryData repositoryData, ModelItemContainer itemContainer, Optional<LockableAmetysObject> lockableAmetysObject, Optional<? extends ModifiableModelAwareDataHolder> parent, Optional<? extends ModifiableModelAwareDataHolder> root) Creates a modifiable default model aware data holder -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckModifiableDefinition(String dataPath, String errorMsg) Check definition for data path, for modification methodsprotected ModifiableModelAwareCompositecreateCompositeInstance(RepositoryData compositeRepositoryData, CompositeDefinition compositeDefinition) Creates an instance of compositeprotected ModifiableRepeatercreateRepeaterInstance(RepositoryData repeaterRepositoryData, RepeaterDefinition repeaterDefinition) Creates an instance of repeaterprotected <T extends SynchronizationResult>
TCreates an instance ofSynchronizationResultprotected voiddoRemoveValue(String dataName, ValueContext context) Removes the stored value of the simple data with the given nameprotected <T extends SynchronizationResult>
TdoSynchronizeValues(ViewItemAccessor viewItemAccessor, Map<String, Object> values, SynchronizationContext context) Synchronizes the given values with the currentModifiableModelAwareDataHolder's onesgetComposite(String compositePath) Retrieves the composite at the given pathgetComposite(String compositePath, boolean createNew) Retrieves the composite at the given pathprotected ModifiableModelAwareCompositegetComposite(String compositePath, boolean createNew, Optional<ExternalizableDataProvider.ExternalizableDataStatus> status) Retrieves the composite at the given path, optionally creating it if it does not exist, filtered by the given externalizable statusprotected ModifiableModelAwareCompositegetComposite(String name, CompositeDefinition compositeDefinition) Retrieves the composite with the given nameprotected ModifiableModelAwareCompositegetComposite(String name, CompositeDefinition compositeDefinition, boolean createNew) Retrieves the composite with the given nameprotected ClassRetrieves the class of the managed compositesgetExternalComposite(String compositePath) Retrieves the external composite at the given pathgetExternalComposite(String compositePath, boolean createNew) Retrieves the external composite at the given pathgetExternalRepeater(String repeaterPath) Retrieves the external repeater at the given pathgetExternalRepeater(String repeaterPath, boolean createNew) Retrieves the external repeater at the given pathgetLocalComposite(String compositePath) Retrieves the local composite at the given pathgetLocalComposite(String compositePath, boolean createNew) Retrieves the local composite at the given pathgetLocalRepeater(String repeaterPath) Retrieves the local repeater at the given pathgetLocalRepeater(String repeaterPath, boolean createNew) Retrieves the local repeater at the given pathOptional<? extends ModifiableModelAwareDataHolder> Retrieves the optional parent of the currentDataHolderThere can be no parent if the currentDataHolderis the rootgetRepeater(String repeaterPath) Retrieves the repeater at the given pathgetRepeater(String repeaterPath, boolean createNew) Retrieves the repeater at the given pathprotected ModifiableRepeatergetRepeater(String repeaterPath, boolean createNew, Optional<ExternalizableDataProvider.ExternalizableDataStatus> status) Retrieves the repeater at the given path, optionally creating it if it does not exist, filtered by the given externalizable statusprotected ModifiableRepeatergetRepeater(String name, RepeaterDefinition repeaterDefinition) Retrieves the repeater with the given nameprotected ModifiableRepeatergetRepeater(String name, RepeaterDefinition repeaterDefinition, boolean createNew) Retrieves the repeater with the given nameprotected ClassRetrieves the class of the managed repeatersprotected ClassRetrieves the class of the managed repeater entriesRetrieves the repository data used by thisDataHolderRetrieves theDataHolderthat is the root of the current onevoidremoveExternalizableMetadataIfExists(String dataPath) Removes the stored metadata (status and alternative value) for externalizable (or ex-externalizable) dataprotected voidremoveExternalizableMetadataIfExists(ModifiableRepositoryData repositoryData, String dataName) Removes the externalizable metadata (alternative value and status) for the given data name, if they exist in the given repository datavoidremoveExternalValue(String dataPath) Removes the external value of the data at the given pathvoidremoveLocalValue(String dataPath) Removes the local value of the data at the given pathvoidremoveValue(String dataPath) Removes the stored value of the data at the given pathprotected voidremoveValue(String dataPath, ValueContext context) Removes the stored value of the data at the given pathprotected <T extends SynchronizationResult>
TremoveValueForSynchronize(String dataName, ValueContext context) Removes the stored value of the data with the given nameprotected voidsetElementValue(ElementDefinition definition, String dataName, Object value) Writes the value of the given element definition into the repositoryvoidsetExternalValue(String dataPath, Object externalValue) Sets the external value of the data at the given pathvoidsetLocalValue(String dataPath, Object localValue) Sets the local value of the data at the given pathvoidsetStatus(String dataPath, ExternalizableDataProvider.ExternalizableDataStatus status) Set the status of the data at the given pathprotected voidsetStatus(String dataPath, CompositeDefinition compositeDefinition) Switches the current value and the alternative value of the composite at the given path to reflect the new externalizable statusprotected voidsetStatus(String dataPath, RepeaterDefinition repeaterDefinition) Switches the current value and the alternative value of the repeater at the given path to reflect the new externalizable statusprotected voidsetStatus(String dataName, ElementDefinition elementDefinition) Switches the current value and the alternative value of the element with the given name to reflect the new externalizable statusvoidSets the value of the data at the given pathprotected voidsetValue(String dataPath, Object value, ValueContext context) Sets the value of the data at the given pathprotected <T extends SynchronizationResult>
TsetValueForSynchronize(String dataName, SynchronizableValue value, ValueContext context) Sets the value of the data with the given nameprotected <T extends SynchronizationResult>
TsynchronizeElement(ViewElement viewElement, Map<String, Object> values, SynchronizationContext synchronizationContext) Synchronizes the given values with the given element's onesprotected <T extends SynchronizationResult>
TsynchronizeGroup(ModelViewItemGroup modelViewItemGroup, Map<String, Object> values, SynchronizationContext synchronizationContext) Synchronizes the given values with the given group's ones<T extends SynchronizationResult>
TsynchronizeValues(Map<String, Object> values) Synchronizes the given values with the current ones<T extends SynchronizationResult>
TsynchronizeValues(Map<String, Object> values, SynchronizationContext context) Synchronizes the given values with the current ones<T extends SynchronizationResult>
TsynchronizeValues(ViewItemAccessor viewItemAccessor, Map<String, Object> values) Synchronizes the given values with the current ones<T extends SynchronizationResult>
TsynchronizeValues(ViewItemAccessor viewItemAccessor, Map<String, Object> values, SynchronizationContext context) Synchronizes the given values with the currentModifiableModelAwareDataHolder's onesprotected booleanupdateStatusForSynchronize(String dataName, SynchronizableValue value, ValueContext context, boolean forceStatus, boolean doValuesContainData) Updates the status of the data with the given nameMethods inherited from class org.ametys.plugins.repository.data.holder.impl.DefaultModelAwareDataHolder
checkDefinition, checkDefinition, checkElementDifferences, checkElementDifferencesInRemoveMode, checkStatusDifferences, createSynchronizationContextInstance, dataToJSON, dataToJSON, dataToJSON, dataToJSONForEdition, dataToMap, dataToSAX, dataToSAX, dataToSAX, dataToSAXForEdition, doesHaveDifferences, doGetDifferences, ensureNonNullItemContainers, getCompositeFromValue, getDataNames, getDifferences, getDifferences, getDifferencesInGroup, getElementValue, getExternalValue, getFinalDataName, getGroupValue, getLocalValue, getManagedClass, getModel, getMultipleValues, getRepeaterFromValue, getStatus, getValue, getValue, getValueOrDefault, getValueOrDefault, getValueWithMultiValuedPathSegments, hasDefaultValue, hasDifferences, hasDifferences, hasDifferencesInElement, hasDifferencesInGroup, hasExternalValue, hasExternalValueOrEmpty, hasLocalValue, hasLocalValueOrEmpty, hasValue, hasValue, hasValueForName, hasValueOrEmpty, hasValueOrEmpty, hasValueOrEmptyForNameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.ametys.plugins.repository.data.holder.DataHolder
copyTo, copyTo, dataToJSON, dataToJSON, dataToSAX, dataToSAX, getValue, getValueOrDefault, hasValue, hasValueOrEmptyMethods inherited from interface org.ametys.plugins.repository.data.holder.ModelAwareDataHolder
dataToJSON, dataToJSON, dataToJSON, dataToJSON, dataToJSONForEdition, dataToMap, dataToMap, dataToMap, dataToMap, dataToSAX, dataToSAX, dataToSAX, dataToSAX, dataToSAXForEdition, getDataNames, getDefinition, getDifferences, getDifferences, getDifferences, getDifferences, getExternalValue, getLocalValue, getModel, getModelItemTypeExtensionPoint, getStatus, getType, getValueOfType, getValueOfTypeOrDefault, getValueOrDefault, getValueWithMultiValuedPathSegments, hasDefinition, hasDifferences, hasDifferences, hasDifferences, hasDifferences, hasExternalValue, hasExternalValueOrEmpty, hasLocalValue, hasLocalValueOrEmpty, hasValue, isMultiple, isMultipleMethods inherited from interface org.ametys.plugins.repository.data.holder.ModifiableModelAwareDataHolder
setValue
-
Field Details
-
_modifiableRepositoryData
Repository data to use to store data in the repository -
_lockableAmetysObject
Ametys object that can be locked on data modification -
_modifiableParent
Parent of the currentDataHolder -
_modifiableRoot
RootDataHolder
-
-
Constructor Details
-
DefaultModifiableModelAwareDataHolder
public DefaultModifiableModelAwareDataHolder(ModifiableRepositoryData repositoryData, ModelItemContainer itemContainer) Creates a modifiable default model aware data holder- Parameters:
repositoryData- the repository data to useitemContainer- the model container to use to get information about definitions. Must match the given repository data. A repository data can have several item containers. For example, a content can have several content types.
-
DefaultModifiableModelAwareDataHolder
public DefaultModifiableModelAwareDataHolder(ModifiableRepositoryData repositoryData, ModelItemContainer itemContainer, Optional<LockableAmetysObject> lockableAmetysObject) Creates a modifiable default model aware data holder- Parameters:
repositoryData- the repository data to useitemContainer- the model container to use to get information about definitions. Must match the given repository data. A repository data can have several item containers. For example, a content can have several content types.lockableAmetysObject- the ametys object that can be locked on data modification
-
DefaultModifiableModelAwareDataHolder
public DefaultModifiableModelAwareDataHolder(ModifiableRepositoryData repositoryData, ModelItemContainer itemContainer, Optional<LockableAmetysObject> lockableAmetysObject, Optional<? extends ModifiableModelAwareDataHolder> parent, Optional<? extends ModifiableModelAwareDataHolder> root) Creates a modifiable default model aware data holder- Parameters:
repositoryData- the repository data to useitemContainer- the model container to use to get information about definitions. Must match the given repository data. A repository data can have several item containers. For example, a content can have several content types.lockableAmetysObject- the ametys object that can be locked on data modificationparent- the parent of the createdDataHolder, empty if the createdDataHolderis the rootDataHolderroot- the rootDataHolder
-
DefaultModifiableModelAwareDataHolder
public DefaultModifiableModelAwareDataHolder(ModifiableRepositoryData repositoryData, Collection<? extends ModelItemContainer> itemContainers, Optional<LockableAmetysObject> lockableAmetysObject, Optional<? extends ModifiableModelAwareDataHolder> parent, Optional<? extends ModifiableModelAwareDataHolder> root) Creates a modifiable default model aware data holder- Parameters:
repositoryData- the repository data to useitemContainers- the model containers to use to get information about definitions. Must match the given repository data. A repository data can have several item containers. For example, a content can have several content types.lockableAmetysObject- the ametys object that can be locked on data modificationparent- the parent of the createdDataHolder, empty if the createdDataHolderis the rootDataHolderroot- the rootDataHolder
-
-
Method Details
-
getComposite
public ModifiableModelAwareComposite getComposite(String compositePath) throws IllegalArgumentException, BadItemTypeException, UndefinedItemPathException, BadDataPathCardinalityException Description copied from interface:DataHolderRetrieves the composite at the given path- Specified by:
getCompositein interfaceDataHolder- Specified by:
getCompositein interfaceModelAwareDataHolder- Specified by:
getCompositein interfaceModifiableDataHolder- Specified by:
getCompositein interfaceModifiableModelAwareDataHolder- Overrides:
getCompositein classDefaultModelAwareDataHolder- Parameters:
compositePath- path of the composite to retrieve- Returns:
- the composite or
nullif not exists or is empty - Throws:
IllegalArgumentException- if the given composite path is null or emptyBadItemTypeException- if the stored value at the given path is not a compositeUndefinedItemPathException- if the data holder has a model and the given composite path is not defined by this modelBadDataPathCardinalityException- if the data holder has a model and the definition of a part of the data path is multiple. Only the last part can be multiple
-
getLocalComposite
public ModifiableModelAwareComposite getLocalComposite(String compositePath) throws IllegalArgumentException, BadItemTypeException, UndefinedItemPathException, BadDataPathCardinalityException Description copied from interface:ModelAwareDataHolderRetrieves the local composite at the given path- Specified by:
getLocalCompositein interfaceModelAwareDataHolder- Specified by:
getLocalCompositein interfaceModifiableModelAwareDataHolder- Overrides:
getLocalCompositein classDefaultModelAwareDataHolder- Parameters:
compositePath- path of the externalizable composite to retrieve- Returns:
- the composite or
nullif not exists or is empty - Throws:
IllegalArgumentException- if the given composite path is null or emptyBadItemTypeException- if the stored value at the given path is not a compositeUndefinedItemPathException- if the given composite path is not defined by the modelBadDataPathCardinalityException- if the definition of a part of the data path is multiple. Only the last part can be multiple
-
getExternalComposite
public ModifiableModelAwareComposite getExternalComposite(String compositePath) throws IllegalArgumentException, BadItemTypeException, UndefinedItemPathException, BadDataPathCardinalityException Description copied from interface:ModelAwareDataHolderRetrieves the external composite at the given path- Specified by:
getExternalCompositein interfaceModelAwareDataHolder- Specified by:
getExternalCompositein interfaceModifiableModelAwareDataHolder- Overrides:
getExternalCompositein classDefaultModelAwareDataHolder- Parameters:
compositePath- path of the externalizable composite to retrieve- Returns:
- the composite or
nullif not exists or is empty - Throws:
IllegalArgumentException- if the given composite path is null or emptyBadItemTypeException- if the stored value at the given path is not a compositeUndefinedItemPathException- if the given composite path is not defined by the modelBadDataPathCardinalityException- if the definition of a part of the data path is multiple. Only the last part can be multiple
-
getComposite
protected ModifiableModelAwareComposite getComposite(String name, CompositeDefinition compositeDefinition) throws BadItemTypeException Description copied from class:DefaultModelAwareDataHolderRetrieves the composite with the given name- Overrides:
getCompositein classDefaultModelAwareDataHolder- Parameters:
name- name of the composite to retrievecompositeDefinition- the definition of the composite to retrieve- Returns:
- the composite
- Throws:
BadItemTypeException- if the value stored in the repository with the given name is not a composite
-
getRepeater
public ModifiableRepeater getRepeater(String repeaterPath) throws IllegalArgumentException, BadItemTypeException, UndefinedItemPathException, BadDataPathCardinalityException Description copied from interface:ModelAwareDataHolderRetrieves the repeater at the given path- Specified by:
getRepeaterin interfaceModelAwareDataHolder- Specified by:
getRepeaterin interfaceModifiableModelAwareDataHolder- Overrides:
getRepeaterin classDefaultModelAwareDataHolder- Parameters:
repeaterPath- path of the repeater to retrieve- Returns:
- the repeater or
nullif not exists or is empty - Throws:
IllegalArgumentException- if the given repeater path is null or emptyBadItemTypeException- if the stored value at the given path is not a repeaterUndefinedItemPathException- if the given repeater path is not defined by the modelBadDataPathCardinalityException- if the definition of a part of the data path is multiple. Only the last part can be multiple
-
getLocalRepeater
public ModifiableRepeater getLocalRepeater(String repeaterPath) throws IllegalArgumentException, BadItemTypeException, UndefinedItemPathException, BadDataPathCardinalityException Description copied from interface:ModelAwareDataHolderRetrieves the local repeater at the given path- Specified by:
getLocalRepeaterin interfaceModelAwareDataHolder- Specified by:
getLocalRepeaterin interfaceModifiableModelAwareDataHolder- Overrides:
getLocalRepeaterin classDefaultModelAwareDataHolder- Parameters:
repeaterPath- path of the externalizable repeater to retrieve- Returns:
- the repeater or
nullif not exists or is empty - Throws:
IllegalArgumentException- if the given repeater path is null or emptyBadItemTypeException- if the stored value at the given path is not a repeaterUndefinedItemPathException- if the given repeater path is not defined by the modelBadDataPathCardinalityException- if the definition of a part of the data path is multiple. Only the last part can be multiple
-
getExternalRepeater
public ModifiableRepeater getExternalRepeater(String repeaterPath) throws IllegalArgumentException, BadItemTypeException, UndefinedItemPathException, BadDataPathCardinalityException Description copied from interface:ModelAwareDataHolderRetrieves the external repeater at the given path- Specified by:
getExternalRepeaterin interfaceModelAwareDataHolder- Specified by:
getExternalRepeaterin interfaceModifiableModelAwareDataHolder- Overrides:
getExternalRepeaterin classDefaultModelAwareDataHolder- Parameters:
repeaterPath- path of the externalizable repeater to retrieve- Returns:
- the repeater or
nullif not exists or is empty - Throws:
IllegalArgumentException- if the given repeater path is null or emptyBadItemTypeException- if the stored value at the given path is not a repeaterUndefinedItemPathException- if the given repeater path is not defined by the modelBadDataPathCardinalityException- if the definition of a part of the data path is multiple. Only the last part can be multiple
-
getRepeater
protected ModifiableRepeater getRepeater(String name, RepeaterDefinition repeaterDefinition) throws BadItemTypeException Description copied from class:DefaultModelAwareDataHolderRetrieves the repeater with the given name- Overrides:
getRepeaterin classDefaultModelAwareDataHolder- Parameters:
name- name of the repeater to retrieverepeaterDefinition- the definition of the repeater to retrieve- Returns:
- the repeater
- Throws:
BadItemTypeException- if the value stored in the repository with the given name is not a repeater
-
getComposite
public ModifiableModelAwareComposite getComposite(String compositePath, boolean createNew) throws IllegalArgumentException, BadItemTypeException, UndefinedItemPathException, BadDataPathCardinalityException Description copied from interface:ModifiableDataHolderRetrieves the composite at the given path- Specified by:
getCompositein interfaceModifiableDataHolder- Specified by:
getCompositein interfaceModifiableModelAwareDataHolder- Parameters:
compositePath- path of the composite to retrievecreateNew-trueto create the composite if it does not exist,falseotherwise- Returns:
- the composite or
nullif createNew isfalseand value not exists or is empty - Throws:
IllegalArgumentException- if the given composite path is null or emptyBadItemTypeException- if the stored value at the given path is not a compositeUndefinedItemPathException- if the data holder has a model and the given composite path is not defined by this modelBadDataPathCardinalityException- if the data holder has a model and the definition of a part of the data path is multiple. Only the last part can be multiple
-
getLocalComposite
public ModifiableModelAwareComposite getLocalComposite(String compositePath, boolean createNew) throws IllegalArgumentException, BadItemTypeException, UndefinedItemPathException, BadDataPathCardinalityException Description copied from interface:ModifiableModelAwareDataHolderRetrieves the local composite at the given path- Specified by:
getLocalCompositein interfaceModifiableModelAwareDataHolder- Parameters:
compositePath- path of the externalizable composite to retrievecreateNew-trueto create the composite if it does not exist,falseotherwise- Returns:
- the composite or
nullif createNew isfalseand value not exists or is empty - Throws:
IllegalArgumentException- if the given composite path is null or emptyBadItemTypeException- if the stored value at the given path is not a compositeUndefinedItemPathException- if the given composite path is not defined by the modelBadDataPathCardinalityException- if the definition of a part of the data path is multiple. Only the last part can be multiple
-
getExternalComposite
public ModifiableModelAwareComposite getExternalComposite(String compositePath, boolean createNew) throws IllegalArgumentException, BadItemTypeException, UndefinedItemPathException, BadDataPathCardinalityException Description copied from interface:ModifiableModelAwareDataHolderRetrieves the external composite at the given path- Specified by:
getExternalCompositein interfaceModifiableModelAwareDataHolder- Parameters:
compositePath- path of the externalizable composite to retrievecreateNew-trueto create the composite if it does not exist,falseotherwise- Returns:
- the composite or
nullif createNew isfalseand value not exists or is empty - Throws:
IllegalArgumentException- if the given composite path is null or emptyBadItemTypeException- if the stored value at the given path is not a compositeUndefinedItemPathException- if the given composite path is not defined by the modelBadDataPathCardinalityException- if the definition of a part of the data path is multiple. Only the last part can be multiple
-
getComposite
protected ModifiableModelAwareComposite getComposite(String compositePath, boolean createNew, Optional<ExternalizableDataProvider.ExternalizableDataStatus> status) throws IllegalArgumentException, BadItemTypeException, UndefinedItemPathException, BadDataPathCardinalityException Retrieves the composite at the given path, optionally creating it if it does not exist, filtered by the given externalizable status- Parameters:
compositePath- the path of the composite to retrievecreateNew-trueto create the composite if it does not exist,falseotherwisestatus- the optional externalizable status to filter on, or empty to retrieve the current composite- Returns:
- the composite, or
nullif it does not exist andcreateNewisfalse - Throws:
IllegalArgumentException- if the composite path is emptyBadItemTypeException- if the data at the given path is not a compositeUndefinedItemPathException- if the path does not match any definitionBadDataPathCardinalityException- if an intermediate segment of the path refers to a multiple data
-
getComposite
protected ModifiableModelAwareComposite getComposite(String name, CompositeDefinition compositeDefinition, boolean createNew) throws BadItemTypeException Retrieves the composite with the given name- Parameters:
name- name of the composite to retrievecompositeDefinition- the definition of the composite to retrievecreateNew-trueto create the repeater if it does not exist,falseotherwise- Returns:
- the composite
- Throws:
BadItemTypeException- if the value stored in the repository with the given name is not a composite
-
createCompositeInstance
protected ModifiableModelAwareComposite createCompositeInstance(RepositoryData compositeRepositoryData, CompositeDefinition compositeDefinition) Description copied from class:DefaultModelAwareDataHolderCreates an instance of composite- Overrides:
createCompositeInstancein classDefaultModelAwareDataHolder- Parameters:
compositeRepositoryData- the repository data of the composite to createcompositeDefinition- the definition of the composite to create- Returns:
- the created composite instance
-
getRepeater
public ModifiableRepeater getRepeater(String repeaterPath, boolean createNew) throws IllegalArgumentException, BadItemTypeException, UndefinedItemPathException, BadDataPathCardinalityException Description copied from interface:ModifiableModelAwareDataHolderRetrieves the repeater at the given path- Specified by:
getRepeaterin interfaceModifiableModelAwareDataHolder- Parameters:
repeaterPath- path of the repeater to retrievecreateNew-trueto create the repeater if it does not exist,falseotherwise- Returns:
- the repeater or
nullif createNew isfalseand value not exists or is empty - Throws:
IllegalArgumentException- if the given repeater path is null or emptyBadItemTypeException- if the stored value at the given path is not a repeaterUndefinedItemPathException- if the given composite path is not defined by the modelBadDataPathCardinalityException- if the definition of a part of the data path is multiple. Only the last part can be multiple
-
getLocalRepeater
public ModifiableRepeater getLocalRepeater(String repeaterPath, boolean createNew) throws IllegalArgumentException, BadItemTypeException, UndefinedItemPathException, BadDataPathCardinalityException Description copied from interface:ModifiableModelAwareDataHolderRetrieves the local repeater at the given path- Specified by:
getLocalRepeaterin interfaceModifiableModelAwareDataHolder- Parameters:
repeaterPath- path of the externalizable repeater to retrievecreateNew-trueto create the repeater if it does not exist,falseotherwise- Returns:
- the repeater or
nullif createNew isfalseand value not exists or is empty - Throws:
IllegalArgumentException- if the given repeater path is null or emptyBadItemTypeException- if the stored value at the given path is not a repeaterUndefinedItemPathException- if the given composite path is not defined by the modelBadDataPathCardinalityException- if the definition of a part of the data path is multiple. Only the last part can be multiple
-
getExternalRepeater
public ModifiableRepeater getExternalRepeater(String repeaterPath, boolean createNew) throws IllegalArgumentException, BadItemTypeException, UndefinedItemPathException, BadDataPathCardinalityException Description copied from interface:ModifiableModelAwareDataHolderRetrieves the external repeater at the given path- Specified by:
getExternalRepeaterin interfaceModifiableModelAwareDataHolder- Parameters:
repeaterPath- path of the externalizable repeater to retrievecreateNew-trueto create the repeater if it does not exist,falseotherwise- Returns:
- the repeater or
nullif createNew isfalseand value not exists or is empty - Throws:
IllegalArgumentException- if the given repeater path is null or emptyBadItemTypeException- if the stored value at the given path is not a repeaterUndefinedItemPathException- if the given composite path is not defined by the modelBadDataPathCardinalityException- if the definition of a part of the data path is multiple. Only the last part can be multiple
-
getRepeater
protected ModifiableRepeater getRepeater(String repeaterPath, boolean createNew, Optional<ExternalizableDataProvider.ExternalizableDataStatus> status) throws IllegalArgumentException, BadItemTypeException, UndefinedItemPathException, BadDataPathCardinalityException Retrieves the repeater at the given path, optionally creating it if it does not exist, filtered by the given externalizable status- Parameters:
repeaterPath- the path of the repeater to retrievecreateNew-trueto create the repeater if it does not exist,falseotherwisestatus- the optional externalizable status to filter on, or empty to retrieve the current repeater- Returns:
- the repeater, or
nullif it does not exist andcreateNewisfalse - Throws:
IllegalArgumentException- if the repeater path is emptyBadItemTypeException- if the data at the given path is not a repeaterUndefinedItemPathException- if the path does not match any definitionBadDataPathCardinalityException- if an intermediate segment of the path refers to a multiple data
-
getRepeater
protected ModifiableRepeater getRepeater(String name, RepeaterDefinition repeaterDefinition, boolean createNew) throws BadItemTypeException Retrieves the repeater with the given name- Parameters:
name- name of the repeater to retrieverepeaterDefinition- the definition of the repeater to retrievecreateNew-trueto create the repeater if it does not exist,falseotherwise- Returns:
- the repeater
- Throws:
BadItemTypeException- if the value stored in the repository with the given name is not a repeater
-
createRepeaterInstance
protected ModifiableRepeater createRepeaterInstance(RepositoryData repeaterRepositoryData, RepeaterDefinition repeaterDefinition) Description copied from class:DefaultModelAwareDataHolderCreates an instance of repeater- Overrides:
createRepeaterInstancein classDefaultModelAwareDataHolder- Parameters:
repeaterRepositoryData- the repository data of the repeater to createrepeaterDefinition- the definition of the repeater to create- Returns:
- the created repeater instance
-
getRepeaterEntryClass
Description copied from class:DefaultModelAwareDataHolderRetrieves the class of the managed repeater entries- Overrides:
getRepeaterEntryClassin classDefaultModelAwareDataHolder- Returns:
- the class of the managed repeater entries
-
getRepeaterClass
Description copied from class:DefaultModelAwareDataHolderRetrieves the class of the managed repeaters- Overrides:
getRepeaterClassin classDefaultModelAwareDataHolder- Returns:
- the class of the managed repeaters
-
getCompositeClass
Description copied from class:DefaultModelAwareDataHolderRetrieves the class of the managed composites- Overrides:
getCompositeClassin classDefaultModelAwareDataHolder- Returns:
- the class of the managed composites
-
synchronizeValues
public <T extends SynchronizationResult> T synchronizeValues(Map<String, Object> values) throws BadItemTypeException, UndefinedItemPathExceptionDescription copied from interface:ModifiableDataHolderSynchronizes the given values with the current ones- Specified by:
synchronizeValuesin interfaceModifiableDataHolder- Type Parameters:
T- the type of theSynchronizationResult- Parameters:
values- the values to synchronize- Returns:
- the
SynchronizationResult - Throws:
BadItemTypeException- if type of the a data doesn't match the corresponding given value to setUndefinedItemPathException- if the data holder has a model and a key in the given Map refers to a data that is not defined by the model
-
synchronizeValues
public <T extends SynchronizationResult> T synchronizeValues(Map<String, Object> values, SynchronizationContext context) throws BadItemTypeException, UndefinedItemPathExceptionDescription copied from interface:ModifiableModelAwareDataHolderSynchronizes the given values with the current ones- Specified by:
synchronizeValuesin interfaceModifiableModelAwareDataHolder- Type Parameters:
T- the type of theSynchronizationResult- Parameters:
values- the values to synchronizecontext- the context of the synchronization- Returns:
- the
SynchronizationResult - Throws:
BadItemTypeException- if the type defined by the model of one of the Map's key doesn't match the corresponding valueUndefinedItemPathException- if a key in the given Map refers to a data that is not defined by the model
-
synchronizeValues
public <T extends SynchronizationResult> T synchronizeValues(ViewItemAccessor viewItemAccessor, Map<String, Object> values) throws BadItemTypeException, UndefinedItemPathExceptionDescription copied from interface:ModifiableModelAwareDataHolderSynchronizes the given values with the current ones- Specified by:
synchronizeValuesin interfaceModifiableModelAwareDataHolder- Type Parameters:
T- the type of theSynchronizationResult- Parameters:
viewItemAccessor- TheViewItemAccessorfor all items to synchronizevalues- the values to synchronize- Returns:
- the
SynchronizationResult - Throws:
BadItemTypeException- if the type defined by the model of one of the Map's key doesn't match the corresponding valueUndefinedItemPathException- if a key in the given Map refers to a data that is not defined by the model
-
synchronizeValues
public <T extends SynchronizationResult> T synchronizeValues(ViewItemAccessor viewItemAccessor, Map<String, Object> values, SynchronizationContext context) throws BadItemTypeException, UndefinedItemPathExceptionDescription copied from interface:ModifiableModelAwareDataHolderSynchronizes the given values with the currentModifiableModelAwareDataHolder's ones- Specified by:
synchronizeValuesin interfaceModifiableModelAwareDataHolder- Type Parameters:
T- the type of theSynchronizationResult- Parameters:
viewItemAccessor- TheViewItemAccessorfor all items to synchronizevalues- the values to synchronizecontext- the context of the synchronization- Returns:
- the
SynchronizationResult - Throws:
BadItemTypeException- if the type defined by the model of one of the Map's key doesn't match the corresponding valueUndefinedItemPathException- if a key in the given Map refers to a data that is not defined by the model
-
doSynchronizeValues
protected <T extends SynchronizationResult> T doSynchronizeValues(ViewItemAccessor viewItemAccessor, Map<String, Object> values, SynchronizationContext context) throws BadItemTypeException, UndefinedItemPathExceptionSynchronizes the given values with the currentModifiableModelAwareDataHolder's ones- Type Parameters:
T- the type of theSynchronizationResult- Parameters:
viewItemAccessor- TheViewItemAccessorfor all items to synchronizevalues- the values to synchronizecontext- the context of the synchronization- Returns:
- the
SynchronizationResult - Throws:
BadItemTypeException- if the type defined by the model of one of the Map's key doesn't match the corresponding valueUndefinedItemPathException- if a key in the given Map refers to a data that is not defined by the model
-
synchronizeGroup
protected <T extends SynchronizationResult> T synchronizeGroup(ModelViewItemGroup modelViewItemGroup, Map<String, Object> values, SynchronizationContext synchronizationContext) throws BadItemTypeException, UndefinedItemPathExceptionSynchronizes the given values with the given group's ones- Type Parameters:
T- the type of theSynchronizationResult- Parameters:
modelViewItemGroup- The group containing items to synchronizevalues- the values to synchronizesynchronizationContext- the context of the synchronization- Returns:
- the
SynchronizationResult - Throws:
BadItemTypeException- if the type defined by the model of one of the Map's key doesn't match the corresponding valueUndefinedItemPathException- if a key in the given Map refers to a data that is not defined by the model
-
synchronizeElement
protected <T extends SynchronizationResult> T synchronizeElement(ViewElement viewElement, Map<String, Object> values, SynchronizationContext synchronizationContext) throws BadItemTypeException, UndefinedItemPathExceptionSynchronizes the given values with the given element's ones- Type Parameters:
T- the type of theSynchronizationResult- Parameters:
viewElement- The element item to synchronizevalues- the values to synchronizesynchronizationContext- the context of the synchronization- Returns:
- the
SynchronizationResult - Throws:
BadItemTypeException- if the type defined by the model of one of the Map's key doesn't match the corresponding valueUndefinedItemPathException- if a key in the given Map refers to a data that is not defined by the model
-
updateStatusForSynchronize
protected boolean updateStatusForSynchronize(String dataName, SynchronizableValue value, ValueContext context, boolean forceStatus, boolean doValuesContainData) throws IllegalArgumentException, BadItemTypeException, UndefinedItemPathException Updates the status of the data with the given name- Parameters:
dataName- name of the datavalue- the valuecontext- context of the dataforceStatus-trueto force the status if it is not present,falseotherwisedoValuesContainData-trueif the values contain the data,falseotherwise- Returns:
trueif the status has changed,falseotherwise- Throws:
IllegalArgumentException- if the given data name is null or emptyBadItemTypeException- if the type defined by the model doesn't match the given value to setUndefinedItemPathException- if the given data name is not defined by the model
-
setValueForSynchronize
protected <T extends SynchronizationResult> T setValueForSynchronize(String dataName, SynchronizableValue value, ValueContext context) throws IllegalArgumentException, BadItemTypeException, UndefinedItemPathException Sets the value of the data with the given name- Type Parameters:
T- the type of theSynchronizationResult- Parameters:
dataName- name of the datavalue- the value to set. Givenullto empty the value.context- context of the data to set- Returns:
- the
SynchronizationResult - Throws:
IllegalArgumentException- if the given data name is null or emptyBadItemTypeException- if the type defined by the model doesn't match the given value to setUndefinedItemPathException- if the given data name is not defined by the model
-
removeValueForSynchronize
protected <T extends SynchronizationResult> T removeValueForSynchronize(String dataName, ValueContext context) throws IllegalArgumentException, BadItemTypeException, UndefinedItemPathException Removes the stored value of the data with the given name- Type Parameters:
T- the type of theSynchronizationResult- Parameters:
dataName- name of the datacontext- context of the data to remove- Returns:
- the
SynchronizationResult - Throws:
IllegalArgumentException- if the given data name is null or emptyBadItemTypeException- if the value of the parent with the given name is not an item containerUndefinedItemPathException- if the given data name is not defined by the model
-
setValue
public void setValue(String dataPath, Object value) throws IllegalArgumentException, BadItemTypeException, UndefinedItemPathException, BadDataPathCardinalityException Description copied from interface:ModifiableModelAwareDataHolderSets the value of the data at the given path- Specified by:
setValuein interfaceModifiableDataHolder- Specified by:
setValuein interfaceModifiableModelAwareDataHolder- Parameters:
dataPath- path of the datavalue- the value to set. Givenullto empty the value.- Throws:
IllegalArgumentException- if the given data path is null or emptyBadItemTypeException- if type of the data at the given path doesn't match the given value to setUndefinedItemPathException- if the data holder has a model and the given data path is not defined by the modelBadDataPathCardinalityException- if the data holder has a model and the definition of a part of the data path is multiple. Only the last part can be multiple
-
setLocalValue
public void setLocalValue(String dataPath, Object localValue) throws IllegalArgumentException, BadItemTypeException, UndefinedItemPathException, BadDataPathCardinalityException Description copied from interface:ModifiableModelAwareDataHolderSets the local value of the data at the given path- Specified by:
setLocalValuein interfaceModifiableModelAwareDataHolder- Parameters:
dataPath- path of the externalizable datalocalValue- the local value to set. Givenullto empty the value.- Throws:
IllegalArgumentException- if the given data path is null or emptyBadItemTypeException- if the type defined by the model doesn't match the given value to setUndefinedItemPathException- if the given data path is not defined by the modelBadDataPathCardinalityException- if the definition of a part of the data path is multiple. Only the last part can be multiple
-
setExternalValue
public void setExternalValue(String dataPath, Object externalValue) throws IllegalArgumentException, BadItemTypeException, UndefinedItemPathException, BadDataPathCardinalityException Description copied from interface:ModifiableModelAwareDataHolderSets the external value of the data at the given path- Specified by:
setExternalValuein interfaceModifiableModelAwareDataHolder- Parameters:
dataPath- path of the externalizable dataexternalValue- the external value to set. Givenullto empty the value.- Throws:
IllegalArgumentException- if the given data path is null or emptyBadItemTypeException- if the type defined by the model doesn't match the given value to setUndefinedItemPathException- if the given data path is not defined by the modelBadDataPathCardinalityException- if the definition of a part of the data path is multiple. Only the last part can be multiple
-
setValue
protected void setValue(String dataPath, Object value, ValueContext context) throws IllegalArgumentException, BadItemTypeException, UndefinedItemPathException, BadDataPathCardinalityException Sets the value of the data at the given path- Parameters:
dataPath- path of the datavalue- the value to set. Givenullto empty the value.context- context of the data to set- Throws:
IllegalArgumentException- if the given data path is null or emptyBadItemTypeException- if the type defined by the model doesn't match the given value to setUndefinedItemPathException- if the given data path is not defined by the modelBadDataPathCardinalityException- if the definition of a part of the data path is multiple. Only the last part can be multiple
-
setElementValue
Writes the value of the given element definition into the repository- Parameters:
definition- the definition of the elementdataName- the final name (possibly altered with a status suffix) to use to write the repository datavalue- the value to write. Can benullto write an empty value, single or array depending on the definition cardinality.
-
setStatus
public void setStatus(String dataPath, ExternalizableDataProvider.ExternalizableDataStatus status) throws IllegalArgumentException, BadItemTypeException, UndefinedItemPathException, BadDataPathCardinalityException Description copied from interface:ModifiableModelAwareDataHolderSet the status of the data at the given path- Specified by:
setStatusin interfaceModifiableModelAwareDataHolder- Parameters:
dataPath- path of the externalizable datastatus- the new status- Throws:
IllegalArgumentException- if the given data path is null or emptyBadItemTypeException- if there is a type issue while getting the parent (part of the dataPath without the last segment)UndefinedItemPathException- if the given data path is not defined by the modelBadDataPathCardinalityException- if the definition of a part of the data path is multiple. Only the last part can be multiple
-
setStatus
Switches the current value and the alternative value of the composite at the given path to reflect the new externalizable status- Parameters:
dataPath- the name of the composite datacompositeDefinition- the definition of the composite
-
setStatus
Switches the current value and the alternative value of the repeater at the given path to reflect the new externalizable status- Parameters:
dataPath- the name of the repeater datarepeaterDefinition- the definition of the repeater
-
setStatus
Switches the current value and the alternative value of the element with the given name to reflect the new externalizable status- Parameters:
dataName- the name of the element dataelementDefinition- the definition of the element
-
removeValue
public void removeValue(String dataPath) throws IllegalArgumentException, BadItemTypeException, UndefinedItemPathException, BadDataPathCardinalityException Description copied from interface:ModifiableDataHolderRemoves the stored value of the data at the given path- Specified by:
removeValuein interfaceModifiableDataHolder- Parameters:
dataPath- path of the data- Throws:
IllegalArgumentException- if the given data path is null or emptyBadItemTypeException- if the value of the parent of the given path is not an item containerUndefinedItemPathException- if the data holder has a model and the given data path is not defined by the modelBadDataPathCardinalityException- if the data holder has a model and the definition of a part of the data path is multiple. Only the last part can be multiple
-
removeLocalValue
public void removeLocalValue(String dataPath) throws IllegalArgumentException, BadItemTypeException, UndefinedItemPathException, BadDataPathCardinalityException Description copied from interface:ModifiableModelAwareDataHolderRemoves the local value of the data at the given path- Specified by:
removeLocalValuein interfaceModifiableModelAwareDataHolder- Parameters:
dataPath- path of the externalizable data- Throws:
IllegalArgumentException- if the given data path is null or emptyBadItemTypeException- if the value of the parent of the given path is not an item containerUndefinedItemPathException- if the given data path is not defined by the modelBadDataPathCardinalityException- if the definition of a part of the data path is multiple. Only the last part can be multiple
-
removeExternalValue
public void removeExternalValue(String dataPath) throws IllegalArgumentException, BadItemTypeException, UndefinedItemPathException, BadDataPathCardinalityException Description copied from interface:ModifiableModelAwareDataHolderRemoves the external value of the data at the given path- Specified by:
removeExternalValuein interfaceModifiableModelAwareDataHolder- Parameters:
dataPath- path of the externalizable data- Throws:
IllegalArgumentException- if the given data path is null or emptyBadItemTypeException- if the value of the parent of the given path is not an item containerUndefinedItemPathException- if the given data path is not defined by the modelBadDataPathCardinalityException- if the definition of a part of the data path is multiple. Only the last part can be multiple
-
removeValue
protected void removeValue(String dataPath, ValueContext context) throws IllegalArgumentException, BadItemTypeException, UndefinedItemPathException, BadDataPathCardinalityException Removes the stored value of the data at the given path- Parameters:
dataPath- path of the datacontext- context of the data to remove- Throws:
IllegalArgumentException- if the given data path is null or emptyBadItemTypeException- if the value of the parent of the given path is not an item containerUndefinedItemPathException- if the given data path is not defined by the modelBadDataPathCardinalityException- if the definition of a part of the data path is multiple. Only the last part can be multiple
-
doRemoveValue
Removes the stored value of the simple data with the given name- Parameters:
dataName- the simple name of the data (no path separator)context- context of the data to remove, including the optional externalizable status
-
removeExternalizableMetadataIfExists
public void removeExternalizableMetadataIfExists(String dataPath) throws IllegalArgumentException, BadItemTypeException, UndefinedItemPathException, BadDataPathCardinalityException Description copied from interface:ModifiableModelAwareDataHolderRemoves the stored metadata (status and alternative value) for externalizable (or ex-externalizable) data- Specified by:
removeExternalizableMetadataIfExistsin interfaceModifiableModelAwareDataHolder- Parameters:
dataPath- path of the data- Throws:
IllegalArgumentException- if the given data path is null or emptyBadItemTypeException- if the value of the parent of the given path is not an item containerUndefinedItemPathException- if the given data path is not defined by the modelBadDataPathCardinalityException- if the definition of a part of the data path is multiple. Only the last part can be multiple
-
removeExternalizableMetadataIfExists
protected void removeExternalizableMetadataIfExists(ModifiableRepositoryData repositoryData, String dataName) Removes the externalizable metadata (alternative value and status) for the given data name, if they exist in the given repository data- Parameters:
repositoryData- the repository data from which to remove the metadatadataName- the name of the data whose externalizable metadata should be removed
-
createSetValueResultInstance
Creates an instance ofSynchronizationResult- Type Parameters:
T- the type of theSynchronizationResult- Returns:
- the created instance of
SynchronizationResult
-
getRepositoryData
Description copied from interface:DataHolderRetrieves the repository data used by thisDataHolder- Specified by:
getRepositoryDatain interfaceDataHolder- Specified by:
getRepositoryDatain interfaceModifiableDataHolder- Overrides:
getRepositoryDatain classDefaultModelAwareDataHolder- Returns:
- the repository data used by this
DataHolder
-
getParentDataHolder
Description copied from interface:DataHolderRetrieves the optional parent of the currentDataHolderThere can be no parent if the currentDataHolderis the root- Specified by:
getParentDataHolderin interfaceDataHolder- Specified by:
getParentDataHolderin interfaceModelAwareDataHolder- Specified by:
getParentDataHolderin interfaceModifiableDataHolder- Specified by:
getParentDataHolderin interfaceModifiableModelAwareDataHolder- Overrides:
getParentDataHolderin classDefaultModelAwareDataHolder- Returns:
- the parent of the current
DataHolder
-
getRootDataHolder
Description copied from interface:DataHolderRetrieves theDataHolderthat is the root of the current one- Specified by:
getRootDataHolderin interfaceDataHolder- Specified by:
getRootDataHolderin interfaceModelAwareDataHolder- Specified by:
getRootDataHolderin interfaceModifiableDataHolder- Specified by:
getRootDataHolderin interfaceModifiableModelAwareDataHolder- Overrides:
getRootDataHolderin classDefaultModelAwareDataHolder- Returns:
- the root
DataHolder
-
checkModifiableDefinition
protected void checkModifiableDefinition(String dataPath, String errorMsg) throws UndefinedItemPathException Check definition for data path, for modification methods- Parameters:
dataPath- the data patherrorMsg- the error message to throw- Throws:
UndefinedItemPathException- if the definition is not found for the given data path or if the definition is not modifiable
-