Package org.openbravo.scheduling
Class ProcessBundle
- java.lang.Object
-
- org.openbravo.scheduling.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ProcessBundle.Channel
-
Field Summary
Fields Modifier and Type Field Description static String
CONFIG_PARAMS
String constant for retrieval of the applications' configuration paramters.static String
CONNECTION
String constant for retrieval of the process' database connection.static String
KEY
String constant to retrieve the ProcessBundle from the Quartz JobExecutionContextstatic String
PINSTANCE
String constant key for the pinstance identifier.
-
Constructor Summary
Constructors Constructor Description 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.ProcessBundle(String processId, VariablesSecureApp vars)
Creates a new ProcessBundle for the given processId and application security variables.ProcessBundle(String processId, VariablesSecureApp vars, ProcessBundle.Channel channel, String client, String organization, boolean roleSecurity)
Creates a new ProcessBundle object with the given parameters.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.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description List<String>
getBannedClusterInstanceNames()
ProcessBundle.Channel
getChannel()
boolean
getCloseConnection()
ConfigParameters
getConfig()
ConnectionProvider
getConnection()
ProcessContext
getContext()
GroupInfo
getGroupInfo()
Returns the info of the groupString
getImpl()
Returns the implementation of the process.String
getLog()
ProcessLogger
getLogger()
Map<String,Object>
getParams()
Returns the parameters for this process.String
getParamsDefalated()
Deprecated.Use insteadgetParamsDeflated()
String
getParamsDeflated()
String
getPinstanceId()
Returns, in the case that this process is an instance of pinstance procedure, the process' pinstance id.Class<? extends Process>
getProcessClass()
String
getProcessId()
Returns the unique id for the implementation of this process.String
getProcessRequestId()
Returns the unique id for the schedule configuration of this process.String
getProcessRunId()
Returns the id of the process run.Object
getResult()
ProcessBundle
init(ConnectionProvider conn)
Initializes the ProcessBundle, setting its implementation, parameters and actual Java class implementation that will be executed by the Quartz Scheduler or a direct ProcessRunnerboolean
isGroup()
Returns true if the process is a groupstatic ProcessBundle
pinstance(String pinstanceId, VariablesSecureApp vars, ConnectionProvider conn)
Utility method to create a new Process bundle from the details of in AD_PINSTANCE for the given pinstanceIdstatic ProcessBundle
request(String requestId, VariablesSecureApp vars, ConnectionProvider conn)
Constructions a ProcessBundle object from a scheduled request id.void
setChannel(ProcessBundle.Channel channel)
void
setCloseConnection(boolean closeConnection)
void
setConfig(ConfigParameters config)
void
setConnection(ConnectionProvider connection)
void
setGroupInfo(GroupInfo groupInfo)
void
setLog(ProcessLogger logger)
void
setParams(Map<String,Object> params)
void
setProcessClass(Class<? extends Process> processClass)
void
setProcessRunId(String strProcessRunId)
void
setResult(Object result)
-
-
-
Field Detail
-
KEY
public static final String KEY
String constant to retrieve the ProcessBundle from the Quartz JobExecutionContext- See Also:
- Constant Field Values
-
PINSTANCE
public static final String PINSTANCE
String constant key for the pinstance identifier.- 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 idvars
- 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 idvars
- clients security/application context variableschannel
- the channel through which this process was scheduled/executedclient
- the client that scheduled/executed this processorganization
- 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 idprocessRequestId
- the process request id (the id of the schedule configuration definition record)vars
- clients security/application context variableschannel
- the channel through which this process was scheduled/executedclient
- the client that scheduled/executed this processorganization
- 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 idvars
- clients security/application context variableschannel
- the channel through which this process was scheduled/executedclient
- the client that scheduled/executed this processorganization
- the organization under which this process will runroleSecurity
- is role securitygroupInfo
- 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.Use insteadgetParamsDeflated()
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
-
setProcessRunId
public void setProcessRunId(String strProcessRunId)
-
getContext
public ProcessContext getContext()
-
getConnection
public ConnectionProvider getConnection()
-
setConnection
public void setConnection(ConnectionProvider connection)
-
getConfig
public ConfigParameters getConfig()
-
setConfig
public void setConfig(ConfigParameters config)
-
getLogger
public ProcessLogger getLogger()
-
setLog
public void setLog(ProcessLogger logger)
-
setGroupInfo
public void setGroupInfo(GroupInfo groupInfo)
-
getLog
public String getLog()
-
getResult
public Object getResult()
-
setResult
public void setResult(Object result)
-
getChannel
public ProcessBundle.Channel getChannel()
-
setChannel
public void setChannel(ProcessBundle.Channel channel)
-
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 ProcessContextconn
- 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 idvars
- the application context/security variablesconn
- 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
-
-