Interface ComplexRepositoryElementType<T>
- Type Parameters:
T
- Type of the element value
- All Superinterfaces:
ElementType<T>
,ModelItemType
,PluginAware
,RepositoryElementType<T>
,RepositoryModelItemType
- All Known Implementing Classes:
BinaryRepositoryElementType
,GeocodeRepositoryElementType
,HTMLRichTextContentElementType
,HTMLRichTextRepositoryElementType
,MultilingualStringRepositoryElementType
,ReferenceContentElementType
,ReferenceRepositoryElementType
,RichTextContentElementType
,RichTextRepositoryElementType
,UserRepositoryElementType
Interface for complex types of elements stored in the repository
The complex types ares those which need nodes to be stored
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Data name for storing the type identifier of an element with multiple valuesFields inherited from interface org.ametys.plugins.repository.data.type.RepositoryModelItemType
EMPTY_METADATA_SUFFIX
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
emptySingleValue
(ModifiableRepositoryData parentData, String name) Empties the single value into the given repositoryData This method is called by thewrite(ModifiableRepositoryData, String, Object)
method, when the given value isnull
default boolean
hasNonEmptyValue
(RepositoryData parentData, String name) Check if there is a non empty value in the given repository datadefault boolean
isCompatible
(RepositoryData parentData, String name) Checks if the value in the given repository data is compatible with the item typeboolean
isSingleValueEmpty
(RepositoryData singleValueData) Checks if the single value is emptydefault Object
read
(RepositoryData parentData, String name) Read the value in the given repository datareadSingleValue
(RepositoryData singleValueData) Read the single value in the given repository datadefault boolean
Determines if the existing value has to be removed before writing the new onedefault void
write
(ModifiableRepositoryData parentData, String name, Object value) Write the value into the given repository datavoid
writeSingleValue
(ModifiableRepositoryData parentData, String name, T value) Write the single value into the given repository data This method is called by thewrite(ModifiableRepositoryData, String, Object)
method, once for each value if the value is an arrayMethods inherited from interface org.ametys.runtime.model.type.ElementType
castValue, compareValues, fromJSONForClient, getManagedClass, getManagedClassArray, isCompatible, isSimple, parseConfiguration, toString, valueFromXML, valueToJSONForClient, valueToJSONForEdition
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
getRepositoryDataType, hasValue, isMultiple, remove
-
Field Details
-
TYPE_ID_DATA_NAME
Data name for storing the type identifier of an element with multiple values- See Also:
-
-
Method Details
-
read
Description copied from interface:RepositoryElementType
Read the value in the given repository data- Specified by:
read
in interfaceRepositoryElementType<T>
- 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
-
hasNonEmptyValue
default boolean hasNonEmptyValue(RepositoryData parentData, String name) throws BadItemTypeException 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
-
isSingleValueEmpty
Checks if the single value is empty- Parameters:
singleValueData
- repository data containing the value to check- Returns:
true
if the value is empty,false
otherwise
-
readSingleValue
Read the single value in the given repository data- Parameters:
singleValueData
- repository data containing the value- Returns:
- the value. Can return null if the given data does not contain the necessary elements
-
write
default 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<T>
- 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
-
removeValueBeforeWritingIt
Determines if the existing value has to be removed before writing the new one- Returns:
true
if the previous value has to be removed,false
otherwise
-
emptySingleValue
Empties the single value into the given repositoryData This method is called by thewrite(ModifiableRepositoryData, String, Object)
method, when the given value isnull
- Parameters:
parentData
- repository where to empty the single value.name
- the name of the element to empty
-
writeSingleValue
Write the single value into the given repository data This method is called by thewrite(ModifiableRepositoryData, String, Object)
method, once for each value if the value is an array- Parameters:
parentData
- repository where to store the single value.name
- the name of the element to writevalue
- the single value to write. Can be null. In this case, an empty data must be created
-
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
-