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
_modifiableRepositoryData
Repository 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'ModifiableModelLessComposite
getComposite(String compositePath)
Retrieves the composite at the given pathModifiableModelLessComposite
getComposite(String compositePath, boolean createNew)
Retrieves the composite at the given pathModifiableRepositoryData
getRepositoryData()
Retrieves the repository data used by thisDataHolder
void
removeValue(String dataPath)
Removes the stored value of the data at the given pathvoid
setValue(String dataPath, Object value)
Sets the value of the data at the given pathvoid
setValue(String dataPath, Object value, String dataTypeId)
Sets the value of the data at the given pathboolean
synchronizeValues(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:ModelLessDataHolder
Retrieves the composite at the given path- Specified by:
getComposite
in interfaceDataHolder
- Specified by:
getComposite
in interfaceModelLessDataHolder
- Specified by:
getComposite
in interfaceModifiableDataHolder
- Specified by:
getComposite
in interfaceModifiableModelLessDataHolder
- Overrides:
getComposite
in classDefaultModelLessDataHolder
- Parameters:
compositePath
- path of the composite to retrieve- Returns:
- the composite or
null
if 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:DefaultModelLessDataHolder
Retrieves the composite with the given name- Overrides:
_getComposite
in 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:ModifiableModelLessDataHolder
Retrieves the composite at the given path- Specified by:
getComposite
in interfaceModifiableDataHolder
- Specified by:
getComposite
in interfaceModifiableModelLessDataHolder
- Parameters:
compositePath
- path of the composite to retrievecreateNew
-true
to create the composite if it does not exist,false
otherwise- Returns:
- the composite or
null
if createNew isfalse
and 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
-true
to create the composite if it does not exist,false
otherwise- 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:ModifiableModelLessDataHolder
Synchronizes the given values with the current ones- Specified by:
synchronizeValues
in interfaceModifiableModelLessDataHolder
- Parameters:
values
- the values to synchronize- Returns:
true
if some values have changed,false
otherwise- 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:ModifiableModelLessDataHolder
Sets the value of the data at the given path- Specified by:
setValue
in interfaceModifiableModelLessDataHolder
- Parameters:
dataPath
- path of the datavalue
- the value to set. To empty a value, useModifiableModelLessDataHolder.setValue(String, Object, String)
with anull
value- 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:ModifiableModelLessDataHolder
Sets the value of the data at the given path- Specified by:
setValue
in interfaceModifiableModelLessDataHolder
- Parameters:
dataPath
- path of the datavalue
- the value to set. Givenull
to 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:ModifiableModelLessDataHolder
Removes the stored value of the data at the given path- Specified by:
removeValue
in interfaceModifiableDataHolder
- Specified by:
removeValue
in 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:DataHolder
Retrieves the repository data used by thisDataHolder
- Specified by:
getRepositoryData
in interfaceDataHolder
- Specified by:
getRepositoryData
in interfaceModifiableDataHolder
- Overrides:
getRepositoryData
in classDefaultModelLessDataHolder
- Returns:
- the repository data used by this
DataHolder
-
-