Package org.ametys.cms.model.properties
Class ElementRefProperty<T,X extends ModelAwareDataAwareAmetysObject>
java.lang.Object
org.ametys.runtime.model.AbstractModelItem
org.ametys.runtime.model.DefaultElementDefinition<T>
org.ametys.cms.model.properties.AbstractProperty<T,X>
org.ametys.cms.model.properties.ElementRefProperty<T,X>
- Type Parameters:
T
- Type of the element valueX
- type of ametys object supported by this property
- All Implemented Interfaces:
Comparable<ModelItem>
,Property<T,
,X> ElementDefinition<T>
,ModelItem
,PluginAware
,Labelable
,ModifiableLabelable
,Configurable
- Direct Known Subclasses:
AbstractMultiValuesProperty
public class ElementRefProperty<T,X extends ModelAwareDataAwareAmetysObject>
extends AbstractProperty<T,X>
Property referencing an
ElementDefinition
-
Field Summary
Fields inherited from class org.ametys.cms.model.properties.AbstractProperty
_availableTypesExtensionPoint
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
-
Method Summary
Modifier and TypeMethodDescriptionprotected String
Retrieves the id of the property's typeprotected I18nizableText
_parseI18nizableText
(Configuration config, String pluginName, String name) Parse an i18n text.void
configure
(Configuration configuration) protected void
configureReferencedElementPath
(Configuration configuration) Configures the path of the referenced elementgetCriterionEnumerator
(Configuration configuration, ThreadSafeComponentManager<Enumerator> enumeratorManager) Get the enumerator to use when rendering this element as a criterionGet the default widget to use when rendering this item as a criterion.getCriterionWidgetParameters
(Configuration configuration) Get the widget parameters to use when rendering this item as a criterion.Retrieves the description.Retrieves the referenced element definitionRetrieves the path of the referenced element definitionRetrieves the enumerator.getLabel()
Retrieves the label.getName()
Get the name.Get the property's valuevoid
indexValue
(org.apache.solr.common.SolrInputDocument document, X ametysObject, IndexableDataContext context) Index the property in a solr document.boolean
Test if the element is multiple.void
setElementPath
(String elementPath) Set the path of the referenced element definitionMethods inherited from class org.ametys.cms.model.properties.AbstractProperty
_getNameConfigurationAttribute, getType, isEditable, setAvailableTypeExtensionPoint, setPluginInfo
Methods inherited from class org.ametys.runtime.model.DefaultElementDefinition
_getDefaultValues, _toJSON, _widgetToJSON, _widgetToSAX, getCustomEnumerator, getCustomValidator, getDefaultValue, getEnumeratorConfiguration, getParsedDefaultValues, getValidator, getValidatorConfiguration, getWidget, getWidgetParameters, of, setCustomEnumerator, setCustomValidator, setDefaultValue, setEnumerator, setEnumeratorConfiguration, setMultiple, setParsedDefaultValues, setType, setValidator, setValidatorConfiguration, setWidget, setWidgetParameters, toSAX
Methods inherited from class org.ametys.runtime.model.AbstractModelItem
_getModelItemHelper, _shouldJSONBeEmpty, _widgetParameterToSAX, addItemChecker, compareTo, disableConditionsToJSON, equals, getDisableConditions, getItemCheckers, getModel, 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
getCustomEnumerator, getCustomValidator, getDefaultValue, getEnumeratorConfiguration, getParsedDefaultValues, getValidator, getValidatorConfiguration, setCustomEnumerator, setCustomValidator, setDefaultValue, setEnumerator, setEnumeratorConfiguration, setMultiple, setParsedDefaultValues, setValidator, setValidatorConfiguration
Methods inherited from interface org.ametys.runtime.model.ModelItem
addItemChecker, getDisableConditions, getItemCheckers, getModel, getParent, getPath, getPluginName, getWidget, getWidgetParameters, setDisableConditions, setModel, setParent, setPluginName, setType, setWidget, setWidgetParameters, toJSON, toSAX
Methods inherited from interface org.ametys.runtime.util.ModifiableLabelable
setDescription, setLabel, setName
Methods inherited from interface org.ametys.cms.model.properties.Property
valueToJSON, valueToSAX
-
Constructor Details
-
ElementRefProperty
public ElementRefProperty()
-
-
Method Details
-
configure
- Specified by:
configure
in interfaceConfigurable
- Overrides:
configure
in classAbstractProperty<T,
X extends ModelAwareDataAwareAmetysObject> - Throws:
ConfigurationException
-
_parseI18nizableText
protected I18nizableText _parseI18nizableText(Configuration config, String pluginName, String name) throws ConfigurationException Description copied from class:AbstractProperty
Parse an i18n text.- Overrides:
_parseI18nizableText
in classAbstractProperty<T,
X extends ModelAwareDataAwareAmetysObject> - Parameters:
config
- the configuration to use.pluginName
- the current plugin name.name
- the child name.- Returns:
- the i18n text.
- Throws:
ConfigurationException
- if the configuration is not valid.
-
configureReferencedElementPath
protected void configureReferencedElementPath(Configuration configuration) throws ConfigurationException Configures the path of the referenced element- Parameters:
configuration
- the property configuration- Throws:
ConfigurationException
- if an error occurred
-
getName
Description copied from interface:Labelable
Get the name.- Specified by:
getName
in interfaceLabelable
- Overrides:
getName
in classAbstractModelItem
- Returns:
- the name.
-
getLabel
Description copied from interface:Labelable
Retrieves the label.- Specified by:
getLabel
in interfaceLabelable
- Overrides:
getLabel
in classAbstractModelItem
- Returns:
- the label.
-
getDescription
Description copied from interface:Labelable
Retrieves the description.- Specified by:
getDescription
in interfaceLabelable
- Overrides:
getDescription
in classAbstractModelItem
- Returns:
- the description.
-
getEnumerator
Description copied from interface:ElementDefinition
Retrieves the enumerator.- Specified by:
getEnumerator
in interfaceElementDefinition<T>
- Overrides:
getEnumerator
in classDefaultElementDefinition<T>
- Returns:
- the enumerator or
null
if none is defined.
-
getElementDefinition
Retrieves the referenced element definition- Returns:
- the referenced element definition
-
getValue
Description copied from interface:Property
Get the property's value- Parameters:
ametysObject
- the ametysObject containing the property- Returns:
- the values to index.
-
indexValue
public void indexValue(org.apache.solr.common.SolrInputDocument document, X ametysObject, IndexableDataContext context) Description copied from interface:Property
Index the property in a solr document.- Parameters:
document
- the solr document to index into.ametysObject
- the ametysObject containing the property to index.context
- the context of the data to index. Can not be null.
-
isMultiple
Description copied from interface:ElementDefinition
Test if the element is multiple.- Specified by:
isMultiple
in interfaceElementDefinition<T>
- Overrides:
isMultiple
in classDefaultElementDefinition<T>
- Returns:
true
if the metadata is multiple.
-
getElementPath
Retrieves the path of the referenced element definition- Returns:
- the path of the referenced element definition
-
setElementPath
Set the path of the referenced element definition- Parameters:
elementPath
- the path to set
-
_getTypeId
Description copied from class:AbstractProperty
Retrieves the id of the property's type- Specified by:
_getTypeId
in classAbstractProperty<T,
X extends ModelAwareDataAwareAmetysObject> - Returns:
- the id of the property's type
-
getCriterionEnumerator
public Enumerator getCriterionEnumerator(Configuration configuration, ThreadSafeComponentManager<Enumerator> enumeratorManager) throws ConfigurationException Description copied from interface:ElementDefinition
Get the enumerator to use when rendering this element as a criterion- Parameters:
configuration
- The enumerator configuration.enumeratorManager
- ComponentManager for the criterion'sEnumerator
- Returns:
- The enumerator or null if the element'critérion is not enumerated.
- Throws:
ConfigurationException
- If an error occurs while initializing the enumerator
-
getCriterionWidget
Description copied from interface:ModelItem
Get the default widget to use when rendering this item as a criterion.- Returns:
- The default widget to use, or
null
if no specific widget is necessary.
-
getCriterionWidgetParameters
Description copied from interface:ModelItem
Get the widget parameters to use when rendering this item as a criterion.- Parameters:
configuration
- The widget parameters configuration- Returns:
- The default widget parameters to use, or an empty Map if no specific widget parameters are necessary.
-