Class MetadataSearchUIColumn
- java.lang.Object
-
- org.ametys.runtime.parameter.Parameter<MetadataType>
-
- org.ametys.cms.search.ui.model.impl.AbstractSearchUIColumn
-
- org.ametys.cms.search.ui.model.impl.MetadataSearchUIColumn
-
- All Implemented Interfaces:
Field
,MetadataResultField
,ResultField
,SearchUIColumn
,Configurable
,Serviceable
public class MetadataSearchUIColumn extends AbstractSearchUIColumn implements MetadataResultField, Serviceable, Configurable
Default implementation of a search ui column for a content's attribute
-
-
Field Summary
Fields Modifier and Type Field Description protected ModelItem
_attribute
The attribute represented by the columnprotected Collection<String>
_contentTypes
The types of the content on which this attribute column appliesprotected ContentTypeExtensionPoint
_cTypeEP
The content type extension point.protected ContentTypesHelper
_cTypeHelper
The content type helper.protected String
_fullAttributePath
The full attribute path.private boolean
_isTypeContentWithMultilingualTitle
protected boolean
_joinedAttribute
True if the attribute is joined, false otherwise.protected ContentSearchHelper
_searchHelper
The search helper.
-
Constructor Summary
Constructors Constructor Description MetadataSearchUIColumn()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private List<ModelItem>
_configureModelItems(Set<String> contentTypeIds, String attributePath)
private MetadataDefinition
_getMetadataDefinition(Set<String> contentTypeIds, String metadataPath)
private boolean
_isAttributeMultiple(ModelItem attribute)
protected boolean
_isEditable(Configuration configuration, ModelItem attribute, boolean multiLevelMultiple)
Computed editable status of this column from its attribute definition and configurationprotected boolean
_isSortable(Configuration configuration, ModelItem attribute, boolean multiplePath)
Computed sortable status of this column from its attribute definition and configurationprotected boolean
_isSortableMetadata(ModelItem attribute)
Determines if the column is sortable according its attribute definitionvoid
configure(Configuration configuration)
protected void
configureConverter(String converter, ModelItem attribute)
Configure the column converter.protected void
configureRenderer(String renderer, ModelItem attribute)
Configure the column renderer.Collection<String>
getContentTypes()
Get the content types of the contents on which this attribute column appliesString
getFieldPath()
Get the path of attribute (separated by '/')Object
getFullValue(Content content, Locale defaultLocale)
Get the value represented by this field in the given result content.SearchField
getSearchField()
Get theSearchField
representing this result field.Object
getValue(Content content, Locale defaultLocale)
Get the value represented by this field in the given result content.protected boolean
isEditionAllowed(ModelItem attribute)
Determines if the inline edition is allowedboolean
isJoinedAttribute()
Determines if this column is a path to a joined attributeboolean
isTypeContentWithMultilingualTitle()
Determines if this column represents a CONTENT attribute with a multilingual titlevoid
service(ServiceManager manager)
void
setContentTypes(Collection<String> contentTypes)
Set the content types of the contents on which this attribute column appliesvoid
setFieldPath(String attributePath)
Set the attribute pathvoid
setJoinedAttribute(boolean joinedAttribute)
Set if this column is a path to a joined attributevoid
setTypeContentWithMultilingualTitle(boolean multilingual)
Set if this column represents a CONTENT attribute with a multilingual title-
Methods inherited from class org.ametys.cms.search.ui.model.impl.AbstractSearchUIColumn
_configureI18nizableText, getContentTypeId, getConverter, getDefaultSorter, getRenderer, getWidth, isEditable, isHidden, isMultiple, isSortable, setContentTypeId, setConverter, setDefaultSorter, setEditable, setHidden, setMultiple, setRenderer, setSortable, setWidth
-
Methods inherited from class org.ametys.runtime.parameter.Parameter
getDefaultValue, getDescription, getEnumerator, getId, getLabel, getPluginName, getType, getValidator, getWidget, getWidgetParameters, setDefaultValue, setDescription, setEnumerator, setId, setLabel, setPluginName, setType, setValidator, setWidget, setWidgetParameters
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.ametys.cms.search.model.Field
getContentTypeId, getEnumerator, getType, isMultiple
-
Methods inherited from interface org.ametys.cms.search.model.ResultField
getId
-
Methods inherited from interface org.ametys.cms.search.ui.model.SearchUIColumn
getDescription, getLabel, getValidator, getWidget, getWidgetParameters
-
-
-
-
Field Detail
-
_cTypeEP
protected ContentTypeExtensionPoint _cTypeEP
The content type extension point.
-
_cTypeHelper
protected ContentTypesHelper _cTypeHelper
The content type helper.
-
_searchHelper
protected ContentSearchHelper _searchHelper
The search helper.
-
_fullAttributePath
protected String _fullAttributePath
The full attribute path.
-
_joinedAttribute
protected boolean _joinedAttribute
True if the attribute is joined, false otherwise.
-
_contentTypes
protected Collection<String> _contentTypes
The types of the content on which this attribute column applies
-
_attribute
protected ModelItem _attribute
The attribute represented by the column
-
_isTypeContentWithMultilingualTitle
private boolean _isTypeContentWithMultilingualTitle
-
-
Constructor Detail
-
MetadataSearchUIColumn
public MetadataSearchUIColumn()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
configure
public void configure(Configuration configuration) throws ConfigurationException
- Specified by:
configure
in interfaceConfigurable
- Throws:
ConfigurationException
-
_isSortable
protected boolean _isSortable(Configuration configuration, ModelItem attribute, boolean multiplePath)
Computed sortable status of this column from its attribute definition and configuration- Parameters:
configuration
- the column's configurationattribute
- the attribute definitionmultiplePath
- if path is multiple- Returns:
- true if this column is sortable
-
_isEditable
protected boolean _isEditable(Configuration configuration, ModelItem attribute, boolean multiLevelMultiple)
Computed editable status of this column from its attribute definition and configuration- Parameters:
configuration
- the column's configurationattribute
- the attribute definitionmultiLevelMultiple
- if path contains a multiple attrbute or a repeater.- Returns:
- true if this column is editable
-
_configureModelItems
private List<ModelItem> _configureModelItems(Set<String> contentTypeIds, String attributePath) throws ConfigurationException
- Throws:
ConfigurationException
-
_getMetadataDefinition
private MetadataDefinition _getMetadataDefinition(Set<String> contentTypeIds, String metadataPath)
-
isEditionAllowed
protected boolean isEditionAllowed(ModelItem attribute)
Determines if the inline edition is allowed- Parameters:
attribute
- The attribute definition- Returns:
- true if the attribute is editable
-
configureRenderer
protected void configureRenderer(String renderer, ModelItem attribute)
Configure the column renderer.- Parameters:
renderer
- A specific renderer. If null, it will be deduced from the attribute definition.attribute
- The attribute definition.
-
configureConverter
protected void configureConverter(String converter, ModelItem attribute)
Configure the column converter.- Parameters:
converter
- A specific converter. If null, it will be deduced from the metadata definition.attribute
- The attribute definition.
-
_isAttributeMultiple
private boolean _isAttributeMultiple(ModelItem attribute)
-
setFieldPath
public void setFieldPath(String attributePath)
Set the attribute path- Parameters:
attributePath
- the path to attribute
-
getFieldPath
public String getFieldPath()
Get the path of attribute (separated by '/')- Specified by:
getFieldPath
in interfaceMetadataResultField
- Returns:
- the path of attribute
-
getContentTypes
public Collection<String> getContentTypes()
Get the content types of the contents on which this attribute column applies- Returns:
- the content types
-
setContentTypes
public void setContentTypes(Collection<String> contentTypes)
Set the content types of the contents on which this attribute column applies- Parameters:
contentTypes
- the content types
-
isJoinedAttribute
public boolean isJoinedAttribute()
Determines if this column is a path to a joined attribute- Returns:
- true if is a joined attribute
-
setJoinedAttribute
public void setJoinedAttribute(boolean joinedAttribute)
Set if this column is a path to a joined attribute- Parameters:
joinedAttribute
- true if is a joined attribute
-
isTypeContentWithMultilingualTitle
public boolean isTypeContentWithMultilingualTitle()
Determines if this column represents a CONTENT attribute with a multilingual title- Returns:
- true if this column represents a CONTENT attribute with a multilingual title
-
setTypeContentWithMultilingualTitle
public void setTypeContentWithMultilingualTitle(boolean multilingual)
Set if this column represents a CONTENT attribute with a multilingual title- Parameters:
multilingual
- true if this column represents a CONTENT attribute with a multilingual title
-
getValue
public Object getValue(Content content, Locale defaultLocale)
Description copied from interface:ResultField
Get the value represented by this field in the given result content.- Specified by:
getValue
in interfaceResultField
- Parameters:
content
- the result content.defaultLocale
- the default locale for localized value if the content's language is null- Returns:
- the content field value (cast to the appropriate object).
-
getFullValue
public Object getFullValue(Content content, Locale defaultLocale)
Description copied from interface:ResultField
Get the value represented by this field in the given result content.- Specified by:
getFullValue
in interfaceResultField
- Parameters:
content
- the result content.defaultLocale
- the default locale for localized value if the content's language is null- Returns:
- the content field value (cast to the appropriate object).
-
getSearchField
public SearchField getSearchField()
Description copied from interface:ResultField
Get theSearchField
representing this result field.- Specified by:
getSearchField
in interfaceResultField
- Overrides:
getSearchField
in classAbstractSearchUIColumn
- Returns:
- The
SearchField
representing this result field.
-
_isSortableMetadata
protected boolean _isSortableMetadata(ModelItem attribute)
Determines if the column is sortable according its attribute definition- Parameters:
attribute
- the attribute definition- Returns:
- true if type is sortable
-
-