Interface ModelLessDataAwareAmetysObject
- All Superinterfaces:
AmetysObject,DataAwareAmetysObject,DataHolder,ModelLessDataHolder
- All Known Subinterfaces:
MetadataAwareSitemapElement,ModelLessJCRAmetysObject,ModifiableModelLessDataAwareAmetysObject,ModifiablePage,ModifiableZone,ModifiableZoneItem,Page,Zone,ZoneItem
- All Known Implementing Classes:
AbstractConfigurableVirtualPage,AbstractOdfPage,AbstractProgramItemPage,AbstractSitemapElement,AbstractSurveyElement,Activity,CMISRootResourcesCollection,ConfigurableVirtualZone,ConfigurableVirtualZoneItem,CoursePage,DefaultLink,DefaultPage,DefaultZone,DefaultZoneItem,FirstLevelPage,JCRProjectMember,JCRResourcesCollection,OrgUnitPage,ProgramPage,Project,RedirectPage,SecondLevelPage,Sitemap,StaticZoneItem,Subscription,Survey,SurveyPage,SurveyQuestion,Thesaurus,TransitionalPage,UGCPage,UGCTransitionalPage,UserPage,UserZoneItem
Model less
AmetysObject that can handle data.-
Method Summary
Modifier and TypeMethodDescriptiondataToJSON(DataContext context) Convert the data contained in thisDataHolderdefault voiddataToSAX(ContentHandler contentHandler, DataContext context) Generates SAX events for data contained in thisDataHolderdefault ModelLessCompositegetComposite(String compositePath) Retrieves the composite at the given pathReturns theDataHolderof thisAmetysObject.default ModelItemTypeExtensionPointProvide the ModelItemTypeExtensionPoint linked with the DataHolderdefault Optional<? extends ModelLessDataHolder>Retrieves the optional parent of the currentDataHolderThere can be no parent if the currentDataHolderis the rootdefault ModelLessDataHolderRetrieves theDataHolderthat is the root of the current onedefault RepositoryModelItemTypeRetrieves the type of the data at the given pathdefault <T> TRetrieves the value of the data at the given path The type of the value will be deduced from the stored data.default <T> TRetrieves the value of the data at the given path if exists and is not empty, or the default valuedefault <T> TgetValueOfType(String dataPath, String dataTypeId) Retrieves the value of the data at the given pathdefault <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 valuedefault booleanhasDifferences(Map<String, Object> values) Check if there are differences between the given values and the current onesdefault booleanChecks if there is a non empty value for the data at the given pathdefault booleanChecks if there is a non empty value for the data at the given pathdefault booleanhasValueOrEmpty(String dataPath) Checks if there is a value, even empty, for the data at the given pathdefault booleanisMultiple(String dataPath) Checks if the value of the data at the given path is multipledefault booleanisMultiple(String dataPath, String dataTypeId) Checks if the value of the data at the given path is multipleMethods inherited from interface org.ametys.plugins.repository.AmetysObject
equals, getId, getName, getParent, getParentPath, getPath, hashCodeMethods inherited from interface org.ametys.plugins.repository.data.ametysobject.DataAwareAmetysObject
copyTo, copyTo, dataToJSON, dataToJSON, dataToSAX, dataToSAX, getDataNames, getRepositoryDataMethods inherited from interface org.ametys.plugins.repository.data.holder.ModelLessDataHolder
dataToJSON, dataToSAX
-
Method Details
-
getDataHolder
Description copied from interface:DataAwareAmetysObjectReturns theDataHolderof thisAmetysObject.- Specified by:
getDataHolderin interfaceDataAwareAmetysObject- Returns:
- the
DataHolderof thisAmetysObject
-
getComposite
default ModelLessComposite getComposite(String compositePath) throws IllegalArgumentException, BadItemTypeException, BadDataPathCardinalityException Description copied from interface:DataHolderRetrieves the composite at the given path- Specified by:
getCompositein interfaceDataAwareAmetysObject- Specified by:
getCompositein interfaceDataHolder- Specified by:
getCompositein interfaceModelLessDataHolder- 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 compositeBadDataPathCardinalityException- if the value of a part of the data path is multiple. Only the last part can be multiple
-
hasValue
default boolean hasValue(String dataPath) throws IllegalArgumentException, BadDataPathCardinalityException Description copied from interface:DataHolderChecks if there is a non empty value for the data at the given path- Specified by:
hasValuein interfaceDataAwareAmetysObject- Specified by:
hasValuein interfaceDataHolder- Specified by:
hasValuein interfaceModelLessDataHolder- Parameters:
dataPath- path of the data- Returns:
trueif there is a non empty value for the data,falseotherwise- Throws:
IllegalArgumentException- if the given data path is null or emptyBadDataPathCardinalityException- if the value of a part of the data path is multiple. Only the last part can be multiple
-
hasValue
default boolean hasValue(String dataPath, String dataTypeId) throws IllegalArgumentException, BadDataPathCardinalityException Description copied from interface:ModelLessDataHolderChecks if there is a non empty value for the data at the given path- Specified by:
hasValuein interfaceModelLessDataHolder- Parameters:
dataPath- path of the datadataTypeId- type identifier of the data- Returns:
trueif there is a non empty value for the data,falseotherwise- Throws:
IllegalArgumentException- if the given data path is null or emptyBadDataPathCardinalityException- if the value of a part of the data path is multiple. Only the last part can be multiple
-
hasValueOrEmpty
default boolean hasValueOrEmpty(String dataPath) throws IllegalArgumentException, BadDataPathCardinalityException Description copied from interface:DataHolderChecks if there is a value, even empty, for the data at the given path- Specified by:
hasValueOrEmptyin interfaceDataAwareAmetysObject- Specified by:
hasValueOrEmptyin interfaceDataHolder- Specified by:
hasValueOrEmptyin interfaceModelLessDataHolder- Parameters:
dataPath- path of the data- Returns:
trueif there is value, even empty, for the data,falseotherwise- Throws:
IllegalArgumentException- if the given data path is null or emptyBadDataPathCardinalityException- if the value of a part of the data path is multiple. Only the last part can be multiple
-
getValue
default <T> T getValue(String dataPath) throws IllegalArgumentException, UnknownTypeException, NotUniqueTypeException, BadDataPathCardinalityException Description copied from interface:ModelLessDataHolderRetrieves 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- Specified by:
getValuein interfaceModelLessDataHolder- 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
default <T> T getValue(String dataPath, T defaultValue) throws IllegalArgumentException, UnknownTypeException, NotUniqueTypeException, BadDataPathCardinalityException Description copied from interface:ModelLessDataHolderRetrieves the value of the data at the given path if exists and is not empty, or the default value- Specified by:
getValuein interfaceModelLessDataHolder- 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
default <T> T getValueOfType(String dataPath, String dataTypeId) throws IllegalArgumentException, UnknownTypeException, BadItemTypeException, BadDataPathCardinalityException Description copied from interface:ModelLessDataHolderRetrieves the value of the data at the given path- Specified by:
getValueOfTypein interfaceModelLessDataHolder- 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
default <T> T getValueOfType(String dataPath, String dataTypeId, T defaultValue) throws IllegalArgumentException, UnknownTypeException, BadItemTypeException, BadDataPathCardinalityException Description copied from interface:ModelLessDataHolderRetrieves the value of the data at the given path if exists and is not empty, or the default value- Specified by:
getValueOfTypein interfaceModelLessDataHolder- 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
default boolean isMultiple(String dataPath) throws IllegalArgumentException, UnknownDataException, BadDataPathCardinalityException Description copied from interface:ModelLessDataHolderChecks if the value of the data at the given path is multiple- Specified by:
isMultiplein interfaceModelLessDataHolder- 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 existBadDataPathCardinalityException- if the value of a part of the data path is multiple. Only the last part can be multiple
-
isMultiple
default boolean isMultiple(String dataPath, String dataTypeId) throws IllegalArgumentException, UnknownDataException, BadDataPathCardinalityException Description copied from interface:ModelLessDataHolderChecks if the value of the data at the given path is multiple- Specified by:
isMultiplein interfaceModelLessDataHolder- Parameters:
dataPath- path of the data to checkdataTypeId- type identifier of the data- 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 existBadDataPathCardinalityException- if the value of a part of the data path is multiple. Only the last part can be multiple
-
getType
default RepositoryModelItemType getType(String dataPath) throws IllegalArgumentException, UnknownDataException, UnknownTypeException, NotUniqueTypeException, BadDataPathCardinalityException Description copied from interface:ModelLessDataHolderRetrieves the type of the data at the given path- Specified by:
getTypein interfaceModelLessDataHolder- 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, DataContext context) throws SAXException, UnknownTypeException, NotUniqueTypeException Description copied from interface:ModelLessDataHolderGenerates SAX events for data contained in thisDataHolder- Specified by:
dataToSAXin interfaceModelLessDataHolder- 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 generationUnknownTypeException- 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
-
dataToJSON
default Map<String,Object> dataToJSON(DataContext context) throws UnknownTypeException, NotUniqueTypeException Description copied from interface:ModelLessDataHolderConvert the data contained in thisDataHolder- Specified by:
dataToJSONin interfaceModelLessDataHolder- Parameters:
context- The context of the data to convert- Returns:
- The data of the current
DataHolderas JSON - Throws:
UnknownTypeException- if there is no compatible type with the value to convertNotUniqueTypeException- if there are many compatible types (there is no way to determine which type is the good one) with the value to convert
-
hasDifferences
default boolean hasDifferences(Map<String, Object> values) throws UnknownTypeException, NotUniqueTypeExceptionDescription copied from interface:ModelLessDataHolderCheck if there are differences between the given values and the current ones- Specified by:
hasDifferencesin interfaceModelLessDataHolder- Parameters:
values- the values to check- Returns:
trueif there are differences,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 point
-
getParentDataHolder
Description copied from interface:DataHolderRetrieves the optional parent of the currentDataHolderThere can be no parent if the currentDataHolderis the root- Specified by:
getParentDataHolderin interfaceDataAwareAmetysObject- Specified by:
getParentDataHolderin interfaceDataHolder- Specified by:
getParentDataHolderin interfaceModelLessDataHolder- Returns:
- the parent of the current
DataHolder
-
getRootDataHolder
Description copied from interface:DataHolderRetrieves theDataHolderthat is the root of the current one- Specified by:
getRootDataHolderin interfaceDataAwareAmetysObject- Specified by:
getRootDataHolderin interfaceDataHolder- Specified by:
getRootDataHolderin interfaceModelLessDataHolder- Returns:
- the root
DataHolder
-
getModelItemTypeExtensionPoint
Description copied from interface:ModelLessDataHolderProvide the ModelItemTypeExtensionPoint linked with the DataHolder- Specified by:
getModelItemTypeExtensionPointin interfaceModelLessDataHolder- Returns:
- the extension point
-