Class ComposedSingleModelItemsProperty<X extends ModelAwareDataAwareAmetysObject>
- Type Parameters:
X
- Type of ametys object supported by this property
- All Implemented Interfaces:
Comparable<ModelItem>
,Property<String,
,X> CriterionDefinitionAwareElementDefinition<String,
,String, X> IndexationAwareElementDefinition<String,
,X> ElementDefinition<String>
,ModelItem
,PluginAware
,Labelable
,ModifiableLabelable
,Configurable
,Contextualizable
,Serviceable
Property
getting the first available value as string, supporting concatenation with default separator '-'.
For example, with this configuration:
We will first search for "myNumericCode".
<items>
<item ref="myNumericCode"/>
</items>
<items>
<item ref="otherCode"/>
<item ref="linkedContent/code"/>
</items>
<items separator="/">
<item ref="alternativeCode"/>
<item ref="linkedContent/code" optional="true"/>
</items>
If empty, we will search for concatenation of "otherCode" and the "code" item on "linkedContent".
If empty, we will search for concatenation of "alternativeCode" and the "code" item on "linkedContent", even if this one is empty due to the optional attribute.
The first non-empty value is returned.
Otherwise, null is returned.
Referenced items have to be single. If a part of the path is multiple (repeater, multiple references, etc.), it will be rejected by a ConfigurationException
.
-
Field Summary
Fields inherited from class org.ametys.cms.model.properties.AbstractIndexableStaticProperty
_criterionDefinitionHelper, _indexationAwareElementDefinitionHelper
Fields inherited from class org.ametys.cms.model.properties.AbstractStaticProperty
_context
Fields inherited from class org.ametys.runtime.model.DefaultElementDefinition
_logger
Fields inherited from class org.ametys.runtime.model.AbstractModelItem
__context, __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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
configure
(Configuration configuration) protected String
Retrieves the id of the property's typeGet the element's valuevoid
Used to do more initialization, checks...boolean
Test if the element is multiple.Methods inherited from class org.ametys.cms.model.properties.AbstractIndexableStaticProperty
getCriterionType, getCriterionTypeId, getSolrSortFieldName, service
Methods inherited from class org.ametys.cms.model.properties.AbstractStaticProperty
_getNameConfigurationAttribute, _parseAndSetEnumerator, _parseDescription, _parseLabel, _parseName, contextualize
Methods inherited from class org.ametys.cms.model.properties.AbstractProperty
getType, isEditable, setPluginInfo
Methods inherited from class org.ametys.runtime.model.DefaultElementDefinition
_defaultValueToJSON, _getDefaultValues, _getSimpleDefaultValue, _toJSON, _widgetToJSON, _widgetToSAX, getCustomEnumerator, getCustomValidator, getDefaultValue, getEnumerator, 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, getDescription, getDisableConditions, getItemCheckers, getLabel, getModel, getName, getParent, getPath, getPluginName, hashCode, setContext, 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.cms.search.model.CriterionDefinitionAwareElementDefinition
convertQueryValue, getDefaultCriterionEnumerator, getDefaultCriterionOperator, getDefaultCriterionWidget, getDefaultCriterionWidgetParameters, getQuery
Methods inherited from interface org.ametys.runtime.model.ElementDefinition
getCustomEnumerator, getCustomValidator, getDefaultValue, getEnumerator, getEnumeratorConfiguration, getParsedDefaultValues, getValidator, getValidatorConfiguration, isEditable, setCustomEnumerator, setCustomValidator, setDefaultValue, setEnumerator, setEnumeratorConfiguration, setMultiple, setParsedDefaultValues, setValidator, setValidatorConfiguration
Methods inherited from interface org.ametys.cms.search.model.IndexationAwareElementDefinition
getSolrFacetFieldName, getSolrFieldName, getType, indexValue, isFacetable, isSortable
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, 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
-
ComposedSingleModelItemsProperty
public ComposedSingleModelItemsProperty()
-
-
Method Details
-
configure
- Specified by:
configure
in interfaceConfigurable
- Overrides:
configure
in classAbstractStaticProperty<String,
X extends ModelAwareDataAwareAmetysObject> - Throws:
ConfigurationException
-
init
Description copied from interface:Property
Used to do more initialization, checks... needing the role of extension point containing the types available for this property Called byModel
parsing when the model items of all models have been initialized.- Specified by:
init
in interfaceProperty<String,
X extends ModelAwareDataAwareAmetysObject> - Overrides:
init
in classAbstractProperty<String,
X extends ModelAwareDataAwareAmetysObject> - Parameters:
availableTypesRole
- the extension point's role for available types- Throws:
Exception
- if an error occurs or if an additional check fails.
-
getValue
Description copied from interface:IndexationAwareElementDefinition
Get the element's value- Parameters:
dataHolder
- the ametysObject containing the element- Returns:
- the values to index.
-
isMultiple
Description copied from interface:ElementDefinition
Test if the element is multiple.- Specified by:
isMultiple
in interfaceElementDefinition<X extends ModelAwareDataAwareAmetysObject>
- Overrides:
isMultiple
in classDefaultElementDefinition<String>
- Returns:
true
if the metadata is multiple.
-
getTypeId
Description copied from class:AbstractProperty
Retrieves the id of the property's type- Specified by:
getTypeId
in classAbstractProperty<String,
X extends ModelAwareDataAwareAmetysObject> - Returns:
- the id of the property's type
-