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_contextThe context.protected String_featureNameThe feature nameprotected ServiceManager_managerThe service managerprotected Map<String,ModelItem>_modelItemsThe map of model itemsprotected ClientSideElement.Script_paramsScriptThe script configuredprotected String_pluginNameThe plugin nameprotected RepeaterDefinitionParser_repeaterDefinitionParserThe repeater definition parserprotected ServiceParameterDefinitionParser_serviceParameterDefinitionParserThe service parameter definition parserprotected View_viewThe view of the serviceprotected ViewAndParametersParser_viewAndParametersParserThe 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.voidconfigure(Configuration configuration)protected IntegerconfigureDialogBoxDimension(Configuration configuration, String dimensionName)Configure the dimensions of the dialog boxprotected voidconfigureIndexation(Configuration configuration)Configure the indexation process.
This class only allow to index the value of some parameters (not repeaters).protected voidconfigureParameters(Configuration parametersConfiguration)Configure the service parametersvoidcontextualize(Context context)voiddispose()I18nizableTextgetCategory()Retrieves the category of the service.IntegergetCreationBoxHeight()Gets the height of the creation dialog box.IntegergetCreationBoxWidth()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 iconI18nizableTextgetDescription()Retrieves the description.StringgetIconDecorator()Retrieves the CSS class to use for decorator above the main iconStringgetIconGlyph()Retrieves the CSS class to use for glyph iconStringgetId()Retrieves the model id (an id must be unique in the familyModel.getFamilyId()I18nizableTextgetLabel()Retrieves the label.StringgetLargeIcon()Retrieves the URL of the icon without the context path.StringgetMediumIcon()Retrieves the URL of the icon without the context path.Collection<ModelItem>getModelItems()Retrieves all the model items of this accessorStringgetName()Get the name.Map<String,ModelItem>getParameters()Retrieves the service's parameters definitionsClientSideElement.ScriptgetParametersScript()This method return the script that will be used to display parameters field.StringgetPluginName()Returns the plugin's name.StringgetRight()Get the right needed to create an instance of this service.StringgetSmallIcon()Retrieves the URL of the icon without the context path.StringgetURL()Returns the service's Cocoon-URL.ViewgetView()Retrieves the service's viewvoidindex(ZoneItem zoneItem, org.apache.solr.common.SolrInputDocument document)Fill the index with service data.
This method is called during the containing page indexation process.booleanisCacheable(Page currentPage, ZoneItem zoneItem)Returns true if the result of this service may be cached, depending on theZoneItemcontaining an instance of this service.booleanisPrivate()Get whether the service is private, i.e.voidservice(ServiceManager smanager)voidsetPluginInfo(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:
servicein interfaceServiceable- Throws:
ServiceException
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualizein interfaceContextualizable- Throws:
ContextException
-
dispose
public void dispose()
- Specified by:
disposein interfaceDisposable
-
configure
public void configure(Configuration configuration) throws ConfigurationException
- Specified by:
configurein 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:PluginAwareSets 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:
setPluginInfoin 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:ServiceReturns the plugin's name.- Specified by:
getPluginNamein interfaceService- Returns:
- the plugin's name.
-
getId
public String getId()
Description copied from interface:ModelRetrieves the model id (an id must be unique in the familyModel.getFamilyId()
-
isCacheable
public boolean isCacheable(Page currentPage, ZoneItem zoneItem)
Description copied from interface:ServiceReturns true if the result of this service may be cached, depending on theZoneItemcontaining an instance of this service.- Specified by:
isCacheablein interfaceService- Parameters:
currentPage- the currentPagecontaining the service.zoneItem- theZoneItemcontaining 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:LabelableRetrieves the label.
-
getDescription
public I18nizableText getDescription()
Description copied from interface:LabelableRetrieves the description.- Specified by:
getDescriptionin interfaceLabelable- Returns:
- the description.
-
getCategory
public I18nizableText getCategory()
Description copied from interface:ServiceRetrieves the category of the service.- Specified by:
getCategoryin interfaceService- Returns:
- the category.
-
getIconGlyph
public String getIconGlyph()
Description copied from interface:ServiceRetrieves the CSS class to use for glyph icon- Specified by:
getIconGlyphin interfaceService- Returns:
- the glyph name.
-
getIconDecorator
public String getIconDecorator()
Description copied from interface:ServiceRetrieves the CSS class to use for decorator above the main icon- Specified by:
getIconDecoratorin interfaceService- Returns:
- the glyph name.
-
getSmallIcon
public String getSmallIcon()
Description copied from interface:ServiceRetrieves the URL of the icon without the context path.- Specified by:
getSmallIconin interfaceService- Returns:
- the icon URL for the small image 16x16.
-
getMediumIcon
public String getMediumIcon()
Description copied from interface:ServiceRetrieves the URL of the icon without the context path.- Specified by:
getMediumIconin interfaceService- Returns:
- the icon URL for the medium image 32x32.
-
getLargeIcon
public String getLargeIcon()
Description copied from interface:ServiceRetrieves the URL of the icon without the context path.- Specified by:
getLargeIconin interfaceService- Returns:
- the icon URL for the large image 48x48.
-
getCreationBoxHeight
public Integer getCreationBoxHeight()
Description copied from interface:ServiceGets the height of the creation dialog box.- Specified by:
getCreationBoxHeightin interfaceService- Returns:
- the height of the creation dialog box
-
getCreationBoxWidth
public Integer getCreationBoxWidth()
Description copied from interface:ServiceGets the width of the creation dialog box.- Specified by:
getCreationBoxWidthin interfaceService- Returns:
- the width of the creation dialog box
-
getURL
public String getURL()
Description copied from interface:ServiceReturns the service's Cocoon-URL.
-
getParametersScript
public ClientSideElement.Script getParametersScript()
Description copied from interface:ServiceThis method return the script that will be used to display parameters field.- Specified by:
getParametersScriptin interfaceService- Returns:
- The script. Can be null.
-
getCSSFiles
public List<ClientSideElement.ScriptFile> getCSSFiles()
Description copied from interface:ServiceReturns the list of CSS files needed to correctly display the service's in BO, such as the service's icon- Specified by:
getCSSFilesin interfaceService- Returns:
- The list of CSS files needed. Must not be null.
-
isPrivate
public boolean isPrivate()
Description copied from interface:ServiceGet whether the service is private, i.e. should not be created by the regular service interface.
-
getRight
public String getRight()
Description copied from interface:ServiceGet 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:ServiceFill 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:ModelItemAccessorRetrieves all the model items of this accessor- Specified by:
getModelItemsin interfaceModelItemAccessor- Returns:
- the model items
-
getParameters
public Map<String,ModelItem> getParameters()
Description copied from interface:ServiceRetrieves the service's parameters definitions- Specified by:
getParametersin interfaceService- Returns:
- the service's parameters definitions
-
-