Package org.ametys.core.model.type
Class AbstractDateElementType
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
- All Implemented Interfaces:
ElementType<LocalDate>
,ModelItemType
,LogEnabled
,PluginAware
,Component
,Serviceable
- Direct Known Subclasses:
DateRepositoryElementType
,DateXMLElementType
Abstract class for date element types
-
Field Summary
Fields inherited from class org.ametys.core.model.type.AbstractElementType
_jsonUtils
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected Stream<Triple<DataChangeType,
DataChangeTypeDetail, String>> _compareSingleValues
(LocalDate value1, LocalDate value2) Compares the given single values and retrieves the changes as a stream ofTriple
s.protected Object
_singleValueToJSON
(LocalDate value, DataContext context) Convert the single value into a JSON objectconvertValue
(Object value) Try to convert the given value, that is not of the managed typefromJSONForClient
(Object json, DataContext context) Convert the given client side JSON object to the types valueboolean
isSimple()
Determines if this type is simple or not.Cast a typed value to a StringMethods inherited from class org.ametys.core.model.type.AbstractElementType
_compareMultipleValues, _getValueAttributes, _isMultiple, _isSingle, _isValueFromXMLMultiple, _singleValueFromXML, _singleValueToJSONForEdition, _singleValueToSAX, _useJSONForEdition, _valueToJSON, _valueToSAX, _valueToSAX, _valueToSAXForEdition, castValue, compareValues, getManagedClass, getManagedClassArray, isCompatible, parseConfiguration, service, valueFromXML, valueToJSONForClient, valueToJSONForEdition, 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.ModelItemType
getId, valueToSAX
Methods inherited from interface org.ametys.runtime.plugin.component.PluginAware
setPluginInfo
-
Constructor Details
-
AbstractDateElementType
public AbstractDateElementType()
-
-
Method Details
-
convertValue
Description copied from class:AbstractElementType
Try to convert the given value, that is not of the managed type- Overrides:
convertValue
in classAbstractElementType<LocalDate>
- Parameters:
value
- the value to convert- Returns:
- the converted value or null if it's not possible.
- Throws:
BadItemTypeException
- if the given value is not compatible with the current type
-
toString
Description copied from interface:ElementType
Cast a typed value to a String- Specified by:
toString
in interfaceElementType<LocalDate>
- Overrides:
toString
in classAbstractElementType<LocalDate>
- Parameters:
value
- the value to cast- Returns:
- the String representation of the value
-
fromJSONForClient
Description copied from interface:ElementType
Convert the given client side JSON object to the types value- Parameters:
json
- the JSON object to convertcontext
- the context of the data to retrieve- Returns:
- the typed value corresponding to the JSON object
-
_singleValueToJSON
Description copied from class:AbstractElementType
Convert the single value into a JSON object- Overrides:
_singleValueToJSON
in classAbstractElementType<LocalDate>
- Parameters:
value
- the value to convertcontext
- The context of the data to convert- Returns:
- The value as JSON
-
_compareSingleValues
protected Stream<Triple<DataChangeType,DataChangeTypeDetail, _compareSingleValuesString>> (LocalDate value1, LocalDate value2) Description copied from class:AbstractElementType
Compares the given single values and retrieves the changes as a stream ofTriple
s. TheTriple
contains:- the general type of the change (added, modified or removed) as a
DataChangeType
, - some details about this change if possible (after or before for a date, more or less for a number, ...) as a
DataChangeTypeDetail
- The data concerned by this change if not the element itself (or an empty String)
- Overrides:
_compareSingleValues
in classAbstractElementType<LocalDate>
- Parameters:
value1
- the 1st single valuevalue2
- the 2nd single value- Returns:
- the changes between the two given single values as a stream of
Triple
. Retrieves an empty stream if there is no change
- the general type of the change (added, modified or removed) as a
-
isSimple
Description copied from interface:ElementType
Determines if this type is simple or not. A simple element type is a type of elements that can be edited in a grid- Returns:
true
if the type is simple,false
otherwise
-