Class ProcessBundle

  • All Implemented Interfaces:
    Serializable

    public class ProcessBundle
    extends Object
    implements Serializable
    A ProcessBundle is a 'container' holding all the relevant information required to execute a process in the Openbravo system, including security/contextual details such as User, Client and Organization, execution parameters, a logger (used by the Process Monitor) and process implementation specifics. Integrating with Quartz, the ProcessBundle is stored in the JobExecutionContext, which is used by each execution of a particular Job.
    Author:
    awolski
    See Also:
    Serialized Form
    • Field Detail

      • KEY

        public static final String KEY
        String constant to retrieve the ProcessBundle from the Quartz JobExecutionContext
        See Also:
        Constant Field Values
      • CONNECTION

        public static final String CONNECTION
        String constant for retrieval of the process' database connection.
        See Also:
        Constant Field Values
      • CONFIG_PARAMS

        public static final String CONFIG_PARAMS
        String constant for retrieval of the applications' configuration paramters.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ProcessBundle

        public ProcessBundle​(String processId,
                             VariablesSecureApp vars)
        Creates a new ProcessBundle for the given processId and application security variables.
        Parameters:
        processId - the process id
        vars - clients security/context variables
      • ProcessBundle

        public ProcessBundle​(String processId,
                             VariablesSecureApp vars,
                             ProcessBundle.Channel channel,
                             String client,
                             String organization,
                             boolean roleSecurity)
        Creates a new ProcessBundle object with the given parameters.
        Parameters:
        processId - the process id
        vars - clients security/application context variables
        channel - the channel through which this process was scheduled/executed
        client - the client that scheduled/executed this process
        organization - the organization under which this process will run
      • ProcessBundle

        public ProcessBundle​(String processId,
                             String processRequestId,
                             VariablesSecureApp vars,
                             ProcessBundle.Channel channel,
                             String client,
                             String organization,
                             boolean roleSecurity)
        Creates a new ProcessBundle object with the given parameters.
        Parameters:
        processId - the process id
        processRequestId - the process request id (the id of the schedule configuration definition record)
        vars - clients security/application context variables
        channel - the channel through which this process was scheduled/executed
        client - the client that scheduled/executed this process
        organization - the organization under which this process will run
      • ProcessBundle

        public ProcessBundle​(String processId,
                             VariablesSecureApp vars,
                             ProcessBundle.Channel channel,
                             String client,
                             String organization,
                             boolean roleSecurity,
                             GroupInfo groupInfo)
        Creates a new ProcessBundle object with the given parameters.
        Parameters:
        processId - the process id
        vars - clients security/application context variables
        channel - the channel through which this process was scheduled/executed
        client - the client that scheduled/executed this process
        organization - the organization under which this process will run
        roleSecurity - is role security
        groupInfo - the information of the process group which the process belongs to
    • Method Detail

      • getProcessRequestId

        public String getProcessRequestId()
        Returns the unique id for the schedule configuration of this process.
        Returns:
        the process request's id (primary key within the ProcessRequest entity)
      • getProcessRunId

        public String getProcessRunId()
        Returns the id of the process run.
        Returns:
        Returns the id of the process run
      • getProcessId

        public String getProcessId()
        Returns the unique id for the implementation of this process.
        Returns:
        the process' id
      • getPinstanceId

        public String getPinstanceId()
        Returns, in the case that this process is an instance of pinstance procedure, the process' pinstance id.
        Returns:
        the pinstance id
      • getImpl

        public String getImpl()
        Returns the implementation of the process. For example, if the procedure referenced by processId is a database procedure and has a procedure name associated, getImpl will return the name of the procedure to call.
        Returns:
        the implementation of the process
      • getParams

        public Map<String,​Object> getParams()
        Returns the parameters for this process. This is guaranteed not to be null. For the moment only parameters of type String or JSONObject are supported.
        Returns:
        the process parameter map
      • getParamsDefalated

        @Deprecated
        public String getParamsDefalated()
        Deprecated.
        Returns a string representation of the process parameters in key=value pairs.
        Returns:
        a deflated string representation of the process' parameter map
      • getParamsDeflated

        public String getParamsDeflated()
      • isGroup

        public boolean isGroup()
        Returns true if the process is a group
        Returns:
        true if the process is a group
      • getGroupInfo

        public GroupInfo getGroupInfo()
        Returns the info of the group
        Returns:
        the info of the group
      • getBannedClusterInstanceNames

        public List<String> getBannedClusterInstanceNames()
      • setProcessRunId

        public void setProcessRunId​(String strProcessRunId)
      • getProcessClass

        public Class<? extends Process> getProcessClass()
      • setProcessClass

        public void setProcessClass​(Class<? extends Process> processClass)
      • setGroupInfo

        public void setGroupInfo​(GroupInfo groupInfo)
      • getLog

        public String getLog()
      • getResult

        public Object getResult()
      • setResult

        public void setResult​(Object result)
      • getCloseConnection

        public boolean getCloseConnection()
      • setCloseConnection

        public void setCloseConnection​(boolean closeConnection)
      • init

        public ProcessBundle init​(ConnectionProvider conn)
                           throws javax.servlet.ServletException
        Initializes the ProcessBundle, setting its implementation, parameters and actual Java class implementation that will be executed by the Quartz Scheduler or a direct ProcessRunner
        Parameters:
        conn - a connection to the database
        Returns:
        the initialized ProcessBundle
        Throws:
        javax.servlet.ServletException - if there is an error initializing the bundle
      • pinstance

        public static final ProcessBundle pinstance​(String pinstanceId,
                                                    VariablesSecureApp vars,
                                                    ConnectionProvider conn)
                                             throws javax.servlet.ServletException
        Utility method to create a new Process bundle from the details of in AD_PINSTANCE for the given pinstanceId
        Parameters:
        pinstanceId - Pinstance Id.
        vars - VariablesSecureApp to be converted into the ProcessContext
        conn - ConnectionProvider
        Returns:
        a new instance of this class created from the pInstance record in the db
        Throws:
        javax.servlet.ServletException
      • request

        public static final ProcessBundle request​(String requestId,
                                                  VariablesSecureApp vars,
                                                  ConnectionProvider conn)
                                           throws javax.servlet.ServletException
        Constructions a ProcessBundle object from a scheduled request id. This is normally called from the Process Scheduler window.
        Parameters:
        requestId - the request id
        vars - the application context/security variables
        conn - a connection to the database
        Returns:
        a new ProcessBundle object based on the information in the request
        Throws:
        javax.servlet.ServletException - if an error occurs retrieving the request from the database