Class AbstractProcessExtension
java.lang.Object
ch.ivyteam.ivy.process.extension.impl.AbstractProcessExtension
- All Implemented Interfaces:
IProcessExtension
- Direct Known Subclasses:
AbstractUserProcessExtension
Abstract base class that implements the
IProcessExtension
interface. Users can extends this interface to implement their process
extension bean classes. This class provides a lot of useful methods that can
be used to implement process extensions- Since:
- 28.08.2008
- API:
- This is a public API.
-
Method Summary
Modifier and TypeMethodDescriptionvoidabort(IRequestId requestId) The request with the request id must be aborted Called if a timeout exception occurs.protected IIvyScriptContextcreateOwnContext(IIvyScriptContext outerContext) Creates a new contextprotected voiddeclareAndInitializeVariable(IIvyScriptContext context, String variableName, String variableTypeName, Object initValue) Declares a variable inside the given context and initializes it with the given valueprotected voiddeclareVariable(IIvyScriptContext context, String variableName, String variableTypeName) Declares a variable inside the given contextprotected <T> TexecuteAsSystem(Callable<T> callable) Deprecated, for removal: This API element is subject to removal in a future version.protected ObjectexecuteIvyScript(IIvyScriptContext context, IIvyScriptInstruction instruction) Executes an ivy script instruction.protected ObjectexecuteIvyScript(IIvyScriptContext context, String script) Executes an ivy script scriptgetAdditionalLogInfo(IRequestId requestId) Gets addition log info.protected ICasegetCase(IIvyScriptContext context) Gets the current workflow caseprotected StringDeprecated, for removal: This API element is subject to removal in a future version.usegetConfig()insteadprotected StringDeprecated, for removal: This API element is subject to removal in a future version.usegetConfig()instead.Deprecated, for removal: This API element is subject to removal in a future version.protected IContentManagementSystemGets the content management systemprotected IExtensionsgetExtensions(IIvyScriptContext context) Gets the extensions interfaceprotected LoggergetLog(IIvyScriptContext context) Gets the logprotected ObjectgetProcessDataField(IIvyScriptContext context, String processDataField) Gets the value of the given process data fieldprotected StringGets the process element identifierprotected IProcessModelVersionRequestgetRequest(IIvyScriptContext context) Gets the request objectprotected IResponsegetResponse(IIvyScriptContext context) Gets the response objectprotected IServerExtensiongetServerExtension(IIvyScriptContext context, String serverExtensionIdentifier) Gets the server extension for the given server extension identifierprotected IWorkflowSessiongetSession(IIvyScriptContext context) Gets the current workflow sessionprotected ITaskgetTask(IIvyScriptContext context) Gets the current workflow taskprotected IWorkflowContextgetWf(IIvyScriptContext context) Gets the workflow contextprotected IIvyScriptInstructionparseIvyScript(IIvyScriptContext context, String script, String returnTypeName) Parses an ivy script scriptvoidrelease()This method is called before this process extension is thrown away by the process engine.voidsetConfiguration(String _configuration) Deprecated, for removal: This API element is subject to removal in a future version.protected voidsetProcessDataField(IIvyScriptContext context, String processDataField, Object value) Sets the given value to the given process data field.protected voidsetVariableValue(IIvyScriptContext context, String variableName, Object value) Sets the value of a variable in the given the contextvoidstart()On the designer this method is called if the simulation starts.voidstop()On the designer this method is called if the simulation stops.
-
Method Details
-
abort
Description copied from interface:IProcessExtensionThe request with the request id must be aborted Called if a timeout exception occurs.- Specified by:
abortin interfaceIProcessExtension- Parameters:
requestId- the identifier of the request to stop- API:
- This public API is available in Java.
-
getAdditionalLogInfo
Description copied from interface:IProcessExtensionGets addition log info. This information will be added to all log messages.- Specified by:
getAdditionalLogInfoin interfaceIProcessExtension- Parameters:
requestId- the identifier of the request- Returns:
- additional log info
- API:
- This public API is available in Java.
-
release
Description copied from interface:IProcessExtensionThis method is called before this process extension is thrown away by the process engine. Implementers should release all resource they have allocated in this method, so that the process extension can be garbage collected (Stop all created threads, close all opened files, etc.)- Specified by:
releasein interfaceIProcessExtension- Throws:
Exception- if bean can not be released- API:
- This public API is available in Java.
-
setConfiguration
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:IProcessExtensionSets the configuration of the process extension- Specified by:
setConfigurationin interfaceIProcessExtension- Parameters:
_configuration- the process extension configuration- API:
- This public API is available in Java.
-
getConfiguration
Deprecated, for removal: This API element is subject to removal in a future version.usegetConfig()instead- API:
- This public API is available in Java.
-
getConfig
- API:
- This public API is available in Java.
-
start
Description copied from interface:IProcessExtensionOn the designer this method is called if the simulation starts. On the server this method is called after the process is loaded and before the process handles the first request. Implementors can use this method to prepare the bean to handle requests (e.g. start threads, allocate resources etc.)- Specified by:
startin interfaceIProcessExtension- Throws:
Exception- if bean can not be started- API:
- This public API is available in Java.
-
stop
Description copied from interface:IProcessExtensionOn the designer this method is called if the simulation stops. On the server this method is called before the process is unloaded, this can happened if the process model version, the process model or the web application is deactivated. Implementors must use this method to abort all running request.- Specified by:
stopin interfaceIProcessExtension- Throws:
Exception- if bean can not be stopped- API:
- This public API is available in Java.
-
getConfigurationProperty
@Deprecated(since="11.2", forRemoval=true) protected String getConfigurationProperty(String name) throws IOException Deprecated, for removal: This API element is subject to removal in a future version.usegetConfig()instead.Gets a configuration property.
This method only works correct if the configuration string contains a serialized
Propertiesobject.- Parameters:
name- the name of the configuration property- Returns:
- the configuration property value. Maybe null.
- Throws:
IOException- if configuration string cannot be load into a Properties object- API:
- This public API is available in Java.
-
getConfigurationPropertyNames
@Deprecated(since="11.2", forRemoval=true) protected Set<String> getConfigurationPropertyNames() throws IOExceptionDeprecated, for removal: This API element is subject to removal in a future version.Gets the names of the configuration properties- Returns:
- set of names. Never null. Maybe empty
- Throws:
IOException- if configuration string cannot be load into a Properties object- API:
- This public API is available in Java.
-
getServerExtension
protected IServerExtension getServerExtension(IIvyScriptContext context, String serverExtensionIdentifier) Gets the server extension for the given server extension identifier- Parameters:
context- the ivy script context that is provided as parameter in the perform methodserverExtensionIdentifier- the server extension identifier- Returns:
- server extension or null
- API:
- This public API is available in Java.
-
getExtensions
Gets the extensions interface- Parameters:
context- the ivy script context that is provided as parameter in the perform method- Returns:
- server extension or null
- API:
- This public API is available in Java.
-
getRequest
Gets the request object- Parameters:
context- the ivy script context that is provided as parameter in the perform method- Returns:
- request object
- API:
- This public API is available in Java.
-
getResponse
Gets the response object- Parameters:
context- the ivy script context that is provided as parameter in the perform method- Returns:
- response object
- API:
- This public API is available in Java.
-
getWf
Gets the workflow context- Parameters:
context- the ivy script context that is provided as parameter in the perform method- Returns:
- workflow context
- API:
- This public API is available in Java.
-
getSession
Gets the current workflow session- Parameters:
context- the ivy script context that is provided as parameter in the perform method- Returns:
- workflow session
- API:
- This public API is available in Java.
-
getTask
Gets the current workflow task- Parameters:
context- the ivy script context that is provided as parameter in the perform method- Returns:
- workflow task
- API:
- This public API is available in Java.
-
getCase
Gets the current workflow case- Parameters:
context- the ivy script context that is provided as parameter in the perform method- Returns:
- workflow case
- API:
- This public API is available in Java.
-
getContentManagementSystem
Gets the content management system- Parameters:
context- the ivy script context that is provided as parameter in the perform method- Returns:
- content management system
- API:
- This public API is available in Java.
-
getLog
Gets the log- Parameters:
context- the ivy script context that is provided as parameter in the perform method- Returns:
- log
- API:
- This public API is available in Java.
-
executeIvyScript
protected Object executeIvyScript(IIvyScriptContext context, String script) throws IvyScriptException Executes an ivy script script- Parameters:
context- the ivy script context that is used to execute the script. Either the context that is provided as parameter in the perform method or a new context that has the context provided as parameter in the perform method as outer context.script- the script to execute- Returns:
- result of the executed script
- Throws:
IvyScriptException- if execution failsPersistencyException- if persistency access fails- API:
- This public API is available in Java.
-
executeAsSystem
@Deprecated(since="11.1", forRemoval=true) protected <T> T executeAsSystem(Callable<T> callable) throws Exception Deprecated, for removal: This API element is subject to removal in a future version.Executes the given callable in the security execution context of the system- Type Parameters:
T- The type of the return value of the callable- Parameters:
callable- the callable to execute in the system security execution context- Returns:
- return value of the callable
- Throws:
Exception- if callable throws an exception- API:
- This public API is available in Java.
-
parseIvyScript
protected IIvyScriptInstruction parseIvyScript(IIvyScriptContext context, String script, String returnTypeName) throws IvyScriptException, PersistencyException Parses an ivy script script- Parameters:
context- the ivy script context that is used to parse the script. Either the context that is provided as parameter in the perform method or a new context that has the context provided as parameter in the perform method as outer context.script- the script to parsereturnTypeName- the name of the type the script returns. Maybe null if not known or script does not return something.- Returns:
- the parsed ivy script instruction
- Throws:
IvyScriptException- if parse failsPersistencyException- if persistency access fails- API:
- This public API is available in Java.
-
executeIvyScript
protected Object executeIvyScript(IIvyScriptContext context, IIvyScriptInstruction instruction) throws IvyScriptException, PersistencyException Executes an ivy script instruction. An instruction can be created with the methodparseIvyScript(IIvyScriptContext, String, String).- Parameters:
context- the ivy script context that is used to execute the instruction. Either the context that is provided as parameter in the perform method or a new context that has the context provided as parameter in the perform method as outer context.instruction- the instruction to execute- Returns:
- result of the executed instruction
- Throws:
IvyScriptException- if execution failsPersistencyException- if persistency access fails- API:
- This public API is available in Java.
-
setVariableValue
protected void setVariableValue(IIvyScriptContext context, String variableName, Object value) throws IvyScriptException Sets the value of a variable in the given the context- Parameters:
context- the context to set the variable onvariableName- the name of the variablevalue- the variable value- Throws:
IvyScriptException- if variable value cannot be set- API:
- This public API is available in Java.
-
setProcessDataField
protected void setProcessDataField(IIvyScriptContext context, String processDataField, Object value) throws IvyScriptException Sets the given value to the given process data field.
Examples
- Sets the process data field in.name to "Hello":
setProcessData(context, "name", "hello") - Sets the process data field in.name to "Hello":
setProcessData(context, "in.name", "hello") - Sets the process data field in.address.nr to 45:
setProcessData(context, "address.nr", 45)
If parent fields of the field that has to be set are not initialized they are auto initialized.
- Parameters:
context- the ivy script contextprocessDataField- the name (street) or field path (address.street) of the process data fieldvalue- the value to set- Throws:
PersistencyException- if value cannot be setIvyScriptException- if value cannot be set- API:
- This public API is available in Java.
- Sets the process data field in.name to "Hello":
-
getProcessDataField
protected Object getProcessDataField(IIvyScriptContext context, String processDataField) throws IvyScriptException Gets the value of the given process data field
Examples
- Gets the process data field in.name to "Hello":
getProcessData(context, "name") - Gets the process data field in.name to "Hello":
getProcessData(context, "in.name") - Gets the process data field in.address.nr to 45:
getProcessData(context, "address.nr"
If the field to get is not initialized it is auto initialized.
- Parameters:
context- the ivy script contextprocessDataField- the name (street) or field path (address.street) of the process data field- Returns:
- value of the process data field
- Throws:
PersistencyException- if process data field could not be getIvyScriptException- if process data field could not be get- API:
- This public API is available in Java.
- Gets the process data field in.name to "Hello":
-
declareVariable
protected void declareVariable(IIvyScriptContext context, String variableName, String variableTypeName) throws IvyScriptVariableAlreadyDeclaredException Declares a variable inside the given context- Parameters:
context- the contextvariableName- the name of the variablevariableTypeName- the name of the type of the variable- Throws:
PersistencyException- if persistency access failsIvyScriptVariableAlreadyDeclaredException- if variable is already declared- API:
- This public API is available in Java.
-
declareAndInitializeVariable
protected void declareAndInitializeVariable(IIvyScriptContext context, String variableName, String variableTypeName, Object initValue) throws IvyScriptException Declares a variable inside the given context and initializes it with the given value- Parameters:
context- the context to declare the variable invariableName- the name of the variablevariableTypeName- the name of the type of the variableinitValue- the initial value of the variable- Throws:
PersistencyException- if persistency access failsIvyScriptException- if variable cannot be declared or initialized- API:
- This public API is available in Java.
-
createOwnContext
Creates a new context- Parameters:
outerContext- the outer context- Returns:
- new context
- API:
- This public API is available in Java.
-
getProcessElementIdentifier
Gets the process element identifier- Returns:
- process element identifier
- API:
- This public API is available in Java.
-
Sudo.call(Callable)