Package org.ametys.cms.data.type.impl
Class RichTextRepositoryElementType
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.core.model.type.AbstractModelItemType
-
- org.ametys.core.model.type.AbstractElementType<RichText>
-
- org.ametys.cms.data.type.AbstractRichTextElementType
-
- org.ametys.cms.data.type.impl.RichTextRepositoryElementType
-
- All Implemented Interfaces:
ComplexRepositoryElementType<RichText>
,RepositoryElementType<RichText>
,RepositoryModelItemType
,ElementType<RichText>
,ModelItemType
,LogEnabled
,PluginAware
,Component
,Serviceable
- Direct Known Subclasses:
HTMLRichTextRepositoryElementType
,RichTextContentElementType
public class RichTextRepositoryElementType extends AbstractRichTextElementType implements ComplexRepositoryElementType<RichText>
Class for rich text type of elements stored in the repository
-
-
Field Summary
Fields Modifier and Type Field Description private static String
__ANNOTATIONS_IDENTIFIER
private static String
__FILE_CONTENT_IDENTIFIER
private static String
__FOLDER_IDENTIFIER
-
Fields inherited from class org.ametys.cms.data.type.AbstractRichTextElementType
_manager, _richTextHandlerFactory, _richTextTransformer
-
Fields inherited from class org.ametys.core.model.type.AbstractElementType
_jsonUtils
-
Fields inherited from interface org.ametys.plugins.repository.data.type.ComplexRepositoryElementType
TYPE_ID_DATA_NAME
-
Fields inherited from interface org.ametys.plugins.repository.data.type.RepositoryModelItemType
EMPTY_METADATA_SUFFIX
-
-
Constructor Summary
Constructors Constructor Description RichTextRepositoryElementType()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private ModifiableRepositoryData
_getFileResourceRepositoryData(ModifiableRepositoryData folderData, String filename)
private String
_richTextAsString(RichText richText)
private void
_writeAnnotations(ModifiableRepositoryData richTextData, Map<String,List<String>> annotations)
private void
_writeAttachments(ModifiableRepositoryData richTextData, RichText richText)
void
emptySingleValue(ModifiableRepositoryData parentData, String name)
Empties the single value into the given repositoryData This method is called by theComplexRepositoryElementType.write(ModifiableRepositoryData, String, Object)
method, when the given value isnull
Object
externalizableValueToSAX(Object value, DataContext context)
Retrieve the value to SAX for externalizable dataString
getRepositoryDataType()
Retrieves the type of repository data used for this typeboolean
isSingleValueEmpty(RepositoryData singleValueData)
Checks if the single value is emptyRichText
readSingleValue(RepositoryData singleValueData)
Read the single value in the given repository databoolean
removeValueBeforeWritingIt()
Determines if the existing value has to be removed before writing the new onevoid
writeSingleValue(ModifiableRepositoryData parentData, String name, RichText value)
Write the single value into the given repository data This method is called by theComplexRepositoryElementType.write(ModifiableRepositoryData, String, Object)
method, once for each value if the value is an array-
Methods inherited from class org.ametys.cms.data.type.AbstractRichTextElementType
_compareMultipleValues, _compareSingleValues, _singleValueFromXML, _singleValueToJSON, _singleValueToSAX, _valueToSAXForEdition, convertValue, fromJSONForClient, isSimple, service, toString
-
Methods inherited from class org.ametys.core.model.type.AbstractElementType
_getValueAttributes, _isValueFromXMLMultiple, _useJSONForEdition, _valueToSAX, _valueToSAX, castValue, compareValues, getManagedClass, getManagedClassArray, isCompatible, parseConfiguration, 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.plugins.repository.data.type.ComplexRepositoryElementType
hasNonEmptyValue, isCompatible, read, write
-
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.RepositoryModelItemType
hasValue, isMultiple, remove
-
-
-
-
Field Detail
-
__ANNOTATIONS_IDENTIFIER
private static final String __ANNOTATIONS_IDENTIFIER
- See Also:
- Constant Field Values
-
__FOLDER_IDENTIFIER
private static final String __FOLDER_IDENTIFIER
- See Also:
- Constant Field Values
-
__FILE_CONTENT_IDENTIFIER
private static final String __FILE_CONTENT_IDENTIFIER
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RichTextRepositoryElementType
public RichTextRepositoryElementType()
-
-
Method Detail
-
isSingleValueEmpty
public boolean isSingleValueEmpty(RepositoryData singleValueData)
Description copied from interface:ComplexRepositoryElementType
Checks if the single value is empty- Specified by:
isSingleValueEmpty
in interfaceComplexRepositoryElementType<RichText>
- Parameters:
singleValueData
- repository data containing the value to check- Returns:
true
if the value is empty,false
otherwise
-
readSingleValue
public RichText readSingleValue(RepositoryData singleValueData)
Description copied from interface:ComplexRepositoryElementType
Read the single value in the given repository data- Specified by:
readSingleValue
in interfaceComplexRepositoryElementType<RichText>
- Parameters:
singleValueData
- repository data containing the value- Returns:
- the value. Can return null if the given data does not contain the necessary elements
-
emptySingleValue
public void emptySingleValue(ModifiableRepositoryData parentData, String name)
Description copied from interface:ComplexRepositoryElementType
Empties the single value into the given repositoryData This method is called by theComplexRepositoryElementType.write(ModifiableRepositoryData, String, Object)
method, when the given value isnull
- Specified by:
emptySingleValue
in interfaceComplexRepositoryElementType<RichText>
- Parameters:
parentData
- repository where to empty the single value.name
- the name of the element to empty
-
writeSingleValue
public void writeSingleValue(ModifiableRepositoryData parentData, String name, RichText value)
Description copied from interface:ComplexRepositoryElementType
Write the single value into the given repository data This method is called by theComplexRepositoryElementType.write(ModifiableRepositoryData, String, Object)
method, once for each value if the value is an array- Specified by:
writeSingleValue
in interfaceComplexRepositoryElementType<RichText>
- 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
-
_writeAnnotations
private void _writeAnnotations(ModifiableRepositoryData richTextData, Map<String,List<String>> annotations)
-
_writeAttachments
private void _writeAttachments(ModifiableRepositoryData richTextData, RichText richText)
-
_getFileResourceRepositoryData
private ModifiableRepositoryData _getFileResourceRepositoryData(ModifiableRepositoryData folderData, String filename)
-
externalizableValueToSAX
public Object externalizableValueToSAX(Object value, DataContext context)
Description copied from interface:RepositoryElementType
Retrieve the value to SAX for externalizable data- Specified by:
externalizableValueToSAX
in interfaceRepositoryElementType<RichText>
- Parameters:
value
- the value to SAX This view item gives context for the SAX event that will be generated here.context
- The context of the data to SAX- Returns:
- the value to SAX for externalizable data
-
_richTextAsString
private String _richTextAsString(RichText richText)
-
removeValueBeforeWritingIt
public boolean removeValueBeforeWritingIt()
Description copied from interface:ComplexRepositoryElementType
Determines if the existing value has to be removed before writing the new one- Specified by:
removeValueBeforeWritingIt
in interfaceComplexRepositoryElementType<RichText>
- Returns:
true
if the previous value has to be removed,false
otherwise
-
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
-
-