Class AbstractProcessExtension

java.lang.Object
ch.ivyteam.ivy.process.extension.impl.AbstractProcessExtension
All Implemented Interfaces:
IProcessExtension
Direct Known Subclasses:
AbstractUserProcessExtension

public abstract class AbstractProcessExtension extends Object implements IProcessExtension
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 Details

    • abort

      public void abort(IRequestId requestId)
      Description copied from interface: IProcessExtension
      The request with the request id must be aborted Called if a timeout exception occurs.
      Specified by:
      abort in interface IProcessExtension
      Parameters:
      requestId - the identifier of the request to stop
      See Also:
      API:
      This public API is available in Java.
    • getAdditionalLogInfo

      public String getAdditionalLogInfo(IRequestId requestId)
      Description copied from interface: IProcessExtension
      Gets addition log info. This information will be added to all log messages.
      Specified by:
      getAdditionalLogInfo in interface IProcessExtension
      Parameters:
      requestId - the identifier of the request
      Returns:
      additional log info
      See Also:
      API:
      This public API is available in Java.
    • release

      public void release() throws Exception
      Description copied from interface: IProcessExtension
      This 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:
      release in interface IProcessExtension
      Throws:
      Exception - if bean can not be released
      See Also:
      API:
      This public API is available in Java.
    • setConfiguration

      public void setConfiguration(String _configuration)
      Description copied from interface: IProcessExtension
      Sets the configuration of the process extension
      Specified by:
      setConfiguration in interface IProcessExtension
      Parameters:
      _configuration - the process extension configuration
      See Also:
      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 Exception
      Description copied from interface: IProcessExtension
      On 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:
      start in interface IProcessExtension
      Throws:
      Exception - if bean can not be started
      See Also:
      API:
      This public API is available in Java.
    • stop

      public void stop() throws Exception
      Description copied from interface: IProcessExtension
      On 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:
      stop in interface IProcessExtension
      Throws:
      Exception - if bean can not be stopped
      See Also:
      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 Properties object.

      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 method
      serverExtensionIdentifier - 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 fails
      PersistencyException - 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 parse
      returnTypeName - 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 fails
      PersistencyException - 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 method parseIvyScript(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 fails
      PersistencyException - 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 on
      variableName - the name of the variable
      value - 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 context
      processDataField - the name (street) or field path (address.street) of the process data field
      value - the value to set
      Throws:
      PersistencyException - if value cannot be set
      IvyScriptException - if value cannot be set
      API:
      This public API is available in Java.
    • 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 context
      processDataField - 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 get
      IvyScriptException - if process data field could not be get
      API:
      This public API is available in Java.
    • declareVariable

      protected void declareVariable(IIvyScriptContext context, String variableName, String variableTypeName) throws IvyScriptVariableAlreadyDeclaredException
      Declares a variable inside the given context
      Parameters:
      context - the context
      variableName - the name of the variable
      variableTypeName - the name of the type of the variable
      Throws:
      PersistencyException - if persistency access fails
      IvyScriptVariableAlreadyDeclaredException - 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 in
      variableName - the name of the variable
      variableTypeName - the name of the type of the variable
      initValue - the initial value of the variable
      Throws:
      PersistencyException - if persistency access fails
      IvyScriptException - 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.