Scripting
Scripting was an advanced feature that enables administrators to execute some BeanShell scripts in folders, triggered on every notified event ( for example uploading documents ).
This feature has been enhanced by Automation ( see ExecuteScripting at Built-in Automation Action plugins ), which helps you to do the same things with a few mouse clicks. For compatibility reasons there is also an Automation task where you can put a BeanShell code.
See some examples at Scripting samples.
Execute script as part of application starting process
Section titled “Execute script as part of application starting process”Can be executed as an script as a part of application starting process. To do so, just create a start.bsh file in $TOMCAT_HOME.
Execute script as part of application stopping process
Section titled “Execute script as part of application stopping process”Can be executed a an script as part of the application stopping process. To do so, just create a stop.bsh file in $TOMCAT_HOME.
Scripting in Automation
Section titled “Scripting in Automation”In the Automation Scripting execution, there’re several variables that are directly injected in scripting environment that can be used.
List of variables what can be used directly:
| Variable | Description |
|---|---|
| systemToken | The system token. |
| node | Involved node (NodeDocument, NodeFolder, etc. ) |
| uuid | Node unique identifier. |
| file | Only available when uploading or updating a new document content. |
| userId | The user id. |
Example:
import com.openkm.api.*;
// Variable uuid is injected by automation to the scripting environmentOKMProperty.getInstance().addKeyword(null, uuid, "test");