Class DefaultModifiableModelLessDataHolder
- java.lang.Object
-
- org.ametys.plugins.repository.data.holder.impl.DefaultModelLessDataHolder
-
- org.ametys.plugins.repository.data.holder.impl.DefaultModifiableModelLessDataHolder
-
- All Implemented Interfaces:
DataHolder,ModelLessDataHolder,ModifiableDataHolder,ModifiableModelLessDataHolder
public class DefaultModifiableModelLessDataHolder extends DefaultModelLessDataHolder implements ModifiableModelLessDataHolder
Default implementation for modifiable data holder without model
-
-
Field Summary
Fields Modifier and Type Field Description protected ModifiableRepositoryData_modifiableRepositoryDataRepository data to use to store data in the repository-
Fields inherited from class org.ametys.plugins.repository.data.holder.impl.DefaultModelLessDataHolder
_repositoryData, _typeExtensionPoint
-
-
Constructor Summary
Constructors Constructor Description DefaultModifiableModelLessDataHolder(AbstractThreadSafeComponentExtensionPoint<RepositoryModelItemType> typeExtensionPoint, ModifiableRepositoryData repositoryData)Creates a modifiable default model free data holder
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ModelLessComposite_getComposite(String name)Retrieves the composite with the given nameprotected ModifiableModelLessComposite_getComposite(String name, boolean createNew)Retrieves the composite with the given nameprotected static ModifiableModelLessDataHolder_getParentValue(ModifiableModelLessDataHolder modifiableDataHolder, String dataPath)Retrieves the modifiable data holder, last parent segment of the given data path Example : call this method with a path like 'my-composite1/my-composite2/my-data' will retrieve the composite 'my-composite2' in the composite 'my-composite1'ModifiableModelLessCompositegetComposite(String compositePath)Retrieves the composite at the given pathModifiableModelLessCompositegetComposite(String compositePath, boolean createNew)Retrieves the composite at the given pathModifiableRepositoryDatagetRepositoryData()Retrieves the repository data used by thisDataHoldervoidremoveValue(String dataPath)Removes the stored value of the data at the given pathvoidsetValue(String dataPath, Object value)Sets the value of the data at the given pathvoidsetValue(String dataPath, Object value, String dataTypeId)Sets the value of the data at the given pathbooleansynchronizeValues(Map<String,Object> values)Synchronizes the given values with the current ones-
Methods inherited from class org.ametys.plugins.repository.data.holder.impl.DefaultModelLessDataHolder
_getParentValue, _hasNonEmptyValue, dataToSAX, dataToSAX, getDataNames, getType, getValue, getValue, getValueOfType, getValueOfType, hasValue, isMultiple
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.ametys.plugins.repository.data.holder.DataHolder
copyTo, dataToSAX, dataToSAX, getDataNames
-
Methods inherited from interface org.ametys.plugins.repository.data.holder.ModelLessDataHolder
dataToSAX, dataToSAX, getType, getValue, getValue, getValueOfType, getValueOfType, hasValue, isMultiple
-
-
-
-
Field Detail
-
_modifiableRepositoryData
protected ModifiableRepositoryData _modifiableRepositoryData
Repository data to use to store data in the repository
-
-
Constructor Detail
-
DefaultModifiableModelLessDataHolder
public DefaultModifiableModelLessDataHolder(AbstractThreadSafeComponentExtensionPoint<RepositoryModelItemType> typeExtensionPoint, ModifiableRepositoryData repositoryData)
Creates a modifiable default model free data holder- Parameters:
typeExtensionPoint- the extension point to use to get available element typesrepositoryData- the repository data to use
-
-
Method Detail
-
getComposite
public ModifiableModelLessComposite getComposite(String compositePath) throws IllegalArgumentException, BadItemTypeException
Description copied from interface:ModelLessDataHolderRetrieves the composite at the given path- Specified by:
getCompositein interfaceDataHolder- Specified by:
getCompositein interfaceModelLessDataHolder- Specified by:
getCompositein interfaceModifiableDataHolder- Specified by:
getCompositein interfaceModifiableModelLessDataHolder- Overrides:
getCompositein classDefaultModelLessDataHolder- 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 composite
-
_getComposite
protected ModelLessComposite _getComposite(String name) throws BadItemTypeException
Description copied from class:DefaultModelLessDataHolderRetrieves the composite with the given name- Overrides:
_getCompositein classDefaultModelLessDataHolder- Parameters:
name- name 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
-
getComposite
public ModifiableModelLessComposite getComposite(String compositePath, boolean createNew) throws IllegalArgumentException, BadItemTypeException
Description copied from interface:ModifiableModelLessDataHolderRetrieves the composite at the given path- Specified by:
getCompositein interfaceModifiableDataHolder- Specified by:
getCompositein interfaceModifiableModelLessDataHolder- 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 composite
-
_getComposite
protected ModifiableModelLessComposite _getComposite(String name, boolean createNew) throws BadItemTypeException
Retrieves the composite with the given name- Parameters:
name- name of the composite to retrievecreateNew-trueto create the composite 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
-
synchronizeValues
public boolean synchronizeValues(Map<String,Object> values) throws UnknownTypeException, NotUniqueTypeException, IOException
Description copied from interface:ModifiableModelLessDataHolderSynchronizes the given values with the current ones- Specified by:
synchronizeValuesin interfaceModifiableModelLessDataHolder- Parameters:
values- the values to synchronize- Returns:
trueif some values have changed,falseotherwise- Throws:
UnknownTypeException- if there is no available type compatible with a given value for this data holder's type extension pointNotUniqueTypeException- if there is more than one available types compatibles with the a value for this data holder's type extension pointIOException- if an error occurs while synchronizing I/O data
-
setValue
public void setValue(String dataPath, Object value) throws IllegalArgumentException, UnknownTypeException, NotUniqueTypeException, UnknownDataException
Description copied from interface:ModifiableModelLessDataHolderSets the value of the data at the given path- Specified by:
setValuein interfaceModifiableModelLessDataHolder- Parameters:
dataPath- path of the datavalue- the value to set. To empty a value, useModifiableModelLessDataHolder.setValue(String, Object, String)with anullvalue- Throws:
IllegalArgumentException- if the given data path is null or emptyUnknownTypeException- if there is no available type compatible with the given value for this data holder's type extension pointNotUniqueTypeException- if there is more than one available types compatibles with the given value for this data holder's type extension pointUnknownDataException- if given the data path is composed of an inexisting group
-
setValue
public void setValue(String dataPath, Object value, String dataTypeId) throws IllegalArgumentException, BadItemTypeException, UnknownDataException
Description copied from interface:ModifiableModelLessDataHolderSets the value of the data at the given path- Specified by:
setValuein interfaceModifiableModelLessDataHolder- Parameters:
dataPath- path of the datavalue- the value to set. Givenullto empty the value.dataTypeId- type identifier of the data- Throws:
IllegalArgumentException- if the given data path is null or emptyBadItemTypeException- if the given type doesn't match the given value to setUnknownDataException- if the given data path is composed of an inexisting group
-
removeValue
public void removeValue(String dataPath) throws IllegalArgumentException, UnknownDataException, BadItemTypeException
Description copied from interface:ModifiableModelLessDataHolderRemoves the stored value of the data at the given path- Specified by:
removeValuein interfaceModifiableDataHolder- Specified by:
removeValuein interfaceModifiableModelLessDataHolder- Parameters:
dataPath- path of the data- Throws:
IllegalArgumentException- if the given data path is null or emptyUnknownDataException- if the value at the given data path does not existBadItemTypeException- if the value of the parent of the given path is not an item container
-
_getParentValue
protected static ModifiableModelLessDataHolder _getParentValue(ModifiableModelLessDataHolder modifiableDataHolder, String dataPath) throws BadDataPathCardinalityException, BadItemTypeException
Retrieves the modifiable data holder, last parent segment of the given data path Example : call this method with a path like 'my-composite1/my-composite2/my-data' will retrieve the composite 'my-composite2' in the composite 'my-composite1'- Parameters:
modifiableDataHolder- the modifiable data holderdataPath- the data path- Returns:
- the parent data holder
- Throws:
BadDataPathCardinalityException- if the value of a part of the data path is multiple. Only the last part can be multipleBadItemTypeException- if the value at the given data path is not a composite
-
getRepositoryData
public ModifiableRepositoryData getRepositoryData()
Description copied from interface:DataHolderRetrieves the repository data used by thisDataHolder- Specified by:
getRepositoryDatain interfaceDataHolder- Specified by:
getRepositoryDatain interfaceModifiableDataHolder- Overrides:
getRepositoryDatain classDefaultModelLessDataHolder- Returns:
- the repository data used by this
DataHolder
-
-