public interface Script extends DocumentWorkerObject
The customization script may or may not be loaded. If it is loaded then any event handlers that it contains will be executed when the event occurs. The customization script can only be modified when it is not loaded.
The customization script may or may not be installed. If it is installed then it will be included in the response message. If the response message is sent to another Document Worker then it will automatically be loaded by that worker before the task is processed.
| Modifier and Type | Method and Description |
|---|---|
int |
getIndex()
Returns the current position of this customization script in the parent list.
|
String |
getName()
Returns the name of the customization script.
|
Object |
getObject()
This property allows for communication between scripts.
|
String |
getScript()
Retrieves the text of the script.
|
Task |
getTask()
Returns the task that this customization script is associated with.
|
void |
install()
Installs this customization script.
|
boolean |
isInstalled()
Checks whether this customization script is currently installed.
|
boolean |
isLoaded()
Checks whether this customization script is currently loaded.
|
void |
load()
Loads this customization script.
|
void |
setName(String name)
Sets the name of the customization script.
|
void |
setScriptByReference(String reference)
Sets the customization script.
|
void |
setScriptByReference(String reference,
ScriptEngineType engineType)
Sets the customization script.
|
void |
setScriptByUrl(URL url)
Sets the customization script.
|
void |
setScriptByUrl(URL url,
ScriptEngineType engineType)
Sets the customization script.
|
void |
setScriptInline(String script)
Sets the customization script.
|
void |
setScriptInline(String script,
ScriptEngineType engineType)
Sets the customization script.
|
void |
uninstall()
Uninstalls this customization script.
|
void |
unload()
Unloads this customization script.
|
getApplicationint getIndex()
String getName()
This can be used as an identifier for the script. It may appear in the log file, especially if there is an issue with the script.
Object getObject()
null is
returned.null if the script is not loaded or does not expose an objectString getScript() throws IOException
Note that there is no guarantee that the script code is cached. If the script is remote then calling this method multiple times may result in it being fetched multiple times.
IOException - if the script is remote and cannot be retrieved@Nonnull Task getTask()
void install()
Installing this script means that it will be included in the response message.
boolean isInstalled()
If it is installed then it will be included in the response message, otherwise it will not be.
boolean isLoaded()
The customization script must be loaded in order for its event handlers to be fired. It can only be modified when it is not loaded.
void load() throws ScriptException
RuntimeException - if the script has not been initializedScriptException - if the script cannot be retrieved or interpreted, or if it throws an error when loadingvoid setName(String name)
This method will throw a RuntimeException if it is called when the script is currently loaded.
name - the name of the customization scriptRuntimeException - if this customization script is currently loadedvoid setScriptByReference(String reference)
This method will throw a RuntimeException if it is called when the script is currently loaded.
reference - the reference to the script in the remote data storeRuntimeException - if this customization script is currently loadedvoid setScriptByReference(String reference, ScriptEngineType engineType)
This method will throw a RuntimeException if it is called when the script is currently loaded.
reference - the reference to the script in the remote data storeengineType - the scripting engine to useRuntimeException - if this customization script is currently loadedvoid setScriptByUrl(URL url)
This method will throw a RuntimeException if it is called when the script is currently loaded.
url - the reference to the location where the script can be retrieved fromRuntimeException - if this customization script is currently loaded, or if the specified URL is not strictly formatted in
accordance with RFC2396void setScriptByUrl(URL url, ScriptEngineType engineType)
This method will throw a RuntimeException if it is called when the script is currently loaded.
url - the reference to the location where the script can be retrieved fromengineType - the scripting engine to useRuntimeException - if this customization script is currently loaded, or if the specified URL is not strictly formatted in
accordance with RFC2396void setScriptInline(String script)
This method will throw a RuntimeException if it is called when the script is currently loaded.
script - the customization scriptRuntimeException - if this customization script is currently loadedvoid setScriptInline(String script, ScriptEngineType engineType)
This method will throw a RuntimeException if it is called when the script is currently loaded.
script - the customization scriptengineType - the scripting engine to useRuntimeException - if this customization script is currently loadedvoid uninstall()
Uninstalling this script means that it will not be included in the response message.
void unload()
Unloading this script means that its event handlers will no longer be fired. It is required that the script is first unloaded in order to make any modifications to it.
Copyright © 2016–2022 EntIT Software LLC, a Micro Focus company. All rights reserved.