Package org.ametys.cms.data.type.impl
Class CompositeRepositoryModelItemType
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.core.model.type.AbstractModelItemType
-
- org.ametys.cms.data.type.impl.CompositeRepositoryModelItemType
-
- All Implemented Interfaces:
RepositoryModelItemGroupType
,RepositoryModelItemType
,ModelItemGroupType
,ModelItemType
,LogEnabled
,PluginAware
public class CompositeRepositoryModelItemType extends AbstractModelItemType implements RepositoryModelItemGroupType
Class for composite type
-
-
Field Summary
-
Fields inherited from interface org.ametys.plugins.repository.data.type.RepositoryModelItemType
EMPTY_METADATA_SUFFIX
-
-
Constructor Summary
Constructors Constructor Description CompositeRepositoryModelItemType()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private CompositeDefinition
_getCompositeDefinition(ModelAwareComposite composite)
private void
_valueToSAX(ContentHandler contentHandler, String tagName, Object value, Optional<ViewItem> viewItem, DataContext context, boolean isEdition)
String
getRepositoryDataType()
Retrieves the type of repository data used for this typeboolean
isCompatible(RepositoryData parentData, String name)
Checks if the value in the given repository data is compatible with the item typevoid
valueToSAX(ContentHandler contentHandler, String tagName, Object value, Optional<ViewItem> viewItem, DataContext context)
Generates SAX events for the given valuevoid
valueToSAXForEdition(ContentHandler contentHandler, String tagName, Object value, Optional<ViewItem> viewItem, DataContext context)
Generates SAX events for the given value in edition mode.-
Methods inherited from class org.ametys.core.model.type.AbstractModelItemType
_getContextAttributes, getId, setPluginInfo
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.ametys.runtime.model.type.ModelItemType
getId, valueToSAX
-
Methods inherited from interface org.ametys.runtime.plugin.component.PluginAware
setPluginInfo
-
Methods inherited from interface org.ametys.plugins.repository.data.type.RepositoryModelItemGroupType
add, hasNonEmptyValue, isMultiple, read
-
Methods inherited from interface org.ametys.plugins.repository.data.type.RepositoryModelItemType
hasValue, remove
-
-
-
-
Constructor Detail
-
CompositeRepositoryModelItemType
public CompositeRepositoryModelItemType()
-
-
Method Detail
-
valueToSAXForEdition
public void valueToSAXForEdition(ContentHandler contentHandler, String tagName, Object value, Optional<ViewItem> viewItem, DataContext context) throws SAXException, IOException
Description copied from interface:ModelItemType
Generates SAX events for the given value in edition mode. This method exist for legacy purposes because some types have to be saxed as JSON- Specified by:
valueToSAXForEdition
in interfaceModelItemType
- Parameters:
contentHandler
- theContentHandler
that will receive the SAX eventstagName
- the tag name of the SAX event to generate.value
- the value to SAXviewItem
- The optional view item corresponding item that is currently saxed. This view item gives context for the SAX event that will be generated here.context
- 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 API
-
valueToSAX
public void valueToSAX(ContentHandler contentHandler, String tagName, Object value, Optional<ViewItem> viewItem, DataContext context) throws SAXException, IOException
Description copied from interface:ModelItemType
Generates SAX events for the given value- Specified by:
valueToSAX
in interfaceModelItemType
- Parameters:
contentHandler
- theContentHandler
that will receive the SAX eventstagName
- the tag name of the SAX event to generate.value
- the value to SAXviewItem
- The optional view item corresponding item that is currently saxed. This view item gives context for the SAX event that will be generated here.context
- 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 API
-
_valueToSAX
private void _valueToSAX(ContentHandler contentHandler, String tagName, Object value, Optional<ViewItem> viewItem, DataContext context, boolean isEdition) throws SAXException, IOException
- Throws:
SAXException
IOException
-
_getCompositeDefinition
private CompositeDefinition _getCompositeDefinition(ModelAwareComposite composite)
-
isCompatible
public boolean isCompatible(RepositoryData parentData, String name) throws UnknownDataException
Description copied from interface:RepositoryModelItemType
Checks if the value in the given repository data is compatible with the item type- Specified by:
isCompatible
in interfaceRepositoryModelItemType
- Parameters:
parentData
- repository data containing the data to checkname
- the name of the data to check- Returns:
true
if the data type matches the current type,false
otherwise- Throws:
UnknownDataException
- if there is no data in the parent repository data with this name
-
getRepositoryDataType
public String getRepositoryDataType()
Description copied from interface:RepositoryModelItemType
Retrieves the type of repository data used for this type- Specified by:
getRepositoryDataType
in interfaceRepositoryModelItemType
- Returns:
- the type of repository data used for this type
-
-