Class AbstractProcessExtension
- java.lang.Object
-
- ch.ivyteam.ivy.process.extension.impl.AbstractProcessExtension
-
- All Implemented Interfaces:
IProcessExtension
- Direct Known Subclasses:
AbstractUserAsynchronousProcessExtension,AbstractUserProcessExtension
public abstract class AbstractProcessExtension extends Object implements IProcessExtension
Abstract base class that implements theIProcessExtensioninterface. 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabort(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)Executes the given callable in the security execution context of the systemprotected ObjectexecuteIvyScript(IIvyScriptContext context, IIvyScriptInstruction instruction)Executes an ivy script instruction.protected ObjectexecuteIvyScript(IIvyScriptContext context, String script)Executes an ivy script scriptStringgetAdditionalLogInfo(IRequestId requestId)Gets addition log info.protected ICasegetCase(IIvyScriptContext context)Gets the current workflow caseprotected StringgetConfiguration()Gets the configurationprotected StringgetConfigurationProperty(String name)Gets a configuration property.protected Set<String>getConfigurationPropertyNames()Gets the names of the configuration propertiesprotected IContentManagementSystemgetContentManagementSystem(IIvyScriptContext context)Gets 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 StringgetProcessElementIdentifier()Gets 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)Sets the configuration of the process extensionprotected 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 Detail
-
abort
public void abort(IRequestId requestId)
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- See Also:
IProcessExtension.abort(ch.ivyteam.ivy.process.engine.IRequestId)- API:
- This public API is available in Java.
-
getAdditionalLogInfo
public String getAdditionalLogInfo(IRequestId requestId)
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
- See Also:
IProcessExtension.getAdditionalLogInfo(ch.ivyteam.ivy.process.engine.IRequestId)- API:
- This public API is available in Java.
-
release
public void release() throws ExceptionDescription 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- See Also:
IProcessExtension.release()- API:
- This public API is available in Java.
-
setConfiguration
public void setConfiguration(String _configuration)
Description copied from interface:IProcessExtensionSets the configuration of the process extension- Specified by:
setConfigurationin interfaceIProcessExtension- Parameters:
_configuration- the process extension configuration- See Also:
IProcessExtension.setConfiguration(java.lang.String)- API:
- This public API is available in Java.
-
getConfiguration
protected String getConfiguration()
Gets the configuration- Returns:
- configuration
- API:
- This public API is available in Java.
-
start
public void start() throws ExceptionDescription 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- See Also:
IProcessExtension.start()- API:
- This public API is available in Java.
-
stop
public void stop() throws ExceptionDescription 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- See Also:
IProcessExtension.stop()- API:
- This public API is available in Java.
-
getConfigurationProperty
protected String getConfigurationProperty(String name) throws IOException
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
protected Set<String> getConfigurationPropertyNames() throws IOException
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
protected IExtensions getExtensions(IIvyScriptContext context)
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
protected IProcessModelVersionRequest getRequest(IIvyScriptContext context)
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
protected IResponse getResponse(IIvyScriptContext context)
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
protected IWorkflowContext getWf(IIvyScriptContext context)
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
protected IWorkflowSession getSession(IIvyScriptContext context)
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
protected ITask getTask(IIvyScriptContext context)
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
protected ICase getCase(IIvyScriptContext context)
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
protected IContentManagementSystem getContentManagementSystem(IIvyScriptContext context)
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
protected Logger getLog(IIvyScriptContext context)
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
protected <T> T executeAsSystem(Callable<T> callable) throws Exception
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
protected IIvyScriptContext createOwnContext(IIvyScriptContext outerContext)
Creates a new context- Parameters:
outerContext- the outer context- Returns:
- new context
- API:
- This public API is available in Java.
-
getProcessElementIdentifier
protected String getProcessElementIdentifier()
Gets the process element identifier- Returns:
- process element identifier
- API:
- This public API is available in Java.
-
-