Class AbstractComposite
- java.lang.Object
-
- org.ametys.plugins.repository.data.holder.group.impl.AbstractComposite
-
- All Implemented Interfaces:
DataHolder
,Composite
- Direct Known Subclasses:
AbstractRepeaterEntry
,ModelAwareComposite
,ModelLessComposite
public abstract class AbstractComposite extends Object implements Composite
Abstract class for composites
-
-
Field Summary
Fields Modifier and Type Field Description protected RepositoryData
_repositoryData
The repository data of the repeater entry
-
Constructor Summary
Constructors Constructor Description AbstractComposite(RepositoryData repositoryData)
Creates a repeater entry
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
copyTo(ModifiableDataHolder dataHolder)
Copies the currentDataHolder
to the givenModifiableModelAwareDataHolder
.void
dataToSAX(ContentHandler contentHandler, String dataPath)
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 pathCollection<String>
getDataNames()
Retrieves the names of data contained by this data holder Retrieves only the data at first level, does not check composite dataprotected abstract DataHolder
getDefaultDataHolder()
Retrieves the default implementation of aDataHolder
to useRepositoryData
getRepositoryData()
Retrieves the repository data used by thisDataHolder
boolean
hasNonEmptyValue(String dataPath)
Checks if there is a non empty value for the data at the given pathboolean
hasValue(String dataPath)
Checks if there is a value 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
dataToSAX, getComposite, getParentDataHolder, getRootDataHolder
-
-
-
-
Field Detail
-
_repositoryData
protected RepositoryData _repositoryData
The repository data of the repeater entry
-
-
Constructor Detail
-
AbstractComposite
public AbstractComposite(RepositoryData repositoryData)
Creates a repeater entry- Parameters:
repositoryData
- the repository data of the repeater entry
-
-
Method Detail
-
hasValue
public boolean hasValue(String dataPath) throws IllegalArgumentException, BadDataPathCardinalityException
Description copied from interface:DataHolder
Checks if there is a value for the data at the given path- Specified by:
hasValue
in interfaceDataHolder
- Parameters:
dataPath
- path of the data- Returns:
true
if there is value (even empty) for the data,false
otherwise- Throws:
IllegalArgumentException
- if the given data path is null or emptyBadDataPathCardinalityException
-
hasNonEmptyValue
public boolean hasNonEmptyValue(String dataPath) throws IllegalArgumentException
Description copied from interface:DataHolder
Checks if there is a non empty value for the data at the given path- Specified by:
hasNonEmptyValue
in interfaceDataHolder
- Parameters:
dataPath
- path of the data- Returns:
true
if there is a non empty value for the data,false
otherwise- Throws:
IllegalArgumentException
- if the given data path is null or empty
-
getDataNames
public Collection<String> getDataNames()
Description copied from interface:DataHolder
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
- Returns:
- the names of all data contained by this data holder
-
copyTo
public void copyTo(ModifiableDataHolder dataHolder) throws UndefinedItemPathException, BadItemTypeException, UnknownTypeException, NotUniqueTypeException
Description copied from interface:DataHolder
Copies the currentDataHolder
to the givenModifiableModelAwareDataHolder
.- Specified by:
copyTo
in interfaceDataHolder
- Parameters:
dataHolder
- The destination dataHolder. Can not be null.- Throws:
UndefinedItemPathException
- if one of the copied data is not defined by the model of the destinationModifiableModelAwareDataHolder
BadItemTypeException
- if the type defined by the model of the destinationModifiableModelAwareDataHolder
doesn't match the copied valueUnknownTypeException
- if there is no available type compatible with the copied value for the type extension point of the destinationModifiableModelLessDataHolder
NotUniqueTypeException
- if there is more than one available types compatibles with the copied value for the type extension point of the destinationModifiableModelLessDataHolder
-
dataToSAX
public void dataToSAX(ContentHandler contentHandler, String dataPath) throws SAXException, IOException
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 SAX- Throws:
SAXException
- if an error occurs during the SAX events generationIOException
- if an error occurs while reading a value using the I/O API
-
getDefaultDataHolder
protected abstract DataHolder getDefaultDataHolder()
Retrieves the default implementation of aDataHolder
to use- Returns:
- the
DataHolder
-
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
-
-