Filter Stream Script API

Last modified by Admin on 2024/10/28 17:48

cogExposes the Filter Stream API to Scripts
TypeJAR
Category
Developed by

XWiki Development Team

Rating
0 Votes
LicenseGNU Lesser General Public License 2.1
Bundled With

XWiki Standard

Compatibility

Introduced in 6.2

Installable with the Extension Manager

Description

The entry point for using Filter module from scripts is the filter script service.

Examples

Import a XAR from attachment

{{velocity}}
#set($inputProperties = {
'source' : $doc.getAttachment('myattached.xar').getContentInputStream()
})
#set($outputProperties = {})
#set($job = $services.filter.convert('xwiki+xar/1.2', $inputProperties, 'xwiki+instance', $outputProperties))
{{/velocity}}

Note that you can also get some logs displayed with:

{{template name="job_macros.vm"/}}

{{velocity}}
#set($inputProperties = {
'source' : $doc.getAttachment('myattached.xar').getContentInputStream()
})
#set($outputProperties = {})
#set($job = $services.filter.convert('xwiki+xar/1.2', $inputProperties, 'xwiki+instance', $outputProperties))

{{html}}
#printStatusLog($job.status)
{{/html}}
{{/velocity}}

Example result:

jobimport.png

Prerequisites & Installation Instructions

We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager).

You can also use the manual method which involves dropping the JAR file and all its dependencies into the WEB-INF/lib folder and restarting XWiki.

Dependencies

Dependencies for this extension (org.xwiki.platform:xwiki-platform-filter-script 16.9.0):

Get Connected