Ir al contenido
Otras versiones

Cargando…

Scripting

Esta página aún no está disponible en tu idioma.

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 do the same things with a few mouse clicks. For compatibility reasons there is also an Automation task where you can put BeanShell code.

See some examples at Scripting samples.

Execute a script as part of application starting process

Section titled “Execute a script as part of application starting process”

A script can be executed as part of the application starting process. To do so, just create a start.bsh file in $TOMCAT_HOME. 

Execute a script as part of application stopping process

Section titled “Execute a script as part of application stopping process”

A script can be executed as part of the application stopping process. To do so, just create a stop.bsh file in $TOMCAT_HOME. 

In the Automation Scripting execution, there are several variables that are directly injected into the scripting environment and can be used.

List of variables that can be used directly:

Variable Description
systemToken The system token.
node Involved node (NodeDocument, NodeFolder, etc.)
uuid Node’s unique identifier.
file Only available when uploading or updating a document’s content.
userId The user ID.

Example:

import com.openkm.util.*;import com.openkm.api.*;OKMProperty okmProperty = ContextWrapper.getContext().getBean(OKMProperty.class);// Variable uuid is injected by automation to the scripting environmentokmProperty.addKeyword(null, uuid, "test");