Package org.ametys.cms.data.type.impl
Class DateRepositoryElementType
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.core.model.type.AbstractModelItemType
org.ametys.core.model.type.AbstractElementType<LocalDate>
org.ametys.core.model.type.AbstractDateElementType
org.ametys.cms.data.type.impl.DateRepositoryElementType
- All Implemented Interfaces:
RepositoryElementType<LocalDate>
,RepositoryModelItemType
,ElementType<LocalDate>
,ModelItemType
,LogEnabled
,PluginAware
,Component
,Serviceable
public class DateRepositoryElementType
extends AbstractDateElementType
implements RepositoryElementType<LocalDate>
Class for date type of elements stored in the repository
-
Field Summary
Fields inherited from class org.ametys.core.model.type.AbstractElementType
_jsonUtils
Fields inherited from interface org.ametys.plugins.repository.data.type.RepositoryModelItemType
EMPTY_METADATA_SUFFIX
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected LocalDate
_singleValueFromXML
(Element element, Optional<Object> additionalData) Retrieves a single typed value from the given DOM nodeprotected void
_singleValueToSAX
(ContentHandler contentHandler, String tagName, LocalDate value, Optional<ViewItem> viewItem, DataContext context, AttributesImpl attributes) Generates SAX events for the given single valueRetrieves the type of repository data used for this typeboolean
hasNonEmptyValue
(RepositoryData parentData, String name) Check if there is a non empty value in the given repository databoolean
hasValue
(RepositoryData parentData, String name) Check if there is a value, even empty, in the given repository databoolean
isCompatible
(RepositoryData parentData, String name) Checks if the value in the given repository data is compatible with the item typeread
(RepositoryData parentData, String name) Read the value in the given repository datavoid
remove
(ModifiableRepositoryData parentData, String name) Remove the value into the given repository datavoid
write
(ModifiableRepositoryData parentData, String name, Object value) Write the value into the given repository dataMethods inherited from class org.ametys.core.model.type.AbstractDateElementType
_compareSingleValues, _singleValueToJSON, convertValue, fromJSONForClient, isSimple, toString
Methods inherited from class org.ametys.core.model.type.AbstractElementType
_compareMultipleValues, _getValueAttributes, _isValueFromXMLMultiple, _useJSONForEdition, _valueToSAX, _valueToSAX, _valueToSAXForEdition, castValue, compareValues, getManagedClass, getManagedClassArray, isCompatible, parseConfiguration, service, valueFromXML, valueToJSONForClient, valueToSAX, valueToSAXForEdition
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.ElementType
castValue, compareValues, fromJSONForClient, getManagedClass, getManagedClassArray, isCompatible, isSimple, parseConfiguration, toString, valueFromXML, valueToJSONForClient
Methods inherited from interface org.ametys.runtime.model.type.ModelItemType
getId, valueToSAX, valueToSAX, valueToSAXForEdition
Methods inherited from interface org.ametys.runtime.plugin.component.PluginAware
setPluginInfo
Methods inherited from interface org.ametys.plugins.repository.data.type.RepositoryElementType
externalizableValueToSAX
Methods inherited from interface org.ametys.plugins.repository.data.type.RepositoryModelItemType
isMultiple
-
Constructor Details
-
DateRepositoryElementType
public DateRepositoryElementType()
-
-
Method Details
-
read
Description copied from interface:RepositoryElementType
Read the value in the given repository data- Specified by:
read
in interfaceRepositoryElementType<LocalDate>
- Parameters:
parentData
- repository data containing the valuename
- the name of the element to read- Returns:
- the value. Can return a T or a T[]. That's why the return type is Object
- Throws:
BadItemTypeException
- if the reading value doesn't match this element type
-
hasValue
Description copied from interface:RepositoryModelItemType
Check if there is a value, even empty, in the given repository data- Specified by:
hasValue
in interfaceRepositoryModelItemType
- Parameters:
parentData
- repository data containing the valuename
- the name of the element to check- Returns:
true
if there is value,false
otherwise- Throws:
BadItemTypeException
- if the reading value doesn't match this element type
-
hasNonEmptyValue
Description copied from interface:RepositoryModelItemType
Check if there is a non empty value in the given repository data- Specified by:
hasNonEmptyValue
in interfaceRepositoryModelItemType
- Parameters:
parentData
- repository data containing the valuename
- the name of the element to check- Returns:
true
if there is a non empty value,false
otherwise- Throws:
BadItemTypeException
- if the reading value doesn't match this element type
-
write
public void write(ModifiableRepositoryData parentData, String name, Object value) throws BadItemTypeException Description copied from interface:RepositoryElementType
Write the value into the given repository data- Specified by:
write
in interfaceRepositoryElementType<LocalDate>
- Parameters:
parentData
- repository where to store the value.name
- the name of the element to writevalue
- the value to write. Can be a T or a T[]. That's why it is an Object- Throws:
BadItemTypeException
- If the given value doesn't match this element type
-
remove
Description copied from interface:RepositoryModelItemType
Remove the value into the given repository data- Specified by:
remove
in interfaceRepositoryModelItemType
- Parameters:
parentData
- repository where the value to remove is stored.name
- the name of the element to remove- Throws:
UnknownDataException
- if the value with the given name does not exist
-
isCompatible
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
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
-
_singleValueFromXML
protected LocalDate _singleValueFromXML(Element element, Optional<Object> additionalData) throws TransformerException, IOException Description copied from class:AbstractElementType
Retrieves a single typed value from the given DOM node- Overrides:
_singleValueFromXML
in classAbstractElementType<LocalDate>
- Parameters:
element
- the DOM element containing the single valueadditionalData
- additional data needed to get the typed value- Returns:
- the value
- Throws:
TransformerException
- if an error occurs while parsing the DOM nodeIOException
- if an error occurs while parsing a value using the I/O API
-
_singleValueToSAX
protected void _singleValueToSAX(ContentHandler contentHandler, String tagName, LocalDate value, Optional<ViewItem> viewItem, DataContext context, AttributesImpl attributes) throws SAXException, IOException Description copied from class:AbstractElementType
Generates SAX events for the given single value- Overrides:
_singleValueToSAX
in classAbstractElementType<LocalDate>
- Parameters:
contentHandler
- theContentHandler
that will receive the SAX eventstagName
- the tag name of the SAX event to generate.value
- the single 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 SAXattributes
- the attributes for the SAX event to generate- Throws:
SAXException
- if an error occurs during the SAX events generationIOException
- if an error occurs while reading a value using the I/O API
-