Package org.ametys.cms.data
Class ContentValue
- java.lang.Object
-
- org.ametys.cms.data.ContentValue
-
- All Implemented Interfaces:
DataHolder,ModelAwareDataHolder,ModifiableDataHolder,ModifiableModelAwareDataHolder
public class ContentValue extends Object implements ModifiableModelAwareDataHolder
Content wrapper used by attributes of type content- See Also:
AbstractContentElementType
-
-
Field Summary
-
Fields inherited from interface org.ametys.plugins.repository.data.holder.ModelAwareDataHolder
ALTERNATIVE_SUFFIX, COMMENTS_SUFFIX, STATUS_SUFFIX
-
-
Constructor Summary
Constructors Constructor Description ContentValue(ModifiableContent content)Constructor of the content wrapperContentValue(AmetysObjectResolver resolver, String contentId)Constructor of the content wrapperContentValue(AmetysObjectResolver resolver, String contentId, Session session)Constructor of the content wrapper
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddataToSAX(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 pathbooleanequals(Object obj)List<DataComment>getComments(String dataName)Retrieve the comments of the data with the given nameModifiableModelAwareCompositegetComposite(String compositePath)Retrieves the composite at the given pathModifiableModelAwareCompositegetComposite(String compositePath, boolean createNew)Retrieves the composite at the given pathModifiableContentgetContent()Retrieves the contentStringgetContentId()Retrieves the content's identifierOptional<ModifiableContent>getContentIfExists()Collection<String>getDataNames()Retrieves the names of data contained by this data holder Retrieves only the data at first level, does not check composite dataModelItemgetDefinition(String path)Retrieves the definition of the data at the given pathModifiableModelAwareCompositegetExternalComposite(String compositePath)Retrieves the external composite at the given pathModifiableModelAwareCompositegetExternalComposite(String compositePath, boolean createNew)Retrieves the external composite at the given pathModifiableModelAwareRepeatergetExternalRepeater(String repeaterPath)Retrieves the external repeater at the given pathModifiableModelAwareRepeatergetExternalRepeater(String repeaterPath, boolean createNew)Retrieves the external repeater at the given path<T> TgetExternalValue(String dataPath)Retrieves the external value of the data at the given pathModifiableModelAwareCompositegetLocalComposite(String compositePath)Retrieves the local composite at the given pathModifiableModelAwareCompositegetLocalComposite(String compositePath, boolean createNew)Retrieves the local composite at the given pathModifiableModelAwareRepeatergetLocalRepeater(String repeaterPath)Retrieves the local repeater at the given pathModifiableModelAwareRepeatergetLocalRepeater(String repeaterPath, boolean createNew)Retrieves the local repeater at the given path<T> TgetLocalValue(String dataPath)Retrieves the local value of the data at the given pathCollection<? extends ModelItemContainer>getModel()Retrieves the data holder's modelOptional<? extends ModifiableModelAwareDataHolder>getParentDataHolder()Retrieves the optional parent of the currentDataHolderThere can be no parent if the currentDataHolderis the rootModifiableModelAwareRepeatergetRepeater(String repeaterPath)Retrieves the repeater at the given pathModifiableModelAwareRepeatergetRepeater(String repeaterPath, boolean createNew)Retrieves the repeater at the given pathModifiableRepositoryDatagetRepositoryData()Retrieves the repository data used by thisDataHolderModifiableModelAwareDataHoldergetRootDataHolder()Retrieves theDataHolderthat is the root of the current oneExternalizableDataProvider.ExternalizableDataStatusgetStatus(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> TgetValue(String dataPath)Retrieves the value of the data at the given path<T> TgetValue(String dataPath, boolean allowMultiValuedPathSegments)Retrieves the value of the data at the given path<T> TgetValue(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 istrueand there is a default value defined by the model The given default valuebooleanhasComments(String dataName)Checks if there is are comments on the data with the given namebooleanhasDefinition(String path)Checks if there is a definition at the given pathbooleanhasExternalValue(String dataPath)Checks if there is a non empty external value for the data at the given pathbooleanhasExternalValueOrEmpty(String dataPath)Checks if there is an external value for the data at the given pathinthashCode()booleanhasLocalValue(String dataPath)Checks if there is a non empty local value for the data at the given pathbooleanhasLocalValueOrEmpty(String dataPath)Checks if there is a local value for the data at the given pathbooleanhasValue(String dataPath)Checks 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 pathvoidremoveExternalizableMetadataIfExists(String dataPath)Removes the stored metadata (status and alternative value) for externalizable (or ex-externalizable) datavoidremoveExternalValue(String dataPath)Removes the external value of the data at the given pathvoidremoveLocalValue(String dataPath)Removes the local value of the data at the given pathvoidremoveValue(String dataPath)Removes the stored value of the data at the given pathvoidsetComments(String dataName, List<DataComment> comments)Set the comments of the data with the given namevoidsetExternalValue(String dataPath, Object externalValue)Sets the external value of the data at the given pathvoidsetLocalValue(String dataPath, Object localValue)Sets the local value of the data at the given pathvoidsetStatus(String dataPath, ExternalizableDataProvider.ExternalizableDataStatus status)Set the status of the data at the given pathvoidsetValue(String dataPath, Object value)Sets the value of the data at the given path<T extends SynchronizationResult>
TsynchronizeValues(Map<String,Object> values)Synchronizes the given values with the current ones<T extends SynchronizationResult>
TsynchronizeValues(Map<String,Object> values, SynchronizationContext context)Synchronizes the given values with the current ones<T extends SynchronizationResult>
TsynchronizeValues(ViewItemContainer viewItemContainer, Map<String,Object> values)Synchronizes the given values with the current ones<T extends SynchronizationResult>
TsynchronizeValues(ViewItemContainer viewItemContainer, Map<String,Object> values, SynchronizationContext context)Synchronizes the given values with the currentModifiableModelAwareDataHolder's ones-
Methods inherited from class java.lang.Object
clone, finalize, getClass, 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, isMultiple
-
-
-
-
Constructor Detail
-
ContentValue
public ContentValue(ModifiableContent content)
Constructor of the content wrapper- Parameters:
content- the existing content
-
ContentValue
public ContentValue(AmetysObjectResolver resolver, String contentId)
Constructor of the content wrapper- Parameters:
resolver- resolver used to get the content from its identifiercontentId- content identifier
-
ContentValue
public ContentValue(AmetysObjectResolver resolver, String contentId, Session session)
Constructor of the content wrapper- Parameters:
resolver- resolver used to get the content from its identifiercontentId- content identifiersession- the current session. Ifnull, a new session will be used to retrieve the content
-
-
Method Detail
-
getContentId
public String getContentId()
Retrieves the content's identifier- Returns:
- the content's identifier
-
getContent
public ModifiableContent getContent() throws AmetysRepositoryException, UnknownAmetysObjectException
Retrieves the content- Returns:
- the content
- Throws:
AmetysRepositoryException- if an error occurs.UnknownAmetysObjectException- if no content exists for the identifier
-
getContentIfExists
public Optional<ModifiableContent> getContentIfExists()
- Returns:
- an
Optionaldescribing the content
-
hasValue
public 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 interfaceDataHolder- Specified by:
hasValuein interfaceModelAwareDataHolder- 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 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:ModelAwareDataHolderChecks if there is a non empty local value for the data at the given path- Specified by:
hasLocalValuein interfaceModelAwareDataHolder- Parameters:
dataPath- path of the externalizable data- Returns:
trueif 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.falseotherwise- 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:ModelAwareDataHolderChecks if there is a non empty external value for the data at the given path- Specified by:
hasExternalValuein interfaceModelAwareDataHolder- Parameters:
dataPath- path of the externalizable data- Returns:
trueif 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.falseotherwise- 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:DataHolderChecks if there is a value, even empty, for the data at the given path- Specified by:
hasValueOrEmptyin interfaceDataHolder- Specified by:
hasValueOrEmptyin interfaceModelAwareDataHolder- 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 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:ModelAwareDataHolderChecks if there is a local value for the data at the given path- Specified by:
hasLocalValueOrEmptyin interfaceModelAwareDataHolder- Parameters:
dataPath- path of the externalizable data- Returns:
trueif 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.falseotherwise- 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:ModelAwareDataHolderChecks if there is an external value for the data at the given path- Specified by:
hasExternalValueOrEmptyin interfaceModelAwareDataHolder- Parameters:
dataPath- path of the externalizable data- Returns:
trueif 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.falseotherwise- 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
-
hasComments
public boolean hasComments(String dataName) throws IllegalArgumentException, UndefinedItemPathException
Description copied from interface:ModelAwareDataHolderChecks if there is are comments on the data with the given name- Specified by:
hasCommentsin interfaceModelAwareDataHolder- Parameters:
dataName- name of the data- Returns:
trueif there are comments on the data,falseotherwise- Throws:
IllegalArgumentException- if the given data name is null or emptyUndefinedItemPathException- if the given data name is not defined by the model
-
getDataNames
public Collection<String> getDataNames()
Description copied from interface:DataHolderRetrieves the names of data contained by this data holder Retrieves only the data at first level, does not check composite data- Specified by:
getDataNamesin interfaceDataHolder- Specified by:
getDataNamesin interfaceModelAwareDataHolder- Returns:
- the names of all data contained by this data holder
-
getValue
public <T> T getValue(String dataPath) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
Description copied from interface:ModelAwareDataHolderRetrieves the value of the data at the given path- Specified by:
getValuein interfaceModelAwareDataHolder- Type Parameters:
T- type of the value to retrieve- 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 (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
-
getValue
public <T> T getValue(String dataPath, boolean allowMultiValuedPathSegments) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
Description copied from interface:ModelAwareDataHolderRetrieves the value of the data at the given path- Specified by:
getValuein interfaceModelAwareDataHolder- Type Parameters:
T- type of the value to retrieve- Parameters:
dataPath- path of the dataallowMultiValuedPathSegments-trueto allow multi-valued segments in the path (not necessarily at the last segment),falseotherwise. Iftrue, if there is no indicated entry for a repeater, the values of all the entries are retrieved Iftrueand if there are multiple values, all data are retrieved in one array- Returns:
- the value of the data or
nullif allowMultiValuedPathSegments isfalseand 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 isfalseand 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 useDefaultFromModel, T defaultValue) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
Description copied from interface:ModelAwareDataHolderRetrieves 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
trueand there is a default value defined by the model - The given default value
- Specified by:
getValuein 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
-
getLocalValue
public <T> T getLocalValue(String dataPath) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
Description copied from interface:ModelAwareDataHolderRetrieves the local value of the data at the given path- Specified by:
getLocalValuein 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
nullif 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:ModelAwareDataHolderRetrieves the external value of the data at the given path- Specified by:
getExternalValuein 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
nullif 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:ModelAwareDataHolderRetrieves 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:
getStatusin 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
-
getComments
public List<DataComment> getComments(String dataName) throws IllegalArgumentException, UndefinedItemPathException
Description copied from interface:ModelAwareDataHolderRetrieve the comments of the data with the given name- Specified by:
getCommentsin 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
-
getModel
public Collection<? extends ModelItemContainer> getModel()
Description copied from interface:ModelAwareDataHolderRetrieves the data holder's model- Specified by:
getModelin interfaceModelAwareDataHolder- Returns:
- the data holder's model
-
getDefinition
public ModelItem getDefinition(String path) throws IllegalArgumentException, UndefinedItemPathException
Description copied from interface:ModelAwareDataHolderRetrieves the definition of the data at the given path- Specified by:
getDefinitionin 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:ModelAwareDataHolderChecks if there is a definition at the given path- Specified by:
hasDefinitionin interfaceModelAwareDataHolder- Parameters:
path- path of the data. No matter if it is a definition or data path (with repeater entry positions)- Returns:
trueif there is definition at the given path,falseotherwise- Throws:
IllegalArgumentException- if the given path is null or empty
-
getComposite
public ModifiableModelAwareComposite getComposite(String compositePath) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
Description copied from interface:DataHolderRetrieves the composite at the given path- Specified by:
getCompositein interfaceDataHolder- Specified by:
getCompositein interfaceModelAwareDataHolder- Specified by:
getCompositein interfaceModifiableDataHolder- Specified by:
getCompositein interfaceModifiableModelAwareDataHolder- 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 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 ModifiableModelAwareComposite getLocalComposite(String compositePath) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
Description copied from interface:ModelAwareDataHolderRetrieves the local composite at the given path- Specified by:
getLocalCompositein interfaceModelAwareDataHolder- Specified by:
getLocalCompositein interfaceModifiableModelAwareDataHolder- Parameters:
compositePath- path of the externalizable composite to retrieve- Returns:
- the composite or
nullif 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 ModifiableModelAwareComposite getExternalComposite(String compositePath) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
Description copied from interface:ModelAwareDataHolderRetrieves the external composite at the given path- Specified by:
getExternalCompositein interfaceModelAwareDataHolder- Specified by:
getExternalCompositein interfaceModifiableModelAwareDataHolder- Parameters:
compositePath- path of the externalizable composite to retrieve- Returns:
- the composite or
nullif 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 ModifiableModelAwareRepeater getRepeater(String repeaterPath) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
Description copied from interface:ModelAwareDataHolderRetrieves the repeater at the given path- Specified by:
getRepeaterin interfaceModelAwareDataHolder- Specified by:
getRepeaterin interfaceModifiableModelAwareDataHolder- Parameters:
repeaterPath- path of the repeater to retrieve- Returns:
- the repeater or
nullif 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 ModifiableModelAwareRepeater getLocalRepeater(String repeaterPath) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
Description copied from interface:ModelAwareDataHolderRetrieves the local repeater at the given path- Specified by:
getLocalRepeaterin interfaceModelAwareDataHolder- Specified by:
getLocalRepeaterin interfaceModifiableModelAwareDataHolder- Parameters:
repeaterPath- path of the externalizable repeater to retrieve- Returns:
- the repeater or
nullif 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 ModifiableModelAwareRepeater getExternalRepeater(String repeaterPath) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
Description copied from interface:ModelAwareDataHolderRetrieves the external repeater at the given path- Specified by:
getExternalRepeaterin interfaceModelAwareDataHolder- Specified by:
getExternalRepeaterin interfaceModifiableModelAwareDataHolder- Parameters:
repeaterPath- path of the externalizable repeater to retrieve- Returns:
- the repeater or
nullif 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
-
dataToSAX
public void dataToSAX(ContentHandler contentHandler, String dataPath, DataContext context) throws SAXException
Description copied from interface:DataHolderGenerates 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- Specified by:
dataToSAXin interfaceDataHolder- 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 generation
-
getComposite
public ModifiableModelAwareComposite getComposite(String compositePath, boolean createNew) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
Description copied from interface:ModifiableModelAwareDataHolderRetrieves the composite at the given path- Specified by:
getCompositein interfaceModifiableDataHolder- Specified by:
getCompositein interfaceModifiableModelAwareDataHolder- Parameters:
compositePath- path of the composite to retrievecreateNew-trueto create the composite if it does not exist,falseotherwise- Returns:
- the composite or
nullif createNew isfalseand value 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 ModifiableModelAwareComposite getLocalComposite(String compositePath, boolean createNew) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
Description copied from interface:ModifiableModelAwareDataHolderRetrieves the local composite at the given path- Specified by:
getLocalCompositein interfaceModifiableModelAwareDataHolder- Parameters:
compositePath- path of the externalizable composite to retrievecreateNew-trueto create the composite if it does not exist,falseotherwise- Returns:
- the composite or
nullif createNew isfalseand value 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 ModifiableModelAwareComposite getExternalComposite(String compositePath, boolean createNew) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
Description copied from interface:ModifiableModelAwareDataHolderRetrieves the external composite at the given path- Specified by:
getExternalCompositein interfaceModifiableModelAwareDataHolder- Parameters:
compositePath- path of the externalizable composite to retrievecreateNew-trueto create the composite if it does not exist,falseotherwise- Returns:
- the composite or
nullif createNew isfalseand value 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 ModifiableModelAwareRepeater getRepeater(String repeaterPath, boolean createNew) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
Description copied from interface:ModifiableModelAwareDataHolderRetrieves the repeater at the given path- Specified by:
getRepeaterin interfaceModifiableModelAwareDataHolder- Parameters:
repeaterPath- path of the repeater to retrievecreateNew-trueto create the repeater if it does not exist,falseotherwise- Returns:
- the repeater or
nullif createNew isfalseand value not exists or is empty - Throws:
IllegalArgumentException- if the given repeater 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 repeaterBadDataPathCardinalityException- if the definition of a part of the data path is multiple. Only the last part can be multiple
-
getLocalRepeater
public ModifiableModelAwareRepeater getLocalRepeater(String repeaterPath, boolean createNew) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
Description copied from interface:ModifiableModelAwareDataHolderRetrieves the local repeater at the given path- Specified by:
getLocalRepeaterin interfaceModifiableModelAwareDataHolder- Parameters:
repeaterPath- path of the externalizable repeater to retrievecreateNew-trueto create the repeater if it does not exist,falseotherwise- Returns:
- the repeater or
nullif createNew isfalseand value not exists or is empty - Throws:
IllegalArgumentException- if the given repeater 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 repeaterBadDataPathCardinalityException- if the definition of a part of the data path is multiple. Only the last part can be multiple
-
getExternalRepeater
public ModifiableModelAwareRepeater getExternalRepeater(String repeaterPath, boolean createNew) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
Description copied from interface:ModifiableModelAwareDataHolderRetrieves the external repeater at the given path- Specified by:
getExternalRepeaterin interfaceModifiableModelAwareDataHolder- Parameters:
repeaterPath- path of the externalizable repeater to retrievecreateNew-trueto create the repeater if it does not exist,falseotherwise- Returns:
- the repeater or
nullif createNew isfalseand value not exists or is empty - Throws:
IllegalArgumentException- if the given repeater 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 repeaterBadDataPathCardinalityException- if the definition of a part of the data path is multiple. Only the last part can be multiple
-
synchronizeValues
public <T extends SynchronizationResult> T synchronizeValues(Map<String,Object> values) throws UndefinedItemPathException, BadItemTypeException
Description copied from interface:ModifiableModelAwareDataHolderSynchronizes the given values with the current ones- Specified by:
synchronizeValuesin interfaceModifiableModelAwareDataHolder- Type Parameters:
T- the type of theSynchronizationResult- Parameters:
values- the values to synchronize- Returns:
- the
SynchronizationResult - Throws:
UndefinedItemPathException- if a key in the given Map refers to a data that is not defined by the modelBadItemTypeException- if the type defined by the model of one of the Map's key doesn't match the corresponding value
-
synchronizeValues
public <T extends SynchronizationResult> T synchronizeValues(Map<String,Object> values, SynchronizationContext context) throws UndefinedItemPathException, BadItemTypeException
Description copied from interface:ModifiableModelAwareDataHolderSynchronizes the given values with the current ones- Specified by:
synchronizeValuesin interfaceModifiableModelAwareDataHolder- Type Parameters:
T- the type of theSynchronizationResult- Parameters:
values- the values to synchronizecontext- the context of the synchronization- Returns:
- the
SynchronizationResult - Throws:
UndefinedItemPathException- if a key in the given Map refers to a data that is not defined by the modelBadItemTypeException- if the type defined by the model of one of the Map's key doesn't match the corresponding value
-
synchronizeValues
public <T extends SynchronizationResult> T synchronizeValues(ViewItemContainer viewItemContainer, Map<String,Object> values) throws UndefinedItemPathException, BadItemTypeException
Description copied from interface:ModifiableModelAwareDataHolderSynchronizes the given values with the current ones- Specified by:
synchronizeValuesin interfaceModifiableModelAwareDataHolder- Type Parameters:
T- the type of theSynchronizationResult- Parameters:
viewItemContainer- TheViewItemContainercontaining all items to synchronizevalues- the values to synchronize- Returns:
- the
SynchronizationResult - Throws:
UndefinedItemPathException- if a key in the given Map refers to a data that is not defined by the modelBadItemTypeException- if the type defined by the model of one of the Map's key doesn't match the corresponding value
-
synchronizeValues
public <T extends SynchronizationResult> T synchronizeValues(ViewItemContainer viewItemContainer, Map<String,Object> values, SynchronizationContext context) throws UndefinedItemPathException, BadItemTypeException
Description copied from interface:ModifiableModelAwareDataHolderSynchronizes the given values with the currentModifiableModelAwareDataHolder's ones- Specified by:
synchronizeValuesin interfaceModifiableModelAwareDataHolder- Type Parameters:
T- the type of theSynchronizationResult- Parameters:
viewItemContainer- TheViewItemContainercontaining all items to synchronizevalues- the values to synchronizecontext- the context of the synchronization- Returns:
- the
SynchronizationResult - Throws:
UndefinedItemPathException- if a key in the given Map refers to a data that is not defined by the modelBadItemTypeException- if the type defined by the model of one of the Map's key doesn't match the corresponding value
-
setValue
public void setValue(String dataPath, Object value) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
Description copied from interface:ModifiableModelAwareDataHolderSets the value of the data at the given path- Specified by:
setValuein interfaceModifiableModelAwareDataHolder- Parameters:
dataPath- path of the datavalue- the value to set. Givenullto empty the value.- 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 given value to setBadDataPathCardinalityException- if the definition of a part of the data path is multiple. Only the last part can be multiple
-
setLocalValue
public void setLocalValue(String dataPath, Object localValue) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
Description copied from interface:ModifiableModelAwareDataHolderSets the local value of the data at the given path- Specified by:
setLocalValuein interfaceModifiableModelAwareDataHolder- Parameters:
dataPath- path of the externalizable datalocalValue- the local value to set. Givenullto empty the value.- 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 given value to setBadDataPathCardinalityException- if the definition of a part of the data path is multiple. Only the last part can be multiple
-
setExternalValue
public void setExternalValue(String dataPath, Object externalValue) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
Description copied from interface:ModifiableModelAwareDataHolderSets the external value of the data at the given path- Specified by:
setExternalValuein interfaceModifiableModelAwareDataHolder- Parameters:
dataPath- path of the externalizable dataexternalValue- the external value to set. Givenullto empty the value.- 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 given value to setBadDataPathCardinalityException- if the definition of a part of the data path is multiple. Only the last part can be multiple
-
setStatus
public void setStatus(String dataPath, ExternalizableDataProvider.ExternalizableDataStatus status) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
Description copied from interface:ModifiableModelAwareDataHolderSet the status of the data at the given path- Specified by:
setStatusin interfaceModifiableModelAwareDataHolder- Parameters:
dataPath- path of the externalizable datastatus- the new status- Throws:
IllegalArgumentException- if the given data path is null or emptyUndefinedItemPathException- if the given data path is not defined by the modelBadItemTypeException- if there is a type issue while getting the parent (part of the dataPath without the last segment)BadDataPathCardinalityException- if the definition of a part of the data path is multiple. Only the last part can be multiple
-
setComments
public void setComments(String dataName, List<DataComment> comments) throws IllegalArgumentException, UndefinedItemPathException
Description copied from interface:ModifiableModelAwareDataHolderSet the comments of the data with the given name- Specified by:
setCommentsin interfaceModifiableModelAwareDataHolder- Parameters:
dataName- name of the datacomments- the comments to set- Throws:
IllegalArgumentException- if the given data name is null or emptyUndefinedItemPathException- if the given data name is not defined by the model
-
removeValue
public void removeValue(String dataPath) throws IllegalArgumentException, UndefinedItemPathException, UnknownDataException, BadDataPathCardinalityException
Description copied from interface:ModifiableModelAwareDataHolderRemoves the stored value of the data at the given path- Specified by:
removeValuein interfaceModifiableDataHolder- Specified by:
removeValuein interfaceModifiableModelAwareDataHolder- Parameters:
dataPath- path of the data- 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 multipleUnknownDataException
-
removeLocalValue
public void removeLocalValue(String dataPath) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, UnknownDataException, BadDataPathCardinalityException
Description copied from interface:ModifiableModelAwareDataHolderRemoves the local value of the data at the given path- Specified by:
removeLocalValuein interfaceModifiableModelAwareDataHolder- Parameters:
dataPath- path of the externalizable data- Throws:
IllegalArgumentException- if the given data path is null or emptyUndefinedItemPathException- if the given data path is not defined by the modelBadItemTypeException- if the value of the parent of the given path is not an item containerBadDataPathCardinalityException- if the definition of a part of the data path is multiple. Only the last part can be multipleUnknownDataException
-
removeExternalValue
public void removeExternalValue(String dataPath) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, UnknownDataException, BadDataPathCardinalityException
Description copied from interface:ModifiableModelAwareDataHolderRemoves the external value of the data at the given path- Specified by:
removeExternalValuein interfaceModifiableModelAwareDataHolder- Parameters:
dataPath- path of the externalizable data- Throws:
IllegalArgumentException- if the given data path is null or emptyUndefinedItemPathException- if the given data path is not defined by the modelBadItemTypeException- if the value of the parent of the given path is not an item containerBadDataPathCardinalityException- if the definition of a part of the data path is multiple. Only the last part can be multipleUnknownDataException
-
removeExternalizableMetadataIfExists
public void removeExternalizableMetadataIfExists(String dataPath) throws IllegalArgumentException, BadItemTypeException, UndefinedItemPathException, BadDataPathCardinalityException
Description copied from interface:ModifiableModelAwareDataHolderRemoves the stored metadata (status and alternative value) for externalizable (or ex-externalizable) data- Specified by:
removeExternalizableMetadataIfExistsin interfaceModifiableModelAwareDataHolder- Parameters:
dataPath- path of the data- Throws:
IllegalArgumentException- if the given data path is null or emptyBadItemTypeException- if the value of the parent of the given path is not an item containerUndefinedItemPathException- 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
-
getRepositoryData
public ModifiableRepositoryData getRepositoryData()
Description copied from interface:DataHolderRetrieves the repository data used by thisDataHolder- Specified by:
getRepositoryDatain interfaceDataHolder- Specified by:
getRepositoryDatain interfaceModifiableDataHolder- Returns:
- the repository data used by this
DataHolder
-
getParentDataHolder
public Optional<? extends ModifiableModelAwareDataHolder> 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- Specified by:
getParentDataHolderin interfaceModelAwareDataHolder- Specified by:
getParentDataHolderin interfaceModifiableDataHolder- Specified by:
getParentDataHolderin interfaceModifiableModelAwareDataHolder- Returns:
- the parent of the current
DataHolder
-
getRootDataHolder
public ModifiableModelAwareDataHolder getRootDataHolder()
Description copied from interface:DataHolderRetrieves theDataHolderthat is the root of the current one- Specified by:
getRootDataHolderin interfaceDataHolder- Specified by:
getRootDataHolderin interfaceModelAwareDataHolder- Specified by:
getRootDataHolderin interfaceModifiableDataHolder- Specified by:
getRootDataHolderin interfaceModifiableModelAwareDataHolder- Returns:
- the root
DataHolder
-
-