Package org.ametys.cms.contenttype
Class ContentAttributeDefinition
java.lang.Object
org.ametys.runtime.model.AbstractModelItem
org.ametys.runtime.model.DefaultElementDefinition<T>
org.ametys.cms.contenttype.AttributeDefinition<ContentValue>
org.ametys.cms.contenttype.ContentAttributeDefinition
- All Implemented Interfaces:
Comparable<ModelItem>
,ContentElementDefinition
,RestrictedModelItem<Content>
,ElementDefinition<ContentValue>
,ModelItem
,ModelItemAccessor
,Labelable
,ModifiableLabelable
public class ContentAttributeDefinition
extends AttributeDefinition<ContentValue>
implements ContentElementDefinition
Definition of content types attributes of type Content
-
Field Summary
Fields inherited from class org.ametys.runtime.model.DefaultElementDefinition
_logger
Fields inherited from class org.ametys.runtime.model.AbstractModelItem
__serviceManager
Fields inherited from interface org.ametys.runtime.model.ElementDefinition
CONFIG_DEFAULT_VALUE_TYPE
Fields inherited from interface org.ametys.runtime.model.ModelItem
ITEM_PATH_SEPARATOR
-
Constructor Summary
ConstructorDescriptionContentAttributeDefinition
(ContentTypeExtensionPoint contentTypeExtensionPoint, ContentTypesHelper contentAttributeTypeExtensionPoint) Defintion's constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected ContentValue
_getDefaultValue
(String defaultValueType, Object parsedDefaultValue) Retrieves the default value from the parsed one, according to the type of the default value_toJSON
(DefinitionContext context) Converts the model item in a JSON mapvoid
Checks the default value of this definitionGet the element's content type identifier.boolean
Returns true if mutual relationship should be set regardless of user's rightsGet the element's mutual relationship path.Collection<? extends ModelItem>
Retrieves all the model items of this accessorvoid
setContentTypeId
(String contentTypeId) Set the element's content type identifier.void
setForceInvert
(boolean force) Force mutual relationship regardless of user's rights (only applicable for an element with invert relation path).void
setInvertRelationPath
(String invertRelationPath) Set the element's mutual relationship path.void
toSAX
(ContentHandler contentHandler, DefinitionContext context) Generates SAX events for the model itemMethods inherited from class org.ametys.cms.contenttype.AttributeDefinition
_getExternalizableDataProviderExtensionPoint, _getRestrictedModelItemHelper, _shouldJSONBeEmpty, _widgetToSAX, canRead, canWrite, setRestrictions
Methods inherited from class org.ametys.runtime.model.DefaultElementDefinition
_getParsedDefaultValues, getCustomEnumerator, getCustomValidator, getDefaultValue, getEnumerator, getEnumeratorConfiguration, getType, getValidator, getValidatorConfiguration, getWidget, getWidgetParameters, isMultiple, of, setCustomEnumerator, setCustomValidator, setDefaultValue, setEnumerator, setEnumeratorConfiguration, setMultiple, setParsedDefaultValues, setType, setValidator, setValidatorConfiguration, setWidget, setWidgetParameters
Methods inherited from class org.ametys.runtime.model.AbstractModelItem
_widgetParameterToSAX, addItemChecker, compareTo, equals, getDescription, getDisableConditions, getItemCheckers, getLabel, getModel, getName, getParent, getPath, getPluginName, hashCode, setDescription, setDisableConditions, setLabel, setModel, setName, setParent, setPluginName, setServiceManager, 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.model.ElementDefinition
_getParsedDefaultValues, getCriterionEnumerator, getCustomEnumerator, getCustomValidator, getDefaultValue, getEnumerator, getEnumeratorConfiguration, getType, getValidator, getValidatorConfiguration, isEditable, isMultiple, setCustomEnumerator, setCustomValidator, setDefaultValue, setEnumerator, setEnumeratorConfiguration, setMultiple, setParsedDefaultValues, setValidator, setValidatorConfiguration
Methods inherited from interface org.ametys.runtime.util.Labelable
getDescription, getLabel, getName
Methods inherited from interface org.ametys.runtime.model.ModelItem
addItemChecker, getCriterionWidget, getCriterionWidgetParameters, getDisableConditions, getItemCheckers, getModel, getParent, getPath, getPluginName, getWidget, getWidgetParameters, setDisableConditions, setModel, setParent, setPluginName, setType, setWidget, setWidgetParameters, toJSON
Methods inherited from interface org.ametys.runtime.model.ModelItemAccessor
getChild, getModelItem, hasModelItem
Methods inherited from interface org.ametys.runtime.util.ModifiableLabelable
setDescription, setLabel, setName
-
Field Details
-
ATTRIBUTE_DEFAULT_VALUE_TYPE
attribute type for default values- See Also:
-
-
Constructor Details
-
ContentAttributeDefinition
public ContentAttributeDefinition(ContentTypeExtensionPoint contentTypeExtensionPoint, ContentTypesHelper contentAttributeTypeExtensionPoint) Defintion's constructor- Parameters:
contentTypeExtensionPoint
- the content type extension pointcontentAttributeTypeExtensionPoint
- the content attribute type extension point
-
-
Method Details
-
getContentTypeId
Description copied from interface:ContentElementDefinition
Get the element's content type identifier.- Specified by:
getContentTypeId
in interfaceContentElementDefinition
- Returns:
- the element's content type identifier.
-
setContentTypeId
Description copied from interface:ContentElementDefinition
Set the element's content type identifier.- Specified by:
setContentTypeId
in interfaceContentElementDefinition
- Parameters:
contentTypeId
- the content type identifier to set.
-
checkDefaultValue
Checks the default value of this definition- Throws:
ConfigurationException
- if there is a problem with default value declaration
-
_getDefaultValue
Description copied from class:DefaultElementDefinition
Retrieves the default value from the parsed one, according to the type of the default value- Overrides:
_getDefaultValue
in classDefaultElementDefinition<ContentValue>
- Parameters:
defaultValueType
- the type of the default valueparsedDefaultValue
- the parsed default value (can be anI18nizableText
, a config parameter name, ... depending on the default value type)- Returns:
- the default value.
-
getInvertRelationPath
Get the element's mutual relationship path.- Returns:
- the element's mutual relationship path.
-
setInvertRelationPath
Set the element's mutual relationship path.- Parameters:
invertRelationPath
- the element's mutual relationship path, separated by slashes.
-
setForceInvert
Force mutual relationship regardless of user's rights (only applicable for an element with invert relation path).- Parameters:
force
- true to force mutual relationship regardless of user's rights
-
getForceInvert
Returns true if mutual relationship should be set regardless of user's rights- Returns:
- true if mutual relationship should be set regardless of user's rights
-
getModelItems
Description copied from interface:ModelItemAccessor
Retrieves all the model items of this accessor- Specified by:
getModelItems
in interfaceContentElementDefinition
- Specified by:
getModelItems
in interfaceModelItemAccessor
- Returns:
- the model items
-
_toJSON
Description copied from class:AbstractModelItem
Converts the model item in a JSON map- Overrides:
_toJSON
in classAttributeDefinition<ContentValue>
- 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
-
toSAX
Description copied from interface:ModelItem
Generates SAX events for the model item- Specified by:
toSAX
in interfaceModelItem
- Overrides:
toSAX
in classAttributeDefinition<ContentValue>
- 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
-