Package org.ametys.web.service
Class StaticService
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.web.service.StaticService
-
- All Implemented Interfaces:
Model
,ModelItemAccessor
,ModelItemContainer
,LogEnabled
,PluginAware
,Labelable
,Service
,Disposable
,Configurable
,Contextualizable
,Serviceable
- Direct Known Subclasses:
AttachmentsService
,ExplorerFolderService
,FilteredContentsService
,FilteredPagesService
,LinkDirectoryService
,SearchPagesService
,SearchService
,ServerDirectoryService
,SitemapService
,SyndicationService
public class StaticService extends AbstractLogEnabled implements Service, Contextualizable, Configurable, PluginAware, Serviceable, Disposable
Class representing a business service.
A service is identified by an id and a Cocoon-URL.
This URL corresponds to a pipeline called by a page template.
URL must be relative to the sitemap of the plugin containing the service.
-
-
Field Summary
Fields Modifier and Type Field Description protected Context
_context
The context.protected String
_featureName
The feature nameprotected ServiceManager
_manager
The service managerprotected Map<String,ModelItem>
_modelItems
The map of model itemsprotected ClientSideElement.Script
_paramsScript
The script configuredprotected String
_pluginName
The plugin nameprotected RepeaterDefinitionParser
_repeaterDefinitionParser
The repeater definition parserprotected ServiceParameterDefinitionParser
_serviceParameterDefinitionParser
The service parameter definition parserprotected View
_view
The view of the serviceprotected ViewAndParametersParser
_viewAndParametersParser
The view and parameters parser
-
Constructor Summary
Constructors Constructor Description StaticService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
_configureClass(Configuration configuration)
Configure the js class nameprotected List<ClientSideElement.ScriptFile>
_configureImports(Configuration configuration)
Configure the import partprotected ClientSideElement.Script
_configureScript(Configuration configuration)
Configure the scriptprotected I18nizableText
_parseI18nizableText(Configuration config, String name)
Parse an i18n text.void
configure(Configuration configuration)
protected Integer
configureDialogBoxDimension(Configuration configuration, String dimensionName)
Configure the dimensions of the dialog boxprotected void
configureIndexation(Configuration configuration)
Configure the indexation process.
This class only allow to index the value of some parameters (not repeaters).protected void
configureParameters(Configuration parametersConfiguration)
Configure the service parametersvoid
contextualize(Context context)
void
dispose()
I18nizableText
getCategory()
Retrieves the category of the service.Integer
getCreationBoxHeight()
Gets the height of the creation dialog box.Integer
getCreationBoxWidth()
Gets the width of the creation dialog box.List<ClientSideElement.ScriptFile>
getCSSFiles()
Returns the list of CSS files needed to correctly display the service's in BO, such as the service's iconI18nizableText
getDescription()
Retrieves the description.String
getIconDecorator()
Retrieves the CSS class to use for decorator above the main iconString
getIconGlyph()
Retrieves the CSS class to use for glyph iconString
getId()
Retrieves the model id (an id must be unique in the familyModel.getFamilyId()
I18nizableText
getLabel()
Retrieves the label.String
getLargeIcon()
Retrieves the URL of the icon without the context path.String
getMediumIcon()
Retrieves the URL of the icon without the context path.Collection<ModelItem>
getModelItems()
Retrieves all the model items of this accessorString
getName()
Get the name.Map<String,ModelItem>
getParameters()
Retrieves the service's parameters definitionsClientSideElement.Script
getParametersScript()
This method return the script that will be used to display parameters field.String
getPluginName()
Returns the plugin's name.String
getRight()
Get the right needed to create an instance of this service.String
getSmallIcon()
Retrieves the URL of the icon without the context path.String
getURL()
Returns the service's Cocoon-URL.View
getView()
Retrieves the service's viewvoid
index(ZoneItem zoneItem, org.apache.solr.common.SolrInputDocument document)
Fill the index with service data.
This method is called during the containing page indexation process.boolean
isCacheable(Page currentPage, ZoneItem zoneItem)
Returns true if the result of this service may be cached, depending on theZoneItem
containing an instance of this service.boolean
isPrivate()
Get whether the service is private, i.e.void
service(ServiceManager smanager)
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.runtime.model.ModelItemAccessor
getChild, getModelItem, hasModelItem
-
Methods inherited from interface org.ametys.web.service.Service
getFamilyId
-
-
-
-
Field Detail
-
_pluginName
protected String _pluginName
The plugin name
-
_featureName
protected String _featureName
The feature name
-
_manager
protected ServiceManager _manager
The service manager
-
_paramsScript
protected ClientSideElement.Script _paramsScript
The script configured
-
_modelItems
protected Map<String,ModelItem> _modelItems
The map of model items
-
_viewAndParametersParser
protected ViewAndParametersParser _viewAndParametersParser
The view and parameters parser
-
_serviceParameterDefinitionParser
protected ServiceParameterDefinitionParser _serviceParameterDefinitionParser
The service parameter definition parser
-
_repeaterDefinitionParser
protected RepeaterDefinitionParser _repeaterDefinitionParser
The repeater definition parser
-
-
Constructor Detail
-
StaticService
public StaticService()
-
-
Method Detail
-
service
public void service(ServiceManager smanager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
dispose
public void dispose()
- Specified by:
dispose
in interfaceDisposable
-
configure
public void configure(Configuration configuration) throws ConfigurationException
- Specified by:
configure
in interfaceConfigurable
- Throws:
ConfigurationException
-
configureParameters
protected void configureParameters(Configuration parametersConfiguration) throws ConfigurationException
Configure the service parameters- Parameters:
parametersConfiguration
- the parameters configuration- Throws:
ConfigurationException
- if a configuration exception occurred
-
configureIndexation
protected void configureIndexation(Configuration configuration) throws ConfigurationException
Configure the indexation process.
This class only allow to index the value of some parameters (not repeaters).- Parameters:
configuration
- the indexation configuration.- Throws:
ConfigurationException
- if an error occurs.
-
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
-
getPluginName
public String getPluginName()
Description copied from interface:Service
Returns the plugin's name.- Specified by:
getPluginName
in interfaceService
- Returns:
- the plugin's name.
-
getId
public String getId()
Description copied from interface:Model
Retrieves the model id (an id must be unique in the familyModel.getFamilyId()
-
isCacheable
public boolean isCacheable(Page currentPage, ZoneItem zoneItem)
Description copied from interface:Service
Returns true if the result of this service may be cached, depending on theZoneItem
containing an instance of this service.- Specified by:
isCacheable
in interfaceService
- Parameters:
currentPage
- the currentPage
containing the service.zoneItem
- theZoneItem
containing an instance of this service.
N.B: The ZoneItem can belong to a page that is not the current page, when it is inherited.- Returns:
- true if the result of this service may be cached.
-
getLabel
public I18nizableText getLabel()
Description copied from interface:Labelable
Retrieves the label.
-
getDescription
public I18nizableText getDescription()
Description copied from interface:Labelable
Retrieves the description.- Specified by:
getDescription
in interfaceLabelable
- Returns:
- the description.
-
getCategory
public I18nizableText getCategory()
Description copied from interface:Service
Retrieves the category of the service.- Specified by:
getCategory
in interfaceService
- Returns:
- the category.
-
getIconGlyph
public String getIconGlyph()
Description copied from interface:Service
Retrieves the CSS class to use for glyph icon- Specified by:
getIconGlyph
in interfaceService
- Returns:
- the glyph name.
-
getIconDecorator
public String getIconDecorator()
Description copied from interface:Service
Retrieves the CSS class to use for decorator above the main icon- Specified by:
getIconDecorator
in interfaceService
- Returns:
- the glyph name.
-
getSmallIcon
public String getSmallIcon()
Description copied from interface:Service
Retrieves the URL of the icon without the context path.- Specified by:
getSmallIcon
in interfaceService
- Returns:
- the icon URL for the small image 16x16.
-
getMediumIcon
public String getMediumIcon()
Description copied from interface:Service
Retrieves the URL of the icon without the context path.- Specified by:
getMediumIcon
in interfaceService
- Returns:
- the icon URL for the medium image 32x32.
-
getLargeIcon
public String getLargeIcon()
Description copied from interface:Service
Retrieves the URL of the icon without the context path.- Specified by:
getLargeIcon
in interfaceService
- Returns:
- the icon URL for the large image 48x48.
-
getCreationBoxHeight
public Integer getCreationBoxHeight()
Description copied from interface:Service
Gets the height of the creation dialog box.- Specified by:
getCreationBoxHeight
in interfaceService
- Returns:
- the height of the creation dialog box
-
getCreationBoxWidth
public Integer getCreationBoxWidth()
Description copied from interface:Service
Gets the width of the creation dialog box.- Specified by:
getCreationBoxWidth
in interfaceService
- Returns:
- the width of the creation dialog box
-
getURL
public String getURL()
Description copied from interface:Service
Returns the service's Cocoon-URL.
-
getParametersScript
public ClientSideElement.Script getParametersScript()
Description copied from interface:Service
This method return the script that will be used to display parameters field.- Specified by:
getParametersScript
in interfaceService
- Returns:
- The script. Can be null.
-
getCSSFiles
public List<ClientSideElement.ScriptFile> getCSSFiles()
Description copied from interface:Service
Returns the list of CSS files needed to correctly display the service's in BO, such as the service's icon- Specified by:
getCSSFiles
in interfaceService
- Returns:
- The list of CSS files needed. Must not be null.
-
isPrivate
public boolean isPrivate()
Description copied from interface:Service
Get whether the service is private, i.e. should not be created by the regular service interface.
-
getRight
public String getRight()
Description copied from interface:Service
Get the right needed to create an instance of this service.
-
index
public void index(ZoneItem zoneItem, org.apache.solr.common.SolrInputDocument document)
Description copied from interface:Service
Fill the index with service data.
This method is called during the containing page indexation process.
-
_parseI18nizableText
protected I18nizableText _parseI18nizableText(Configuration config, String name)
Parse an i18n text.- Parameters:
config
- the configuration to use.name
- the child name.- Returns:
- the i18n text.
-
configureDialogBoxDimension
protected Integer configureDialogBoxDimension(Configuration configuration, String dimensionName) throws ConfigurationException
Configure the dimensions of the dialog box- Parameters:
configuration
- the global configurationdimensionName
- the name of the dimension to configure- Returns:
- the value of the dimension
- Throws:
ConfigurationException
- if configuration is invalid
-
_configureScript
protected ClientSideElement.Script _configureScript(Configuration configuration) throws ConfigurationException
Configure the script- Parameters:
configuration
- the global configuration- Returns:
- The script created
- Throws:
ConfigurationException
- if configuration is invalid
-
_configureClass
protected String _configureClass(Configuration configuration) throws ConfigurationException
Configure the js class name- Parameters:
configuration
- The configuration on action tag- Returns:
- The js class name
- Throws:
ConfigurationException
- If an error occurs
-
_configureImports
protected List<ClientSideElement.ScriptFile> _configureImports(Configuration configuration) throws ConfigurationException
Configure the import part- Parameters:
configuration
- The imports configuration- Returns:
- The set of the complete url of imported file
- Throws:
ConfigurationException
- If an error occurs
-
getModelItems
public Collection<ModelItem> getModelItems()
Description copied from interface:ModelItemAccessor
Retrieves all the model items of this accessor- Specified by:
getModelItems
in interfaceModelItemAccessor
- Returns:
- the model items
-
getParameters
public Map<String,ModelItem> getParameters()
Description copied from interface:Service
Retrieves the service's parameters definitions- Specified by:
getParameters
in interfaceService
- Returns:
- the service's parameters definitions
-
-