Extension Script Module
Version 9.1 by Thomas Mortagne on 2016/03/17 09:03
Provide script oriented APIs to manipulate extensions |
Type | JAR |
Category | |
Developed by | |
Rating | |
License | GNU Lesser General Public License 2.1 |
Table of contents
Description
The Extension module provide various script oriented APIs. It's also possible to extend it by registering a org.xwiki.script.service.ScriptService component with a hint prefixed with "extension.".
Following are the default set of extension related APIs:
- extension: $services.extension The entry point of this module is the script service with the identifier extension which then provide several "sub-script services".
- core: $services.extension.core This script service is dedicated to code extensions. Core extension being the unmodificable extension included in the WAR or coming from the application server.
- local: $services.extension.local This script service is dedicated to local extensions. Local extension being all the extension installed or not that have been downloaded at some point.
- installed: $services.extension.installed This script service is dedicated to installed extensions.
- rating: $services.extension.rating This script service is dedicated to rating informations.
- history: $services.extension.history Provides access to the Extension Job History and offers APIs to serialize (export), deserialize (import) and replay history records.
Examples
Search
Since 7.1RC1 an advanced search API is provided with filtering, sorting, etc.
#set($query = $services.extension.newQuery('toto'))
## Sort by name
$query.addSort('name', 'DESC')
## Get only the flavors
$query.addFilter('category', 'flavor', 'EQUAL')
## Only the first 10 results
$query.setLimit(10)
## Execute search
#set($result = $services.extension.search($query))
## Display found extensions
#foreach ($extension in $result)
* $extension
#end
## Sort by name
$query.addSort('name', 'DESC')
## Get only the flavors
$query.addFilter('category', 'flavor', 'EQUAL')
## Only the first 10 results
$query.setLimit(10)
## Execute search
#set($result = $services.extension.search($query))
## Display found extensions
#foreach ($extension in $result)
* $extension
#end