Package org.ametys.cms.search.systemprop
Class ContentTypeSystemProperty
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.cms.search.systemprop.AbstractSystemProperty
-
- org.ametys.cms.search.systemprop.ContentTypeSystemProperty
-
- All Implemented Interfaces:
SystemProperty
,LogEnabled
,PluginAware
,Configurable
,Serviceable
public class ContentTypeSystemProperty extends AbstractSystemProperty
SystemProperty
which represents the content types (and optionally mixins) of a content.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.ametys.cms.search.model.SystemProperty
SystemProperty.EnumeratorDefinition
-
-
Field Summary
Fields Modifier and Type Field Description protected ContentTypeExtensionPoint
_cTypeEP
The content type extension point.protected ContentTypesHelper
_cTypeHelper
The content types helper.protected boolean
_includeCTypes
True to include content types.protected boolean
_includeMixins
True to include mixins.protected boolean
_includeSupertypes
True to recursively include supertypes.-
Fields inherited from class org.ametys.cms.search.systemprop.AbstractSystemProperty
_description, _i18nUtils, _id, _label, _pluginName, _resolver, _userHelper, _userManager
-
-
Constructor Summary
Constructors Constructor Description ContentTypeSystemProperty()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
_addAll(Set<String> allTypes, String[] types)
void
configure(Configuration configuration)
SystemProperty.EnumeratorDefinition
getEnumeratorDefinition(Configuration configuration)
Get the definition of enumerator.Object
getJsonValue(Content content, boolean full)
Get the jsonified valueQuery
getQuery(Object value, Query.Operator operator, String language, Map<String,Object> contextualParameters)
Get theQuery
associated to the given value.String
getRenderer()
Get the renderer.SearchField
getSearchField()
Get theSearchField
representing this system property.Object
getSortValue(Content content)
Get the sort value represented by this field in the given result content.MetadataType
getType()
Get the property type.Object
getValue(Content content)
Get the typed raw value for this field in the given result content.String
getWidget()
Get the default widget to use when rendering this property as a criterion.Map<String,I18nizableText>
getWidgetParameters(Configuration configuration)
Get the widget parameters.boolean
isMultiple()
Get the multiple status of the property.boolean
isSortable()
Get if the property can be sorted on.void
saxValue(ContentHandler handler, Content content)
SAX the valuevoid
service(ServiceManager manager)
-
Methods inherited from class org.ametys.cms.search.systemprop.AbstractSystemProperty
_indexBooleanValue, _indexBooleanValues, _indexDateValue, _indexDateValues, _indexDoubleValue, _indexDoubleValues, _indexGeocodeValue, _indexLongValue, _indexLongValues, _indexStringValue, _indexStringValues, _indexUserValue, _indexUserValues, _parseI18nizableText, getDescription, getId, getLabel, getSchemaDefinitions, index, parseBoolean, parseDate, parseDouble, parseLong, parseString, parseStringArray, parseUserArray, setPluginInfo
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
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.SystemProperty
getColumnWidth, getContentTypeId, getConverter, isDisplayable, isFacetable, isSearchable
-
-
-
-
Field Detail
-
_cTypeEP
protected ContentTypeExtensionPoint _cTypeEP
The content type extension point.
-
_cTypeHelper
protected ContentTypesHelper _cTypeHelper
The content types helper.
-
_includeCTypes
protected boolean _includeCTypes
True to include content types.
-
_includeMixins
protected boolean _includeMixins
True to include mixins.
-
_includeSupertypes
protected boolean _includeSupertypes
True to recursively include supertypes.
-
-
Constructor Detail
-
ContentTypeSystemProperty
public ContentTypeSystemProperty()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classAbstractSystemProperty
- Throws:
ServiceException
-
configure
public void configure(Configuration configuration) throws ConfigurationException
- Specified by:
configure
in interfaceConfigurable
- Overrides:
configure
in classAbstractSystemProperty
- Throws:
ConfigurationException
-
getType
public MetadataType getType()
Description copied from interface:SystemProperty
Get the property type.- Returns:
- the property type.
-
isMultiple
public boolean isMultiple()
Description copied from interface:SystemProperty
Get the multiple status of the property.- Returns:
true
if the property can have multiple values,false
otherwise.
-
isSortable
public boolean isSortable()
Description copied from interface:SystemProperty
Get if the property can be sorted on.- Returns:
true
if the property can be sorted on,false
otherwise.
-
getQuery
public Query getQuery(Object value, Query.Operator operator, String language, Map<String,Object> contextualParameters)
Description copied from interface:SystemProperty
Get theQuery
associated to the given value.- Parameters:
value
- the user-submitted value for this property.operator
- In advanced search mode, the operator chosen by the user.null
to use the criterion-defined operator (simple search mode).language
- The current search language.contextualParameters
- the search contextual parameters.- Returns:
- The
Query
associated to the given value.
-
getRenderer
public String getRenderer()
Description copied from interface:SystemProperty
Get the renderer.- Returns:
- The column renderer.
-
getSearchField
public SearchField getSearchField()
Description copied from interface:SystemProperty
Get theSearchField
representing this system property.- Returns:
- The search field representing this system property.
-
getValue
public Object getValue(Content content)
Description copied from interface:SystemProperty
Get the typed raw value for this field in the given result content. The returned object depends on this field's type:
-MetadataType.STRING
must return String or String[] if multiple
-MetadataType.DATE
orMetadataType.DATETIME
must return Date or Date[] if multiple
-MetadataType.LONG
must return Long or Long[] if multiple
-MetadataType.DOUBLE
must return Double or Double[] if multiple
-MetadataType.CONTENT
must return String or String[] if multiple
-MetadataType.GEOCODE
must return Map<String, Double>
-MetadataType.USER
must return UserIdentity or UserIdentity[] if multiple
-MetadataType.MULTILINGUAL_STRING
must returnMultilingualString
Others types are not supported.- Parameters:
content
- The result content- Returns:
- The typed value, cast to the appropriate object according its type.
-
getJsonValue
public Object getJsonValue(Content content, boolean full)
Description copied from interface:SystemProperty
Get the jsonified value- Parameters:
content
- the result contentfull
-true
to get full value.- Returns:
- the content field value
-
getSortValue
public Object getSortValue(Content content)
Description copied from interface:SystemProperty
Get the sort value represented by this field in the given result content.- Specified by:
getSortValue
in interfaceSystemProperty
- Overrides:
getSortValue
in classAbstractSystemProperty
- Parameters:
content
- the result content.- Returns:
- the content sort value, must be scalar (String, long, double, Date).
-
saxValue
public void saxValue(ContentHandler handler, Content content) throws SAXException
Description copied from interface:SystemProperty
SAX the value- Specified by:
saxValue
in interfaceSystemProperty
- Overrides:
saxValue
in classAbstractSystemProperty
- Parameters:
handler
- The content handler to sax intocontent
- The content- Throws:
SAXException
- If an error occurred while saxing
-
getEnumeratorDefinition
public SystemProperty.EnumeratorDefinition getEnumeratorDefinition(Configuration configuration)
Get the definition of enumerator.- Parameters:
configuration
- The enumerator configuration.- Returns:
- The enumerator definition
-
getWidget
public String getWidget()
Get the default widget to use when rendering this property as a criterion.- Returns:
- The default widget to use.
-
getWidgetParameters
public Map<String,I18nizableText> getWidgetParameters(Configuration configuration)
Description copied from interface:SystemProperty
Get the widget parameters.- Parameters:
configuration
- The system property configuration- Returns:
- The widget parameters as a Map.
-
-