Class DefaultModelAwareDataHolder
- java.lang.Object
-
- org.ametys.plugins.repository.data.holder.impl.DefaultModelAwareDataHolder
-
- All Implemented Interfaces:
DataHolder
,ModelAwareDataHolder
- Direct Known Subclasses:
DefaultModifiableModelAwareDataHolder
public class DefaultModelAwareDataHolder extends Object implements ModelAwareDataHolder
Default implementation for data holder with model
-
-
Field Summary
Fields Modifier and Type Field Description protected Collection<? extends ModelItemContainer>
_itemContainers
Model containers to use to get information about definitionsprotected Optional<? extends ModelAwareDataHolder>
_parent
Parent of the currentDataHolder
protected RepositoryData
_repositoryData
Repository data to use to store data in the repositoryprotected ModelAwareDataHolder
_root
RootDataHolder
-
Fields inherited from interface org.ametys.plugins.repository.data.holder.ModelAwareDataHolder
ALTERNATIVE_SUFFIX, COMMENTS_SUFFIX, STATUS_SUFFIX
-
-
Constructor Summary
Constructors Constructor Description DefaultModelAwareDataHolder(RepositoryData repositoryData, Collection<? extends ModelItemContainer> itemContainers)
Creates a default model aware data holderDefaultModelAwareDataHolder(RepositoryData repositoryData, Optional<? extends ModelAwareDataHolder> parent, Optional<? extends ModelAwareDataHolder> root, Collection<? extends ModelItemContainer> itemContainers)
Creates a default model aware data holderDefaultModelAwareDataHolder(RepositoryData repositoryData, Optional<? extends ModelAwareDataHolder> parent, Optional<? extends ModelAwareDataHolder> root, ModelItemContainer... itemContainers)
Creates a default model aware data holderDefaultModelAwareDataHolder(RepositoryData repositoryData, ModelItemContainer... itemContainers)
Creates a default model aware data holder
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
_checkDefinition(String dataPath, String errorMsg)
Check definition for data pathprotected ModelAwareComposite
_getComposite(String name, CompositeDefinition compositeDefinition)
Retrieves the composite with the given nameprotected Class
_getCompositeClass()
Retrieves the class of the managed compositesprotected String
_getFinalDataName(String dataName, Optional<ExternalizableDataProvider.ExternalizableDataStatus> status)
Retrieves the name of the data according to the given statusprotected ModelAwareRepeater
_getRepeater(String name, RepeaterDefinition repeaterDefinition)
Retrieves the repeater with the given nameprotected Class
_getRepeaterClass()
Retrieves the class of the managed repeatersprotected Class
_getRepeaterEntryClass()
Retrieves the class of the managed repeater entriesvoid
dataToSAX(ContentHandler contentHandler, String dataPath, DataContext context)
Generates SAX events for the data at the given data path in the currentDataHolder
Do not generate any event if there is no values at the given pathList<DataComment>
getComments(String dataName)
Retrieve the comments of the data with the given nameModelAwareComposite
getComposite(String compositePath)
Retrieves the composite at the given pathCollection<String>
getDataNames()
Retrieves the names of data contained by this data holder Retrieves only the data at first level, does not check composite dataModelItem
getDefinition(String path)
Retrieves the definition of the data at the given pathModelAwareComposite
getExternalComposite(String compositePath)
Retrieves the external composite at the given pathModelAwareRepeater
getExternalRepeater(String repeaterPath)
Retrieves the external repeater at the given path<T> T
getExternalValue(String dataPath)
Retrieves the external value of the data at the given pathModelAwareComposite
getLocalComposite(String compositePath)
Retrieves the local composite at the given pathModelAwareRepeater
getLocalRepeater(String repeaterPath)
Retrieves the local repeater at the given path<T> T
getLocalValue(String dataPath)
Retrieves the local value of the data at the given pathCollection<? extends ModelItemContainer>
getModel()
Retrieves the data holder's modelOptional<? extends ModelAwareDataHolder>
getParentDataHolder()
Retrieves the optional parent of the currentDataHolder
There can be no parent if the currentDataHolder
is the rootModelAwareRepeater
getRepeater(String repeaterPath)
Retrieves the repeater at the given pathRepositoryData
getRepositoryData()
Retrieves the repository data used by thisDataHolder
ModelAwareDataHolder
getRootDataHolder()
Retrieves theDataHolder
that is the root of the current oneExternalizableDataProvider.ExternalizableDataStatus
getStatus(String dataPath)
Retrieves the status of the externalizable data at the given path Warning: This method won't check that your data is externalizable.<T> T
getValue(String dataPath, boolean allowMultiValuedPathSegments)
Retrieves the value of the data at the given path<T> T
getValue(String dataPath, boolean useDefaultFromModel, T defaultValue)
Retrieves the value of the data at the given path, or the default value The returned value is one of those ones, in the order: The value of the data if exists and is not empty The default value from the model if useDefaultFromModel istrue
and there is a default value defined by the model The given default valueboolean
hasComments(String dataName)
Checks if there is are comments on the data with the given nameboolean
hasDefinition(String path)
Checks if there is a definition at the given pathboolean
hasExternalValue(String dataPath)
Checks if there is a non empty external value for the data at the given pathboolean
hasExternalValueOrEmpty(String dataPath)
Checks if there is an external value for the data at the given pathboolean
hasLocalValue(String dataPath)
Checks if there is a non empty local value for the data at the given pathboolean
hasLocalValueOrEmpty(String dataPath)
Checks if there is a local value for the data at the given pathboolean
hasValue(String dataPath)
Checks if there is a non empty value for the data at the given pathboolean
hasValueOrEmpty(String dataPath)
Checks if there is a value, even empty, for the data at the given path-
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
-
Methods inherited from interface org.ametys.plugins.repository.data.holder.ModelAwareDataHolder
commentsToSAX, dataToMap, dataToMap, dataToMap, dataToMap, dataToSAX, dataToSAX, dataToSAX, dataToSAX, dataToSAXForEdition, getType, getValue, isMultiple
-
-
-
-
Field Detail
-
_repositoryData
protected RepositoryData _repositoryData
Repository data to use to store data in the repository
-
_parent
protected Optional<? extends ModelAwareDataHolder> _parent
Parent of the currentDataHolder
-
_root
protected ModelAwareDataHolder _root
RootDataHolder
-
_itemContainers
protected Collection<? extends ModelItemContainer> _itemContainers
Model containers to use to get information about definitions
-
-
Constructor Detail
-
DefaultModelAwareDataHolder
public DefaultModelAwareDataHolder(RepositoryData repositoryData, ModelItemContainer... itemContainers)
Creates a 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.
-
DefaultModelAwareDataHolder
public DefaultModelAwareDataHolder(RepositoryData repositoryData, Collection<? extends ModelItemContainer> itemContainers)
Creates a 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.
-
DefaultModelAwareDataHolder
public DefaultModelAwareDataHolder(RepositoryData repositoryData, Optional<? extends ModelAwareDataHolder> parent, Optional<? extends ModelAwareDataHolder> root, ModelItemContainer... itemContainers)
Creates a default model aware data holder- Parameters:
repositoryData
- the repository data to useparent
- the optional parent of the createdDataHolder
, empty if the createdDataHolder
is the rootDataHolder
root
- the rootDataAwareAmetysObject
itemContainers
- 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.
-
DefaultModelAwareDataHolder
public DefaultModelAwareDataHolder(RepositoryData repositoryData, Optional<? extends ModelAwareDataHolder> parent, Optional<? extends ModelAwareDataHolder> root, Collection<? extends ModelItemContainer> itemContainers)
Creates a default model aware data holder- Parameters:
repositoryData
- the repository data to useparent
- the parent of the createdDataHolder
, empty if the createdDataHolder
is the rootDataHolder
root
- the rootDataAwareAmetysObject
itemContainers
- 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.
-
-
Method Detail
-
getComposite
public ModelAwareComposite getComposite(String compositePath) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
Description copied from interface:ModelAwareDataHolder
Retrieves the composite at the given path- Specified by:
getComposite
in interfaceDataHolder
- Specified by:
getComposite
in interfaceModelAwareDataHolder
- 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 emptyUndefinedItemPathException
- if the given composite path is not defined by the modelBadItemTypeException
- if the stored value at the given path is not a compositeBadDataPathCardinalityException
- if the definition of a part of the data path is multiple. Only the last part can be multiple
-
getLocalComposite
public ModelAwareComposite getLocalComposite(String compositePath) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
Description copied from interface:ModelAwareDataHolder
Retrieves the local composite at the given path- Specified by:
getLocalComposite
in interfaceModelAwareDataHolder
- Parameters:
compositePath
- path of the externalizable composite to retrieve- Returns:
- the composite or
null
if not exists or is empty - Throws:
IllegalArgumentException
- if the given composite path is null or emptyUndefinedItemPathException
- if the given composite path is not defined by the modelBadItemTypeException
- if the stored value at the given path is not a compositeBadDataPathCardinalityException
- if the definition of a part of the data path is multiple. Only the last part can be multiple
-
getExternalComposite
public ModelAwareComposite getExternalComposite(String compositePath) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
Description copied from interface:ModelAwareDataHolder
Retrieves the external composite at the given path- Specified by:
getExternalComposite
in interfaceModelAwareDataHolder
- Parameters:
compositePath
- path of the externalizable composite to retrieve- Returns:
- the composite or
null
if not exists or is empty - Throws:
IllegalArgumentException
- if the given composite path is null or emptyUndefinedItemPathException
- if the given composite path is not defined by the modelBadItemTypeException
- if the stored value at the given path is not a compositeBadDataPathCardinalityException
- if the definition of a part of the data path is multiple. Only the last part can be multiple
-
getRepeater
public ModelAwareRepeater getRepeater(String repeaterPath) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
Description copied from interface:ModelAwareDataHolder
Retrieves the repeater at the given path- Specified by:
getRepeater
in interfaceModelAwareDataHolder
- Parameters:
repeaterPath
- path of the repeater to retrieve- Returns:
- the repeater or
null
if not exists or is empty - Throws:
IllegalArgumentException
- if the given repeater path is null or emptyUndefinedItemPathException
- if the given repeater path is not defined by the modelBadItemTypeException
- if the stored value at the given path is not a repeaterBadDataPathCardinalityException
- if the definition of a part of the data path is multiple. Only the last part can be multiple
-
getLocalRepeater
public ModelAwareRepeater getLocalRepeater(String repeaterPath) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
Description copied from interface:ModelAwareDataHolder
Retrieves the local repeater at the given path- Specified by:
getLocalRepeater
in interfaceModelAwareDataHolder
- Parameters:
repeaterPath
- path of the externalizable repeater to retrieve- Returns:
- the repeater or
null
if not exists or is empty - Throws:
IllegalArgumentException
- if the given repeater path is null or emptyUndefinedItemPathException
- if the given repeater path is not defined by the modelBadItemTypeException
- if the stored value at the given path is not a repeaterBadDataPathCardinalityException
- if the definition of a part of the data path is multiple. Only the last part can be multiple
-
getExternalRepeater
public ModelAwareRepeater getExternalRepeater(String repeaterPath) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
Description copied from interface:ModelAwareDataHolder
Retrieves the external repeater at the given path- Specified by:
getExternalRepeater
in interfaceModelAwareDataHolder
- Parameters:
repeaterPath
- path of the externalizable repeater to retrieve- Returns:
- the repeater or
null
if not exists or is empty - Throws:
IllegalArgumentException
- if the given repeater path is null or emptyUndefinedItemPathException
- if the given repeater path is not defined by the modelBadItemTypeException
- if the stored value at the given path is not a repeaterBadDataPathCardinalityException
- if the definition of a part of the data path is multiple. Only the last part can be multiple
-
getValue
public <T> T getValue(String dataPath, boolean allowMultiValuedPathSegments) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
Description copied from interface:ModelAwareDataHolder
Retrieves the value of the data at the given path- Specified by:
getValue
in interfaceModelAwareDataHolder
- Type Parameters:
T
- type of the value to retrieve- Parameters:
dataPath
- path of the dataallowMultiValuedPathSegments
-true
to allow multi-valued segments in the path (not necessarily at the last segment),false
otherwise. Iftrue
, if there is no indicated entry for a repeater, the values of all the entries are retrieved Iftrue
and if there are multiple values, all data are retrieved in one array- Returns:
- the value of the data or
null
if allowMultiValuedPathSegments isfalse
and there is no non empty value. The object returned may be of a generic class defined by the storage (if the model is unknown). For example, an url may be returned as a String. - Throws:
IllegalArgumentException
- if the given data path is null or emptyUndefinedItemPathException
- if the given data path is not defined by the modelBadItemTypeException
- if the type defined by the model doesn't match the type of the stored valueBadDataPathCardinalityException
- if the managesMultiples boolean isfalse
and the definition of a part of the data path is multiple. Only the last part can be multiple
-
getLocalValue
public <T> T getLocalValue(String dataPath) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
Description copied from interface:ModelAwareDataHolder
Retrieves the local value of the data at the given path- Specified by:
getLocalValue
in interfaceModelAwareDataHolder
- Type Parameters:
T
- type of the value to retrieve- Parameters:
dataPath
- path of the externalizable data- Returns:
- the local value of the data or
null
if not exists or is empty. The object returned may be of a generic class defined by the storage (if the model is unknown). For example, an url may be returned as a String. - Throws:
IllegalArgumentException
- if the given data path is null or emptyUndefinedItemPathException
- if the given data path is not defined by the modelBadItemTypeException
- if the type defined by the model doesn't match the type of the stored valueBadDataPathCardinalityException
- if the definition of a part of the data path is multiple. Only the last part can be multiple
-
getExternalValue
public <T> T getExternalValue(String dataPath) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
Description copied from interface:ModelAwareDataHolder
Retrieves the external value of the data at the given path- Specified by:
getExternalValue
in interfaceModelAwareDataHolder
- Type Parameters:
T
- type of the value to retrieve- Parameters:
dataPath
- path of the externalizable data- Returns:
- the external value of the data or
null
if not exists or is empty. The object returned may be of a generic class defined by the storage (if the model is unknown). For example, an url may be returned as a String. - Throws:
IllegalArgumentException
- if the given data path is null or emptyUndefinedItemPathException
- if the given data path is not defined by the modelBadItemTypeException
- if the type defined by the model doesn't match the type of the stored valueBadDataPathCardinalityException
- if the definition of a part of the data path is multiple. Only the last part can be multiple
-
getStatus
public ExternalizableDataProvider.ExternalizableDataStatus getStatus(String dataPath) throws IllegalArgumentException, UndefinedItemPathException, BadDataPathCardinalityException
Description copied from interface:ModelAwareDataHolder
Retrieves the status of the externalizable data at the given path Warning: This method won't check that your data is externalizable. But there is no sense to call it with a non externalizable data- Specified by:
getStatus
in interfaceModelAwareDataHolder
- Parameters:
dataPath
- path of the externalizable data- Returns:
- the status of the externalizable data at the given path
- Throws:
IllegalArgumentException
- if the given data path is null or emptyUndefinedItemPathException
- 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
-
_getRepeaterEntryClass
protected Class _getRepeaterEntryClass()
Retrieves the class of the managed repeater entries- Returns:
- the class of the managed repeater entries
-
_getRepeaterClass
protected Class _getRepeaterClass()
Retrieves the class of the managed repeaters- Returns:
- the class of the managed repeaters
-
_getCompositeClass
protected Class _getCompositeClass()
Retrieves the class of the managed composites- Returns:
- the class of the managed composites
-
getValue
public <T> T getValue(String dataPath, boolean useDefaultFromModel, T defaultValue) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
Description copied from interface:ModelAwareDataHolder
Retrieves the value of the data at the given path, or the default value The returned value is one of those ones, in the order:- The value of the data if exists and is not empty
- The default value from the model if useDefaultFromModel is
true
and there is a default value defined by the model - The given default value
- Specified by:
getValue
in interfaceModelAwareDataHolder
- Type Parameters:
T
- type of the value to retrieve- Parameters:
dataPath
- path of the datauseDefaultFromModel
- true to use the default value from the model, false to use the given default valuedefaultValue
- default value used if value is null and useDefaultFromModel is false, or if there is no default value on model- Returns:
- the value of the data at the given path
- Throws:
IllegalArgumentException
- if the given data path is null or emptyUndefinedItemPathException
- if the given data path is not defined by the modelBadItemTypeException
- if the type defined by the model doesn't match the type of the stored valueBadDataPathCardinalityException
- if the definition of a part of the data path is multiple. Only the last part can be multiple
-
_getComposite
protected ModelAwareComposite _getComposite(String name, CompositeDefinition compositeDefinition) throws BadItemTypeException
Retrieves the composite with the given name- 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
protected ModelAwareRepeater _getRepeater(String name, RepeaterDefinition repeaterDefinition) throws BadItemTypeException
Retrieves the repeater with the given name- 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
-
getComments
public List<DataComment> getComments(String dataName) throws IllegalArgumentException, UndefinedItemPathException
Description copied from interface:ModelAwareDataHolder
Retrieve the comments of the data with the given name- Specified by:
getComments
in interfaceModelAwareDataHolder
- Parameters:
dataName
- name of the data- Returns:
- the comments of the data
- Throws:
IllegalArgumentException
- if the given data name is null or emptyUndefinedItemPathException
- if the given data name is not defined by the model
-
hasValue
public boolean hasValue(String dataPath) throws IllegalArgumentException, BadDataPathCardinalityException
Description copied from interface:ModelAwareDataHolder
Checks if there is a non empty value for the data at the given path- Specified by:
hasValue
in interfaceDataHolder
- Specified by:
hasValue
in interfaceModelAwareDataHolder
- Parameters:
dataPath
- path of the data- Returns:
true
if the data at the given path is defined by the model, if there is a non empty value for the data and if the type of this value matches the type of the definition.false
otherwise- Throws:
IllegalArgumentException
- if the given data path is null or emptyBadDataPathCardinalityException
- if the definition of a part of the data path is multiple. Only the last part can be multiple
-
hasLocalValue
public boolean hasLocalValue(String dataPath) throws IllegalArgumentException, BadDataPathCardinalityException
Description copied from interface:ModelAwareDataHolder
Checks if there is a non empty local value for the data at the given path- Specified by:
hasLocalValue
in interfaceModelAwareDataHolder
- Parameters:
dataPath
- path of the externalizable data- Returns:
true
if the data at the given path is defined by the model, if there is a non empty local value for the data and if the type of this value matches the type of the definition.false
otherwise- Throws:
IllegalArgumentException
- if the given data path is null or emptyBadDataPathCardinalityException
- if the definition of a part of the data path is multiple. Only the last part can be multiple
-
hasExternalValue
public boolean hasExternalValue(String dataPath) throws IllegalArgumentException, BadDataPathCardinalityException
Description copied from interface:ModelAwareDataHolder
Checks if there is a non empty external value for the data at the given path- Specified by:
hasExternalValue
in interfaceModelAwareDataHolder
- Parameters:
dataPath
- path of the externalizable data- Returns:
true
if the data at the given path is defined by the model, if there is a non empty external value for the data and if the type of this value matches the type of the definition.false
otherwise- Throws:
IllegalArgumentException
- if the given data path is null or emptyBadDataPathCardinalityException
- if the definition of a part of the data path is multiple. Only the last part can be multiple
-
hasValueOrEmpty
public boolean hasValueOrEmpty(String dataPath) throws IllegalArgumentException, BadDataPathCardinalityException
Description copied from interface:ModelAwareDataHolder
Checks if there is a value, even empty, for the data at the given path- Specified by:
hasValueOrEmpty
in interfaceDataHolder
- Specified by:
hasValueOrEmpty
in interfaceModelAwareDataHolder
- Parameters:
dataPath
- path of the data- Returns:
true
if the data at the given path is defined by the model, if there is a value for the data, even empty, and if the type of this value matches the type of the definition.false
otherwise- Throws:
IllegalArgumentException
- if the given data path is null or emptyBadDataPathCardinalityException
- if the definition of a part of the data path is multiple. Only the last part can be multiple
-
hasLocalValueOrEmpty
public boolean hasLocalValueOrEmpty(String dataPath) throws IllegalArgumentException, BadDataPathCardinalityException
Description copied from interface:ModelAwareDataHolder
Checks if there is a local value for the data at the given path- Specified by:
hasLocalValueOrEmpty
in interfaceModelAwareDataHolder
- Parameters:
dataPath
- path of the externalizable data- Returns:
true
if the data at the given path is defined by the model, if there is a local value for the data, even empty, and if the type of this value matches the type of the definition.false
otherwise- Throws:
IllegalArgumentException
- if the given data path is null or emptyBadDataPathCardinalityException
- if the definition of a part of the data path is multiple. Only the last part can be multiple
-
hasExternalValueOrEmpty
public boolean hasExternalValueOrEmpty(String dataPath) throws IllegalArgumentException, BadDataPathCardinalityException
Description copied from interface:ModelAwareDataHolder
Checks if there is an external value for the data at the given path- Specified by:
hasExternalValueOrEmpty
in interfaceModelAwareDataHolder
- Parameters:
dataPath
- path of the externalizable data- Returns:
true
if the data at the given path is defined by the model, if there is an external value for the data, even empty, and if the type of this value matches the type of the definition.false
otherwise- Throws:
IllegalArgumentException
- if the given data path is null or emptyBadDataPathCardinalityException
- if the definition of a part of the data path is multiple. Only the last part can be multiple
-
_getFinalDataName
protected String _getFinalDataName(String dataName, Optional<ExternalizableDataProvider.ExternalizableDataStatus> status)
Retrieves the name of the data according to the given status- Parameters:
dataName
- the name of the datastatus
- the status- Returns:
- the final name of the data
-
hasComments
public boolean hasComments(String dataName) throws IllegalArgumentException, UndefinedItemPathException
Description copied from interface:ModelAwareDataHolder
Checks if there is are comments on the data with the given name- Specified by:
hasComments
in interfaceModelAwareDataHolder
- Parameters:
dataName
- name of the data- Returns:
true
if there are comments on the data,false
otherwise- Throws:
IllegalArgumentException
- if the given data name is null or emptyUndefinedItemPathException
- if the given data name is not defined by the model
-
getModel
public Collection<? extends ModelItemContainer> getModel()
Description copied from interface:ModelAwareDataHolder
Retrieves the data holder's model- Specified by:
getModel
in interfaceModelAwareDataHolder
- Returns:
- the data holder's model
-
getDefinition
public ModelItem getDefinition(String path) throws IllegalArgumentException, UndefinedItemPathException
Description copied from interface:ModelAwareDataHolder
Retrieves the definition of the data at the given path- Specified by:
getDefinition
in interfaceModelAwareDataHolder
- Parameters:
path
- path of the data. No matter if it is a definition or data path (with repeater entry positions)- Returns:
- the definition of the data
- Throws:
IllegalArgumentException
- if the given path is null or emptyUndefinedItemPathException
- if the given path is not defined by the model
-
hasDefinition
public boolean hasDefinition(String path) throws IllegalArgumentException
Description copied from interface:ModelAwareDataHolder
Checks if there is a definition at the given path- Specified by:
hasDefinition
in interfaceModelAwareDataHolder
- Parameters:
path
- path of the data. No matter if it is a definition or data path (with repeater entry positions)- Returns:
true
if there is definition at the given path,false
otherwise- Throws:
IllegalArgumentException
- if the given path is null or empty
-
dataToSAX
public void dataToSAX(ContentHandler contentHandler, String dataPath, DataContext context) throws SAXException
Description copied from interface:DataHolder
Generates SAX events for the data at the given data path in the currentDataHolder
Do not generate any event if there is no values at the given path- Specified by:
dataToSAX
in interfaceDataHolder
- Parameters:
contentHandler
- theContentHandler
that will receive the SAX eventsdataPath
- the path of the data to SAXcontext
- The context of the data to SAX- Throws:
SAXException
- if an error occurs during the SAX events generation
-
getDataNames
public Collection<String> getDataNames()
Description copied from interface:ModelAwareDataHolder
Retrieves the names of data contained by this data holder Retrieves only the data at first level, does not check composite data- Specified by:
getDataNames
in interfaceDataHolder
- Specified by:
getDataNames
in interfaceModelAwareDataHolder
- Returns:
- the names of the data contained by this data holder and that are defined by the model
-
getRepositoryData
public RepositoryData getRepositoryData()
Description copied from interface:DataHolder
Retrieves the repository data used by thisDataHolder
- Specified by:
getRepositoryData
in interfaceDataHolder
- Returns:
- the repository data used by this
DataHolder
-
getParentDataHolder
public Optional<? extends ModelAwareDataHolder> getParentDataHolder()
Description copied from interface:DataHolder
Retrieves the optional parent of the currentDataHolder
There can be no parent if the currentDataHolder
is the root- Specified by:
getParentDataHolder
in interfaceDataHolder
- Specified by:
getParentDataHolder
in interfaceModelAwareDataHolder
- Returns:
- the parent of the current
DataHolder
-
getRootDataHolder
public ModelAwareDataHolder getRootDataHolder()
Description copied from interface:DataHolder
Retrieves theDataHolder
that is the root of the current one- Specified by:
getRootDataHolder
in interfaceDataHolder
- Specified by:
getRootDataHolder
in interfaceModelAwareDataHolder
- Returns:
- the root
DataHolder
-
_checkDefinition
protected void _checkDefinition(String dataPath, String errorMsg)
Check definition for data path- Parameters:
dataPath
- the data patherrorMsg
- the error message to throw
-
-