Package org.ametys.cms.search.systemprop
Class AbstractSystemProperty
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.cms.search.systemprop.AbstractSystemProperty
-
- All Implemented Interfaces:
SystemProperty
,LogEnabled
,PluginAware
,Configurable
,Serviceable
- Direct Known Subclasses:
AbstractUserSystemProperty
,CollectionsSystemProperty
,CommentsSystemProperty
,ContentPrivacySystemProperty
,ContentTypeSystemProperty
,CreationDateSystemProperty
,FirstValidationSystemProperty
,FulltextSystemProperty
,LanguageSystemProperty
,LastMajorValidationSystemProperty
,LastModifiedSystemProperty
,LastValidationSystemProperty
,OrphanSystemProperty
,PagesSystemProperty
,ParentContentSystemProperty
,SharedSystemProperty
,SiteSystemProperty
,SiteTypeSystemProperty
,TagsSystemProperty
,WorkflowStepSystemProperty
public abstract class AbstractSystemProperty extends AbstractLogEnabled implements SystemProperty, Serviceable, Configurable, PluginAware
Abstract class providing standard behavior and helper methods for aSystemProperty
.
-
-
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 I18nizableText
_description
The property description.protected I18nUtils
_i18nUtils
The i18n utils.protected String
_id
The property ID.protected I18nizableText
_label
The property label.protected String
_pluginName
The property plugin name.protected AmetysObjectResolver
_resolver
The ametys object resolverprotected UserHelper
_userHelper
The user helper
-
Constructor Summary
Constructors Constructor Description AbstractSystemProperty()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
_indexBooleanValue(SearchField field, Boolean value, org.apache.solr.common.SolrInputDocument document)
Index Boolean valueprotected void
_indexBooleanValues(SearchField field, Boolean[] values, org.apache.solr.common.SolrInputDocument document)
Index multiple Boolean valuesprotected void
_indexDateValue(SearchField field, Date value, org.apache.solr.common.SolrInputDocument document)
Index Date valueprotected void
_indexDateValues(SearchField field, Date[] values, org.apache.solr.common.SolrInputDocument document)
Index multiple Date valuesprotected void
_indexDoubleValue(SearchField field, Double value, org.apache.solr.common.SolrInputDocument document)
Index Double valueprotected void
_indexDoubleValues(SearchField field, Double[] values, org.apache.solr.common.SolrInputDocument document)
Index multiple Double valuesprotected void
_indexGeocodeValue(SearchField field, Map<String,Double> value, org.apache.solr.common.SolrInputDocument document)
Index geocode valueprotected void
_indexLongValue(SearchField field, Long value, org.apache.solr.common.SolrInputDocument document)
Index Long valueprotected void
_indexLongValues(SearchField field, Long[] values, org.apache.solr.common.SolrInputDocument document)
Index multiple Long valuesprotected void
_indexStringValue(SearchField field, String value, org.apache.solr.common.SolrInputDocument document)
Index String valueprotected void
_indexStringValues(SearchField field, String[] values, org.apache.solr.common.SolrInputDocument document)
Index multiple String valuesprotected void
_indexUserValue(SearchField field, UserIdentity value, org.apache.solr.common.SolrInputDocument document)
Index UserIdentity valueprotected void
_indexUserValues(SearchField field, UserIdentity[] values, org.apache.solr.common.SolrInputDocument document)
Index multiple UserIdentity valuesprotected I18nizableText
_parseI18nizableText(Configuration config, String pluginName, String name)
Parse an i18n text.private void
_saxContentValue(ContentHandler handler, String value, Locale locale)
private void
_saxGeocodeValue(ContentHandler handler, Map<String,Double> value)
private void
_saxSingleValue(ContentHandler handler, Object value)
private void
_saxUserIdentityValue(ContentHandler handler, UserIdentity value)
void
configure(Configuration configuration)
I18nizableText
getDescription()
Get the system property description.String
getId()
Get the system property ID.I18nizableText
getLabel()
Get the system property label.Collection<SchemaDefinition>
getSchemaDefinitions()
Get the schema definitions brought by this property.Object
getSortValue(Content content)
Get the sort value represented by this field in the given result content.void
index(Content content, org.apache.solr.common.SolrInputDocument document)
Index the system property in a solr document.protected boolean
parseBoolean(Object value)
Get the value as a boolean.protected AdaptableDate
parseDate(Object value)
Get the value as a date.protected double
parseDouble(Object value)
Get the value as a double.protected long
parseLong(Object value)
Get the value as a long.protected String
parseString(Object value)
Get the value as a long.protected String[]
parseStringArray(Object value)
Get the value as a array of Stringprotected UserIdentity[]
parseUserArray(Object value)
Get the value as array ofUserIdentity
void
saxValue(ContentHandler handler, Content content)
SAX the valuevoid
service(ServiceManager manager)
void
setPluginInfo(String pluginName, String featureName, String id)
Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.-
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, getEnumeratorDefinition, getJsonValue, getQuery, getRenderer, getSearchField, getType, getValue, getWidget, getWidgetParameters, isDisplayable, isFacetable, isMultiple, isSearchable, isSortable
-
-
-
-
Field Detail
-
_i18nUtils
protected I18nUtils _i18nUtils
The i18n utils.
-
_label
protected I18nizableText _label
The property label.
-
_description
protected I18nizableText _description
The property description.
-
_pluginName
protected String _pluginName
The property plugin name.
-
_userHelper
protected UserHelper _userHelper
The user helper
-
_resolver
protected AmetysObjectResolver _resolver
The ametys object resolver
-
-
Constructor Detail
-
AbstractSystemProperty
public AbstractSystemProperty()
-
-
Method Detail
-
setPluginInfo
public void setPluginInfo(String pluginName, String featureName, String id)
Description copied from interface:PluginAware
Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.- Specified by:
setPluginInfo
in interfacePluginAware
- Parameters:
pluginName
- Unique identifier for the plugin hosting the extensionfeatureName
- Unique feature identifier (unique for a given pluginName)id
- Unique identifier of this component
-
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
-
getId
public String getId()
Description copied from interface:SystemProperty
Get the system property ID.- Specified by:
getId
in interfaceSystemProperty
- Returns:
- The property ID.
-
getLabel
public I18nizableText getLabel()
Description copied from interface:SystemProperty
Get the system property label.- Specified by:
getLabel
in interfaceSystemProperty
- Returns:
- The property label.
-
getDescription
public I18nizableText getDescription()
Description copied from interface:SystemProperty
Get the system property description.- Specified by:
getDescription
in interfaceSystemProperty
- Returns:
- The property description.
-
index
public void index(Content content, org.apache.solr.common.SolrInputDocument document)
Description copied from interface:SystemProperty
Index the system property in a solr document.- Specified by:
index
in interfaceSystemProperty
- Parameters:
content
- The content to index.document
- The solr document to index into.
-
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
- 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
- Parameters:
handler
- The content handler to sax intocontent
- The content- Throws:
SAXException
- If an error occurred while saxing
-
_saxContentValue
private void _saxContentValue(ContentHandler handler, String value, Locale locale) throws SAXException
- Throws:
SAXException
-
_saxUserIdentityValue
private void _saxUserIdentityValue(ContentHandler handler, UserIdentity value) throws SAXException
- Throws:
SAXException
-
_saxGeocodeValue
private void _saxGeocodeValue(ContentHandler handler, Map<String,Double> value) throws SAXException
- Throws:
SAXException
-
_saxSingleValue
private void _saxSingleValue(ContentHandler handler, Object value) throws SAXException
- Throws:
SAXException
-
getSchemaDefinitions
public Collection<SchemaDefinition> getSchemaDefinitions()
Description copied from interface:SystemProperty
Get the schema definitions brought by this property.- Specified by:
getSchemaDefinitions
in interfaceSystemProperty
- Returns:
- The schema definitions used by this property.
-
_parseI18nizableText
protected I18nizableText _parseI18nizableText(Configuration config, String pluginName, String name) throws ConfigurationException
Parse an i18n text.- 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.
-
parseString
protected String parseString(Object value)
Get the value as a long.- Parameters:
value
- The value as an object.- Returns:
- The value as a long.
-
parseLong
protected long parseLong(Object value)
Get the value as a long.- Parameters:
value
- The value as an object.- Returns:
- The value as a long.
-
parseDouble
protected double parseDouble(Object value)
Get the value as a double.- Parameters:
value
- The value as an object.- Returns:
- The value as a double.
-
parseBoolean
protected boolean parseBoolean(Object value)
Get the value as a boolean.- Parameters:
value
- The value as an object, can be a Boolean or a String.- Returns:
- The value as a boolean.
-
parseDate
protected AdaptableDate parseDate(Object value)
Get the value as a date.- Parameters:
value
- The value as an object, can be a Date or a String.- Returns:
- The value as a Date object.
-
parseUserArray
protected UserIdentity[] parseUserArray(Object value)
Get the value as array ofUserIdentity
- Parameters:
value
- The value to parse- Returns:
- A array of
UserIdentity
-
parseStringArray
protected String[] parseStringArray(Object value)
Get the value as a array of String- Parameters:
value
- The value as an object to parse- Returns:
- The values as a String array
-
_indexStringValues
protected void _indexStringValues(SearchField field, String[] values, org.apache.solr.common.SolrInputDocument document)
Index multiple String values- Parameters:
field
- The search fieldvalues
- The valuesdocument
- The Solr document to index into
-
_indexStringValue
protected void _indexStringValue(SearchField field, String value, org.apache.solr.common.SolrInputDocument document)
Index String value- Parameters:
field
- The search fieldvalue
- The valuedocument
- The Solr document to index into
-
_indexDateValues
protected void _indexDateValues(SearchField field, Date[] values, org.apache.solr.common.SolrInputDocument document)
Index multiple Date values- Parameters:
field
- The search fieldvalues
- The valuesdocument
- The Solr document to index into
-
_indexDateValue
protected void _indexDateValue(SearchField field, Date value, org.apache.solr.common.SolrInputDocument document)
Index Date value- Parameters:
field
- The search fieldvalue
- The valuedocument
- The Solr document to index into
-
_indexLongValues
protected void _indexLongValues(SearchField field, Long[] values, org.apache.solr.common.SolrInputDocument document)
Index multiple Long values- Parameters:
field
- The search fieldvalues
- The valuesdocument
- The Solr document to index into
-
_indexLongValue
protected void _indexLongValue(SearchField field, Long value, org.apache.solr.common.SolrInputDocument document)
Index Long value- Parameters:
field
- The search fieldvalue
- The valuedocument
- The Solr document to index into
-
_indexDoubleValues
protected void _indexDoubleValues(SearchField field, Double[] values, org.apache.solr.common.SolrInputDocument document)
Index multiple Double values- Parameters:
field
- The search fieldvalues
- The valuesdocument
- The Solr document to index into
-
_indexDoubleValue
protected void _indexDoubleValue(SearchField field, Double value, org.apache.solr.common.SolrInputDocument document)
Index Double value- Parameters:
field
- The search fieldvalue
- The valuedocument
- The Solr document to index into
-
_indexBooleanValues
protected void _indexBooleanValues(SearchField field, Boolean[] values, org.apache.solr.common.SolrInputDocument document)
Index multiple Boolean values- Parameters:
field
- The search fieldvalues
- The valuesdocument
- The Solr document to index into
-
_indexBooleanValue
protected void _indexBooleanValue(SearchField field, Boolean value, org.apache.solr.common.SolrInputDocument document)
Index Boolean value- Parameters:
field
- The search fieldvalue
- The valuedocument
- The Solr document to index into
-
_indexUserValues
protected void _indexUserValues(SearchField field, UserIdentity[] values, org.apache.solr.common.SolrInputDocument document)
Index multiple UserIdentity values- Parameters:
field
- The search fieldvalues
- The valuesdocument
- The Solr document to index into
-
_indexUserValue
protected void _indexUserValue(SearchField field, UserIdentity value, org.apache.solr.common.SolrInputDocument document)
Index UserIdentity value- Parameters:
field
- The search fieldvalue
- The valuedocument
- The Solr document to index into
-
_indexGeocodeValue
protected void _indexGeocodeValue(SearchField field, Map<String,Double> value, org.apache.solr.common.SolrInputDocument document)
Index geocode value- Parameters:
field
- The search fieldvalue
- The valuedocument
- The Solr document to index into
-
-