Interface ModelLessDataHolder
-
- All Superinterfaces:
DataHolder
- All Known Subinterfaces:
MetadataAwarePagesContainer,ModelLessDataAwareAmetysObject,ModelLessJCRAmetysObject,ModifiableModelLessDataAwareAmetysObject,ModifiableModelLessDataHolder,ModifiablePage,ModifiableZone,ModifiableZoneItem,Page,Zone,ZoneItem
- All Known Implementing Classes:
AbstractBlogPage,AbstractLevelPage,AbstractOdfPage,AbstractSurveyElement,CoursePage,CourseZone,CourseZoneItem,DefaultLink,DefaultModelLessDataHolder,DefaultModifiableModelLessDataHolder,DefaultPage,DefaultZone,DefaultZoneItem,FirstLevelPage,FirstLevelZone,FirstLevelZoneItem,JCRProjectMember,ModelLessComposite,ModifiableModelLessComposite,OrgUnitPage,OrgUnitZone,OrgUnitZoneItem,PostListZone,PostListZoneItem,PostZone,PostZoneItem,ProgramPage,ProgramZone,ProgramZoneItem,Project,RedirectPage,SecondLevelPage,SecondLevelZone,SecondLevelZoneItem,Sitemap,StaticZone,StaticZoneItem,Survey,SurveyPage,SurveyQuestion,TransitionalPage,TransitionalZone,TransitionalZoneItem,UGCPage,UGCTransitionalPage,UGCTransitionalZone,UGCTransitionalZoneItem,UGCZone,UGCZoneItem,UserPage,UserZone,UserZoneItem,VirtualMonthPage,VirtualPostPage,VirtualPostsPage,VirtualTagPage,VirtualTagsPage,VirtualYearPage,VirtualYearsPage
public interface ModelLessDataHolder extends DataHolder
Interface for data containers without models
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voiddataToSAX(ContentHandler contentHandler)Generates SAX events for data contained in thisDataHoldervoiddataToSAX(ContentHandler contentHandler, DataContext context)Generates SAX events for data contained in thisDataHolderModelLessCompositegetComposite(String compositePath)Retrieves the composite at the given pathOptional<? extends ModelLessDataHolder>getParentDataHolder()Retrieves the optional parent of the currentDataHolderThere can be no parent if the currentDataHolderis the rootModelLessDataHoldergetRootDataHolder()Retrieves theDataHolderthat is the root of the current oneRepositoryModelItemTypegetType(String dataPath)Retrieves the type of the data at the given path<T> TgetValue(String dataPath)Retrieves the value of the data at the given path The type of the value will be deduced from the stored data.<T> TgetValue(String dataPath, T defaultValue)Retrieves the value of the data at the given path if exists and is not empty, or the default value<T> TgetValueOfType(String dataPath, String dataTypeId)Retrieves the value of the data at the given path<T> TgetValueOfType(String dataPath, String dataTypeId, T defaultValue)Retrieves the value of the data at the given path if exists and is not empty, or the default valuebooleanhasNonEmptyValue(String dataPath)Checks if there is a non empty value for the data at the given pathbooleanhasValue(String dataPath)Checks if there is a value for the data at the given pathbooleanisMultiple(String dataPath)Checks if the value of the data at the given path is multiple-
Methods inherited from interface org.ametys.plugins.repository.data.holder.DataHolder
copyTo, dataToSAX, dataToSAX, getDataNames, getRepositoryData
-
-
-
-
Method Detail
-
getComposite
ModelLessComposite getComposite(String compositePath) throws IllegalArgumentException, BadItemTypeException, BadDataPathCardinalityException
Retrieves the composite at the given path- Specified by:
getCompositein interfaceDataHolder- Parameters:
compositePath- path of the composite to retrieve- Returns:
- the composite or
nullif not exists or is empty - Throws:
BadDataPathCardinalityException- if the value of a part of the data path is multiple. Only the last part can be multipleIllegalArgumentException- if the given composite path is null or emptyBadItemTypeException- if the stored value at the given path is not a composite
-
hasValue
boolean hasValue(String dataPath) throws IllegalArgumentException, BadDataPathCardinalityException
Checks if there is a value for the data at the given path- Specified by:
hasValuein interfaceDataHolder- Parameters:
dataPath- path of the data- Returns:
trueif there is value (even empty) for the data,falseotherwise- Throws:
BadDataPathCardinalityException- if the value of a part of the data path is multiple. Only the last part can be multipleIllegalArgumentException- if the given data path is null or empty
-
hasNonEmptyValue
boolean hasNonEmptyValue(String dataPath) throws IllegalArgumentException, BadDataPathCardinalityException
Checks if there is a non empty value for the data at the given path- Specified by:
hasNonEmptyValuein interfaceDataHolder- Parameters:
dataPath- path of the data- Returns:
trueif there is a non empty value for the data,falseotherwise- Throws:
BadDataPathCardinalityException- if the value of a part of the data path is multiple. Only the last part can be multipleIllegalArgumentException- if the given data path is null or empty
-
getValue
<T> T getValue(String dataPath) throws IllegalArgumentException, UnknownTypeException, NotUniqueTypeException, BadDataPathCardinalityException
Retrieves the value of the data at the given path The type of the value will be deduced from the stored data. In some cases, the type can be wrong. For example, it is impossible to know if a stored date is a date or a date time- Type Parameters:
T- type of the value to retrieve. Should match the given data type- Parameters:
dataPath- path of the data- Returns:
- the value of the data or
nullif not exists or is empty. The object returned may be of a generic class defined by the storage. For example, an url may be returned as a String. Use the 2 arguments version to ensure to get the right kind of Object. - Throws:
IllegalArgumentException- if the given data path is null or emptyUnknownTypeException- if there is no compatible type with the data at the given data pathNotUniqueTypeException- if there are many compatible types (there is no way to determine which type is the good one)BadDataPathCardinalityException- if the value of a part of the data path is multiple. Only the last part can be multiple
-
getValue
<T> T getValue(String dataPath, T defaultValue) throws IllegalArgumentException, UnknownTypeException, NotUniqueTypeException, BadDataPathCardinalityException
Retrieves the value of the data at the given path if exists and is not empty, or the default value- Type Parameters:
T- type of the value to retrieve. Should match the given data type- Parameters:
dataPath- path of the datadefaultValue- default value- Returns:
- the value of the data,
nullif the data exists but is empty, or the given default value - Throws:
IllegalArgumentException- if the given data path is null or emptyUnknownTypeException- if there is no compatible type with the data at the given data pathNotUniqueTypeException- if there are many compatible types (there is no way to determine which type is the good one)BadDataPathCardinalityException- if the value of a part of the data path is multiple. Only the last part can be multiple
-
getValueOfType
<T> T getValueOfType(String dataPath, String dataTypeId) throws IllegalArgumentException, UnknownTypeException, BadItemTypeException, BadDataPathCardinalityException
Retrieves the value of the data at the given path- Type Parameters:
T- type of the value to retrieve. Should match the given data type- Parameters:
dataPath- path of the datadataTypeId- type identifier of the data- Returns:
- the value of the data or
nullif not exists or is empty - Throws:
IllegalArgumentException- if the given data path is null or emptyUnknownTypeException- if the given type isn't available for this data holder's type extension pointBadItemTypeException- if the given type doesn't match the type of the stored value at the given pathBadDataPathCardinalityException- if the value of a part of the data path is multiple. Only the last part can be multiple
-
getValueOfType
<T> T getValueOfType(String dataPath, String dataTypeId, T defaultValue) throws IllegalArgumentException, UnknownTypeException, BadItemTypeException, BadDataPathCardinalityException
Retrieves the value of the data at the given path if exists and is not empty, or the default value- Type Parameters:
T- type of the value to retrieve. Should match the given data type- Parameters:
dataPath- path of the datadataTypeId- type identifier of the datadefaultValue- default value- Returns:
- the value of the data,
nullif the data exists but is empty, or the given default value - Throws:
IllegalArgumentException- if the given data path is null or emptyUnknownTypeException- if the given type isn't available for this data holder's type extension pointBadItemTypeException- if the given type doesn't match the type of the stored value at the given pathBadDataPathCardinalityException- if the value of a part of the data path is multiple. Only the last part can be multiple
-
isMultiple
boolean isMultiple(String dataPath) throws IllegalArgumentException, UnknownDataException, NotUniqueTypeException, BadDataPathCardinalityException
Checks if the value of the data at the given path is multiple- Parameters:
dataPath- path of the data to check- Returns:
trueif the value of the data is multiple,falseotherwise- Throws:
IllegalArgumentException- if the given data path is null or emptyUnknownDataException- the data at the given path does not existNotUniqueTypeException- if there are many compatible types (there is no way to determine which type is the good one)BadDataPathCardinalityException- if the value of a part of the data path is multiple. Only the last part can be multiple
-
getType
RepositoryModelItemType getType(String dataPath) throws IllegalArgumentException, UnknownDataException, UnknownTypeException, NotUniqueTypeException, BadDataPathCardinalityException
Retrieves the type of the data at the given path- Parameters:
dataPath- path of the data- Returns:
- the type of the data
- Throws:
IllegalArgumentException- if the given data path is null or emptyUnknownDataException- if there is no data stored at the given pathUnknownTypeException- if there is no compatible type with the data at the given data path or if the data is a repeater entry but the composite type is not availableNotUniqueTypeException- if there are many compatible types (there is no way to determine which type is the good one)BadDataPathCardinalityException- if the value of a part of the data path is multiple. Only the last part can be multiple
-
dataToSAX
default void dataToSAX(ContentHandler contentHandler) throws SAXException, IOException, UnknownTypeException, NotUniqueTypeException
Generates SAX events for data contained in thisDataHolder- Parameters:
contentHandler- theContentHandlerthat will receive the SAX events- Throws:
SAXException- if an error occurs during the SAX events generationIOException- if an error occurs while reading a value using the I/O APIUnknownTypeException- if there is no compatible type with the saxed valueNotUniqueTypeException- if there are many compatible types (there is no way to determine which type is the good one) with the saxed value
-
dataToSAX
void dataToSAX(ContentHandler contentHandler, DataContext context) throws SAXException, IOException, UnknownTypeException, NotUniqueTypeException
Generates SAX events for data contained in thisDataHolder- Parameters:
contentHandler- theContentHandlerthat will receive the SAX eventscontext- The context 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 APIUnknownTypeException- if there is no compatible type with the saxed valueNotUniqueTypeException- if there are many compatible types (there is no way to determine which type is the good one) with the saxed value
-
getParentDataHolder
Optional<? extends ModelLessDataHolder> 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- Returns:
- the parent of the current
DataHolder
-
getRootDataHolder
ModelLessDataHolder getRootDataHolder()
Description copied from interface:DataHolderRetrieves theDataHolderthat is the root of the current one- Specified by:
getRootDataHolderin interfaceDataHolder- Returns:
- the root
DataHolder
-
-