Interface DataHolder
- All Known Subinterfaces:
ACLAmetysObject,AmetysObject,AttachableAmetysObject,CalendarEvent,CalendarResource,CDMEntity,CommentableAmetysObject<T>,CommentableContent,Composite,Content,ContributorCommentableContent,CopiableAmetysObject,DataAndVersionAwareAmetysObject,DublinCoreAwareAmetysObject,ExplorerNode,IndexableAmetysObject,IndexableComposite,IndexableDataHolder,IndexableJCRAmetysObject,IndexableRepeaterEntry,JCRAmetysObject,JCRTraversableAmetysObject,LockableAmetysObject,LockablePage,LockAwareAmetysObject,MetadataAwareAmetysObject,ModelAwareAmetysObject,ModelAwareComposite,ModelAwareDataHolder,ModelAwareJCRAmetysObject,ModifiableACLAmetysObject,ModifiableAmetysObject,ModifiableCalendarEvent,ModifiableComposite,ModifiableContent,ModifiableDataAwareVersionableAmetysObject,ModifiableDataHolder,ModifiableDublinCoreAwareAmetysObject,ModifiableExplorerNode,ModifiableIndexableAmetysObject,ModifiableIndexableComposite,ModifiableIndexableDataHolder,ModifiableIndexableRepeaterEntry,ModifiableMetadataAwareAmetysObject,ModifiableModelAwareAmetysObject,ModifiableModelAwareComposite,ModifiableModelAwareDataHolder,ModifiablePage,ModifiableRepeaterEntry,ModifiableResource,ModifiableResourceCollection,ModifiableSiteAwareAmetysObject,ModifiableSitemapElement,ModifiableTraversableAmetysObject,ModifiableWebContent,ModifiableWorkflowAwareContent,ModifiableZone,ModifiableZoneItem,MovableAmetysObject,MoveablePage,Page,ProgramItem,ProgramPart,RemovableAmetysObject,RepeaterEntry,Resource,ResourceCollection,SharedContent,SiteAwareAmetysObject,SitemapElement,TagAwareAmetysObject,TaggableAmetysObject,Task,TasksList,Thread,TrashableAmetysObject,TrashElement,TraversableAmetysObject,TraversableProgramPart,VersionableAmetysObject,VersionAwareAmetysObject,WebContent,WorkflowAwareAmetysObject,WorkflowAwareContent,Zone,ZoneItem
- All Known Implementing Classes:
AbstractAmetysObject,AbstractColorableJCRTag,AbstractConfigurableVirtualPage,AbstractOdfPage,AbstractProgram,AbstractProgramItemPage,AbstractProgramPart,AbstractSitemapElement,AbstractSurveyElement,AbstractTraversableProgramPart,Activity,AmetysObjectCollection,CacheContentVersionChunk,Cart,CartContainer,Catalog,CategoryJCR,CMISResource,CMISResourcesCollection,CMISRootResourcesCollection,CMSJCRTag,ConfigurableVirtualZone,ConfigurableVirtualZoneItem,Container,ContentBackupAmetysObject,ContentConsistencyResult,ContentValue,Course,CourseList,CoursePage,CoursePart,DefaultAlias,DefaultAmetysObject,DefaultComposite,DefaultContent,DefaultDataHolder,DefaultDefinition,DefaultIndexableAmetysObject,DefaultIndexableComposite,DefaultIndexableDataHolder,DefaultIndexableRepeaterEntry,DefaultIndexableTraversableAmetysObject,DefaultLink,DefaultLockableAmetysObject,DefaultModelAwareComposite,DefaultModelAwareDataHolder,DefaultModifiableComposite,DefaultModifiableDataHolder,DefaultModifiableIndexableComposite,DefaultModifiableIndexableDataHolder,DefaultModifiableIndexableRepeaterEntry,DefaultModifiableModelAwareComposite,DefaultModifiableModelAwareDataHolder,DefaultModifiableRepeaterEntry,DefaultPage,DefaultRepeaterEntry,DefaultSharedContent,DefaultTheme,DefaultTheme,DefaultTrashElement,DefaultTraversableAmetysObject,DefaultWebContent,DefaultWorkflowAwareContent,DefaultZone,DefaultZoneItem,File,FirstLevelPage,Folder,Form,FormDirectory,FormEntry,FormPage,FormPageRule,FormQuestion,JCRCalendar,JCRCalendarEvent,JCRCalendarResource,JCRCategory,JCRProjectMember,JCRResource,JCRResourcesCollection,JCRTag,JCRTask,JCRTasksList,JCRThread,KeywordJCR,ModifiableContentDataHolder,ModifiableDefaultContent,ModifiableDefaultWebContent,OrgUnit,OrgUnitPage,Person,Program,ProgramPage,Project,ProjectTagJCR,Query,QueryContainer,RedirectPage,RootAmetysObject,SecondLevelPage,SimpleAmetysObject,SimpleIndexableAmetysObject,SimpleModelAwareAmetysObject,Site,Sitemap,StaticZoneItem,SubProgram,Subscription,Survey,SurveyPage,SurveyQuestion,TaskCalendarEvent,ThemeJCR,ThemeJCR,Thesaurus,TransitionalPage,UGCPage,UGCTransitionalPage,UserPage,UserZoneItem,VersionAmetysObject,VersionComponentAmetysObject,VersionsAmetysObject
public interface DataHolder
Interface for data containers
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidcopyTo(ModifiableDataHolder dataHolder) Copies the currentDataHolderto the givenModifiableDataHolder.default voidcopyTo(ModifiableDataHolder dataHolder, DataContext context) Copies the currentDataHolderto the givenModifiableDataHolder.Convert the data contained in thisDataHolderdefault ObjectdataToJSON(String dataPath) Convert the data at the given path into a JSON objectdataToJSON(String dataPath, DataContext context) Convert the data at the given path into a JSON objectdataToJSON(DataContext context) Convert the data contained in thisDataHolderdefault voiddataToSAX(ContentHandler contentHandler) Generates SAX events for data contained in thisDataHolderdefault voiddataToSAX(ContentHandler contentHandler, String dataPath) Generates SAX events for the data at the given data path in the currentDataHolderDo not generate any event if there is no values at the given pathvoiddataToSAX(ContentHandler contentHandler, String dataPath, DataContext context) Generates SAX events for the data at the given data path in the currentDataHolderDo not generate any event if there is no values at the given pathvoiddataToSAX(ContentHandler contentHandler, DataContext context) Generates SAX events for data contained in thisDataHoldergetComposite(String compositePath) Retrieves the composite at the given pathRetrieves the names of data contained by this data holder Retrieves only the data at first level, does not check composite dataProvide the ModelItemTypeExtensionPoint linked with the DataHolderOptional<? extends DataHolder> Retrieves the optional parent of the currentDataHolderThere can be no parent if the currentDataHolderis the rootRetrieves the repository data used by thisDataHolderRetrieves theDataHolderthat is the root of the current one<X extends ModelItemType>
XRetrieves the type of the data at the given path<T> TRetrieves the value of the data at the given path<T> TgetValueOfType(String dataPath, String dataTypeId) Retrieves the value of the data at the given path<T> TgetValueOfTypeOrDefault(String dataPath, String dataTypeId, T defaultValue) Retrieves the value of the data at the given path if exists and is not empty, or the given default value<T> TgetValueOrDefault(String dataPath, T defaultValue) Retrieves the value of the data at the given path if exists and is not empty, or the given default valuebooleanhasDifferences(Map<String, Object> values) Check if there are differences between the given values and the current onesbooleanChecks if there is a non empty value for the data at the given pathbooleanChecks if there is a non empty value for the data at the given pathbooleanhasValueOrEmpty(String dataPath) Checks if there is a value, even empty, for the data at the given pathbooleanisMultiple(String dataPath) Checks if the value of the data at the given path is multiplebooleanisMultiple(String dataPath, String dataTypeId) Checks if the value of the data at the given path is multiple
-
Method Details
-
getComposite
Composite getComposite(String compositePath) throws IllegalArgumentException, UnknownTypeException, BadItemTypeException, UndefinedItemPathException, BadDataPathCardinalityException Retrieves the composite at the given path- 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 emptyUnknownTypeException- if the type composite is not available for this data holderBadItemTypeException- if the stored value at the given path is not a compositeUndefinedItemPathException- if the data holder has a model and the given composite path is not defined by this modelBadDataPathCardinalityException- if the data holder has a model and the definition of a part of the data path is multiple. Only the last part can be multiple
-
hasValue
Checks if there is a non empty value for the data at the given path- Parameters:
dataPath- path of the data- Returns:
trueif there is a non empty value for the data. If the data holder has a model and the data at the given path is defined by the model and the type of this value matches the type of the definition.falseotherwise- Throws:
IllegalArgumentException- if the given data path is null or emptyBadDataPathCardinalityException- if the data holder has a model and the definition of a part of the data path is multiple. Only the last part can be multiple
-
hasValue
boolean hasValue(String dataPath, String dataTypeId) throws IllegalArgumentException, UnknownTypeException, BadDataPathCardinalityException Checks if there is a non empty value for the data at the given path- Parameters:
dataPath- path of the datadataTypeId- type identifier of the data- Returns:
trueif there is a non empty value for the data. If the data holder has a model and the data at the given path is defined by the model and the type of this value matches the type of the definition.falseotherwise- 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 pointBadDataPathCardinalityException- if the data holder has a model and the definition of a part of the data path is multiple. Only the last part can be multiple
-
hasValueOrEmpty
boolean hasValueOrEmpty(String dataPath) throws IllegalArgumentException, BadDataPathCardinalityException Checks if there is a value, even empty, for the data at the given path- Parameters:
dataPath- path of the data- Returns:
trueif there is value, even empty, for the data. If the data holder has a model and the data at the given path is defined by the model and the type of this value matches the type of the definition.falseotherwise- Throws:
IllegalArgumentException- if the given data path is null or emptyBadDataPathCardinalityException- if the data holder has a model and the definition of a part of the data path is multiple. Only the last part can be multiple
-
getDataNames
Retrieves the names of data contained by this data holder Retrieves only the data at first level, does not check composite data- Returns:
- the names of all data contained by this data holder
-
getValue
<T> T getValue(String dataPath) throws IllegalArgumentException, UnknownTypeException, NotUniqueTypeException, BadItemTypeException, UndefinedItemPathException, BadDataPathCardinalityException Retrieves the value of the data at the given path- Type Parameters:
T- type of the value to retrieve. If the data holder has a model, the type of the value is defined by this model. Otherwise, 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- Parameters:
dataPath- path of the data- Returns:
- the value of the data or
nullif not exists or is empty. A typed array is returned for multiple empty data, and an empty string is returned for single empty string data - 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)BadItemTypeException- if the data holder has a model and the type defined by the model doesn't match the type of the stored value, or if value at the sub data path of the given one is not a compositeUndefinedItemPathException- if the data holder has a model and the given data path is not defined by this modelBadDataPathCardinalityException- if the data holder has a model and the definition of a part of the data path is multiple. Only the last part can be multiple
-
getValueOrDefault
<T> T getValueOrDefault(String dataPath, T defaultValue) throws IllegalArgumentException, UnknownTypeException, NotUniqueTypeException, BadItemTypeException, UndefinedItemPathException, BadDataPathCardinalityException Retrieves the value of the data at the given path if exists and is not empty, or the given default value- Type Parameters:
T- type of the value to retrieve. If the data holder has a model, the type of the value is defined by this model. Otherwise, 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- Parameters:
dataPath- path of the datadefaultValue- default value- Returns:
- the value of the data, or the given default value if the value does not exist or is empty
- 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)BadItemTypeException- if value at the sub data path of the given one is not a compositeUndefinedItemPathException- if the data holder has a model and the given data path is not defined by this modelBadDataPathCardinalityException- if the data holder has a model and the definition 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, UndefinedItemPathException, 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. A typed array is returned for multiple empty data, and an empty string is returned for single empty string data - 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 pathUndefinedItemPathException- if the data holder has a model and the given data path is not defined by this modelBadDataPathCardinalityException- if the data holder has a model and the definition of a part of the data path is multiple. Only the last part can be multiple
-
getValueOfTypeOrDefault
<T> T getValueOfTypeOrDefault(String dataPath, String dataTypeId, T defaultValue) throws IllegalArgumentException, UnknownTypeException, BadItemTypeException, UndefinedItemPathException, BadDataPathCardinalityException Retrieves the value of the data at the given path if exists and is not empty, or the given 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, or the given default value if the value does not exist 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 pathUndefinedItemPathException- if the data holder has a model and the given data path is not defined by this modelBadDataPathCardinalityException- if the data holder has a model and the definition of a part of the data path is multiple. Only the last part can be multiple
-
isMultiple
boolean isMultiple(String dataPath) throws IllegalArgumentException, UnknownDataException, UnknownTypeException, NotUniqueTypeException, BadItemTypeException, UndefinedItemPathException 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 existUnknownTypeException- 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)BadItemTypeException- if value at the sub data path of the given one is not a compositeUndefinedItemPathException- if the data holder has a model and the given data path is not defined by this model
-
isMultiple
boolean isMultiple(String dataPath, String dataTypeId) throws IllegalArgumentException, UnknownDataException, UnknownTypeException, BadItemTypeException, UndefinedItemPathException Checks if the value of the data at the given path is multiple- 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 existUnknownTypeException- if there is no compatible type with the data at the given data pathBadItemTypeException- if value at the sub data path of the given one is not a compositeUndefinedItemPathException- if the data holder has a model and the given data path is not defined by this model
-
getType
<X extends ModelItemType> X getType(String dataPath) throws IllegalArgumentException, UnknownDataException, UnknownTypeException, NotUniqueTypeException, UndefinedItemPathException Retrieves the type of the data at the given path- Type Parameters:
X- type of the item type- 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)UndefinedItemPathException- if the data holder has a model and the given data path is not defined by this model
-
getModelItemTypeExtensionPoint
Provide the ModelItemTypeExtensionPoint linked with the DataHolder- Returns:
- the extension point
-
copyTo
default void copyTo(ModifiableDataHolder dataHolder) throws UnknownTypeException, NotUniqueTypeException, BadItemTypeException, UndefinedItemPathException Copies the currentDataHolderto the givenModifiableDataHolder.- Parameters:
dataHolder- The destination dataHolder. Can not be null.- Throws:
UnknownTypeException- if there is no available type compatible with the copied value for the type extension point of the destinationModifiableDataHolderNotUniqueTypeException- if there is more than one available types compatibles with the copied value for the type extension point of the destinationModifiableDataHolderBadItemTypeException- if type of a data to copy doesn't match the data with same path in the destinationModifiableDataHolderUndefinedItemPathException- if the data holder has a model and the given data path is not defined by this model
-
copyTo
default void copyTo(ModifiableDataHolder dataHolder, DataContext context) throws UnknownTypeException, NotUniqueTypeException, BadItemTypeException, UndefinedItemPathException Copies the currentDataHolderto the givenModifiableDataHolder.- Parameters:
dataHolder- The destination dataHolder. Can not be null.context- The context of the data to copy- Throws:
UnknownTypeException- if there is no available type compatible with the copied value for the type extension point of the destinationModifiableDataHolderNotUniqueTypeException- if there is more than one available types compatibles with the copied value for the type extension point of the destinationModifiableDataHolderBadItemTypeException- if type of a data to copy doesn't match the data with same path in the destinationModifiableDataHolderUndefinedItemPathException- if the data holder has a model and the given data path is not defined by this model
-
dataToSAX
default void dataToSAX(ContentHandler contentHandler) throws SAXException, UnknownTypeException, NotUniqueTypeException, BadItemTypeException 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 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 valueBadItemTypeException- if the saxed value's type does not matches the stored data
-
dataToSAX
void dataToSAX(ContentHandler contentHandler, DataContext context) throws SAXException, UnknownTypeException, NotUniqueTypeException, BadItemTypeException 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 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 valueBadItemTypeException- if the saxed value's type does not matches the stored data
-
dataToSAX
default void dataToSAX(ContentHandler contentHandler, String dataPath) throws SAXException, UnknownTypeException, NotUniqueTypeException, BadItemTypeException, UndefinedItemPathException Generates SAX events for the data at the given data path in the currentDataHolderDo not generate any event if there is no values at the given path- Parameters:
contentHandler- theContentHandlerthat will receive the SAX eventsdataPath- the path 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 valueBadItemTypeException- if the saxed value's type does not matches the stored dataUndefinedItemPathException- if the data holder has a model and the given data path is not defined by this model
-
dataToSAX
void dataToSAX(ContentHandler contentHandler, String dataPath, DataContext context) throws SAXException, UnknownTypeException, NotUniqueTypeException, BadItemTypeException, UndefinedItemPathException Generates SAX events for the data at the given data path in the currentDataHolderDo not generate any event if there is no values at the given path- Parameters:
contentHandler- theContentHandlerthat 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 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 valueBadItemTypeException- if the saxed value's type does not matches the stored dataUndefinedItemPathException- if the data holder has a model and the given data path is not defined by this model
-
dataToJSON
default Map<String,Object> dataToJSON() throws UnknownTypeException, NotUniqueTypeException, BadItemTypeExceptionConvert the data contained in thisDataHolder- 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 convertBadItemTypeException- if the value's type does not matches the stored data
-
dataToJSON
Map<String,Object> dataToJSON(DataContext context) throws UnknownTypeException, NotUniqueTypeException, BadItemTypeException Convert the data contained in thisDataHolder- 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 convertBadItemTypeException- if the value's type does not matches the stored data
-
dataToJSON
default Object dataToJSON(String dataPath) throws UnknownTypeException, NotUniqueTypeException, BadItemTypeException, UndefinedItemPathException Convert the data at the given path into a JSON object- Parameters:
dataPath- the path of the data to convert- Returns:
- The value as 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 convertBadItemTypeException- if the value's type does not matches the stored dataUndefinedItemPathException- if the data holder has a model and the given data path is not defined by this model
-
dataToJSON
Object dataToJSON(String dataPath, DataContext context) throws UnknownTypeException, NotUniqueTypeException, BadItemTypeException, UndefinedItemPathException Convert the data at the given path into a JSON object- Parameters:
dataPath- the path of the data to convertcontext- The context of the data to convert- Returns:
- The value as 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 convertBadItemTypeException- if the value's type does not matches the stored dataUndefinedItemPathException- if the data holder has a model and the given data path is not defined by this model
-
hasDifferences
boolean hasDifferences(Map<String, Object> values) throws UnknownTypeException, NotUniqueTypeException, BadItemTypeExceptionCheck if there are differences between the given values and the current ones- 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 pointBadItemTypeException- if value doesn't match the data at corresponding path
-
getRepositoryData
Retrieves the repository data used by thisDataHolder- Returns:
- the repository data used by this
DataHolder
-
getParentDataHolder
Optional<? extends DataHolder> getParentDataHolder()Retrieves the optional parent of the currentDataHolderThere can be no parent if the currentDataHolderis the root- Returns:
- the parent of the current
DataHolder
-
getRootDataHolder
Retrieves theDataHolderthat is the root of the current one- Returns:
- the root
DataHolder
-