Package org.ametys.cms.contenttype
Class AttributeDefinition<T>
- java.lang.Object
-
- org.ametys.runtime.model.AbstractModelItem
-
- org.ametys.runtime.model.ElementDefinition<T>
-
- org.ametys.cms.contenttype.AttributeDefinition<T>
-
- Type Parameters:
T
- Type of the attribute value
- All Implemented Interfaces:
Comparable<ModelItem>
,RestrictedModelItem<Content>
,ModelItem
,Labelable
,ModifiableLabelable
- Direct Known Subclasses:
ContentAttributeDefinition
,RichTextAttributeDefinition
public class AttributeDefinition<T> extends ElementDefinition<T> implements RestrictedModelItem<Content>
The definition of a content type attribute
-
-
Field Summary
-
Fields inherited from class org.ametys.runtime.model.ElementDefinition
_logger, CONFIG_DEFAULT_VALUE_TYPE
-
Fields inherited from class org.ametys.runtime.model.AbstractModelItem
__serviceManager
-
Fields inherited from interface org.ametys.runtime.model.ModelItem
ITEM_PATH_SEPARATOR
-
-
Constructor Summary
Constructors Constructor Description AttributeDefinition()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ExternalizableDataProviderExtensionPoint
_getExternalizableDataProviderExtensionPoint()
Retrieves theExternalizableDataProviderExtensionPoint
protected ContentRestrictedModelItemHelper
_getRestrictedModelItemHelper()
Retrieves the helper forModelItem
s with restrictions on contentsprotected boolean
_shouldJSONBeEmpty(DefinitionContext context)
Checks if the current definition JSON conversion should return an empty mapprotected Map<String,Object>
_toJSON(DefinitionContext context)
Converts the model item in a JSON mapprotected void
_widgetToSAX(ContentHandler contentHandler, DefinitionContext context)
Generates SAX events for the model item's widgetboolean
canRead(Content content)
Determines if the object can be read by the definitionboolean
canWrite(Content content)
Determines if the object can be written by the definitionvoid
setRestrictions(Restrictions restrictions)
Set the restrictions for the attributevoid
toSAX(ContentHandler contentHandler, DefinitionContext context)
Generates SAX events for the model item-
Methods inherited from class org.ametys.runtime.model.ElementDefinition
_getDefaultValue, _getParsedDefaultValues, getCustomEnumerator, getCustomValidator, getDefaultValue, getEnumerator, getEnumeratorConfiguration, getType, getValidator, getValidatorConfiguration, isMultiple, of, setCustomEnumerator, setCustomValidator, setDefaultValue, setEnumerator, setEnumeratorConfiguration, setMultiple, setParsedDefaultValues, setType, setValidator, setValidatorConfiguration
-
Methods inherited from class org.ametys.runtime.model.AbstractModelItem
_widgetParameterToSAX, addItemChecker, compareTo, equals, getDescription, getDisableConditions, getItemCheckers, getLabel, getModel, getName, getParent, getPath, getPluginName, getWidget, getWidgetParameters, hashCode, setDescription, setDisableConditions, setLabel, setModel, setName, setParent, setPluginName, setServiceManager, setWidget, setWidgetParameters, toJSON, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Comparable
compareTo
-
Methods inherited from interface org.ametys.runtime.util.Labelable
getDescription, getLabel, getName
-
Methods inherited from interface org.ametys.runtime.model.ModelItem
addItemChecker, getDisableConditions, getItemCheckers, getModel, getParent, getPath, getPluginName, getType, getWidget, getWidgetParameters, setDisableConditions, setModel, setParent, setPluginName, setType, setWidget, setWidgetParameters, toJSON
-
Methods inherited from interface org.ametys.runtime.util.ModifiableLabelable
setDescription, setLabel, setName
-
-
-
-
Constructor Detail
-
AttributeDefinition
public AttributeDefinition()
-
-
Method Detail
-
setRestrictions
public void setRestrictions(Restrictions restrictions)
Set the restrictions for the attribute- Parameters:
restrictions
- the restrictions to set
-
canRead
public boolean canRead(Content content)
Description copied from interface:RestrictedModelItem
Determines if the object can be read by the definition- Specified by:
canRead
in interfaceRestrictedModelItem<T>
- Parameters:
content
- the object- Returns:
- true if the object can be read by the definition, false otherwise
-
canWrite
public boolean canWrite(Content content)
Description copied from interface:RestrictedModelItem
Determines if the object can be written by the definition- Specified by:
canWrite
in interfaceRestrictedModelItem<T>
- Parameters:
content
- the object- Returns:
- true if the object can be written by the definition, false otherwise
-
_getRestrictedModelItemHelper
protected ContentRestrictedModelItemHelper _getRestrictedModelItemHelper()
Retrieves the helper forModelItem
s with restrictions on contents- Returns:
- the
ContentRestrictedModelItemHelper
-
_toJSON
protected Map<String,Object> _toJSON(DefinitionContext context) throws ProcessingException
Description copied from class:AbstractModelItem
Converts the model item in a JSON map- Overrides:
_toJSON
in classElementDefinition<T>
- Parameters:
context
- the context of the definition- Returns:
- The model item as a JSON map
- Throws:
ProcessingException
- If an error occurs when converting the model item
-
_shouldJSONBeEmpty
protected boolean _shouldJSONBeEmpty(DefinitionContext context)
Description copied from class:AbstractModelItem
Checks if the current definition JSON conversion should return an empty map- Overrides:
_shouldJSONBeEmpty
in classAbstractModelItem
- Parameters:
context
- the context of the definition- Returns:
true
if the JSON conversion should return an empty map,false
otherwise
-
toSAX
public void toSAX(ContentHandler contentHandler, DefinitionContext context) throws SAXException
Description copied from interface:ModelItem
Generates SAX events for the model item- Specified by:
toSAX
in interfaceModelItem
- Overrides:
toSAX
in classElementDefinition<T>
- Parameters:
contentHandler
- theContentHandler
that will receive the SAX eventscontext
- the context of the definition- Throws:
SAXException
- if an error occurs during the SAX events generation
-
_widgetToSAX
protected void _widgetToSAX(ContentHandler contentHandler, DefinitionContext context) throws SAXException
Description copied from class:AbstractModelItem
Generates SAX events for the model item's widget- Overrides:
_widgetToSAX
in classAbstractModelItem
- Parameters:
contentHandler
- theContentHandler
that will receive the SAX eventscontext
- the context of the definition- Throws:
SAXException
- if an error occurs during the SAX events generation
-
_getExternalizableDataProviderExtensionPoint
protected ExternalizableDataProviderExtensionPoint _getExternalizableDataProviderExtensionPoint()
Retrieves theExternalizableDataProviderExtensionPoint
- Returns:
- the
ExternalizableDataProviderExtensionPoint
-
-