Qorus Integration Engine® Enterprise Edition 7.1.0_prod
Loading...
Searching...
No Matches
OMQ::UserApi::Workflow::QorusWorkflow Class Reference

Base class for workflow classes. More...

Inheritance diagram for OMQ::UserApi::Workflow::QorusWorkflow:
[legend]
Collaboration diagram for OMQ::UserApi::Workflow::QorusWorkflow:
[legend]

Public Member Methods

final attach ()
 This method is called when Qorus starts working on a workflow order data instance; it in turn calls attachImpl() which can be overridden in subclasses.
 
final detach (string status, *string external_order_instanceid)
 This method is called when the workflow order data instance status is committed to the database; it in turn calls detachImpl() which can be overridden in subclasses.
 
final oneTimeInit ()
 This method is executed once when the workflow execution instance starts or is reset; it in turn calls oneTimeInitImpl() which can be overridden in subclasses.
 
final errorHandler (string errcode, *hash< auto > errinfo, auto opt)
 This method is called when errors are raised; it in turn calls errorHandlerImpl() which can be overridden in subclasses.
 

Private Member Methods

 attachImpl ()
 This method is called when Qorus starts working on a workflow order data instance; this method may be overridden in subclasses.
 
 detachImpl (string status, *string external_order_instanceid)
 This method is called when the workflow order data instance status is committed to the database; this method may be overridden in subclasses.
 
 oneTimeInitImpl ()
 This method is executed once when the workflow execution instance starts or is reset; this method may be overridden in subclasses.
 
 errorHandlerImpl (string errcode, *hash< auto > errinfo, auto opt)
 This method is called when errors are raised and may be overridden in subclasses.
 

Additional Inherited Members

- Static Public Member Methods inherited from OMQ::UserApi::Workflow::WorkflowApi
static string generateUniqueKey ()
 returns a unique async key for the order for use with QorusAsyncStepBase::submitAsyncKey()
 
static stepError (string err, auto info)
 Raises an error against the current step without affecting the flow of processing.
 
static stepError (string err, auto info, date retry_delay)
 Raises an error against the current step without affecting the flow of processing.
 
static stepError (string err, auto info, int retry_delay)
 Raises an error against the current step without affecting the flow of processing.
 
static stepWarning (string err, auto info)
 Raises a warning against the step.
 
static stepWarning (string err, string fmt,...)
 Raises a warning against the step.
 
static setRetryDelay (date delay)
 Sets the value of the retry delay for a step error or an asynchronous step.
 
static setRetryDelay (int secs)
 Sets the value of the retry delay for a step error or an asynchronous step.
 
static *hash< auto > getErrorInfo (string err)
 Returns the hash data associated with the error code passed as an argument.
 
static updateDynamicData (hash< auto > hash)
 Updates the values of one or more keys in the workflow order’s dynamic data hash.
 
static deleteDynamicDataKey (softlist< auto > list)
 Deletes one or more keys from the workflow order data instance’s dynamic data hash.
 
static auto getDynamicData (...)
 Retrieves the values of one or more keys from the workflow order data instance’s dynamic data hash.
 
static auto getDynamicDataArgs (*softlist< auto > keylist)
 Retrieves the values of one or more keys from the workflow order data instance’s dynamic data hash.
 
static auto getStaticData (...)
 Retrieves the values of one or more keys from the workflow order data instance’s static data hash.
 
static auto getStaticDataArgs (*softlist< auto > keylist)
 Retrieves the values of one or more keys from the workflow order data instance’s static data hash.
 
static updateTempData (hash< auto > hash)
 Updates the values of one or more keys in the workflow order data instance’s temporary data hash.
 
static auto getTempData (...)
 Retrieves the values of one or more keys from the workflow order data instance’s temporary data hash.
 
static auto getTempDataArgs (*softlist< auto > keylist)
 Retrieves the values of one or more keys from the workflow order data instance’s temporary data hash.
 
static deleteTempDataKey (softlist< auto > keylist)
 Deletes one or more keys from the workflow order data instance’s temporary data hash.
 
static updateSensitiveData (string skey, string svalue, hash< auto > hash, *softlist aliases, *hash< auto > meta)
 Updates or creates the values of one or more keys in the workflow order's sensitive data hash for the given sensitive data key and value.
 
static updateSensitiveDataFromAlias (string alias, hash< auto > hash, *hash< auto > meta)
 Updates or creates the values of one or more keys in the workflow order's sensitive data hash for the given sensitive data alias.
 
static auto getSensitiveMetadata (string skey, string svalue)
 Returns the sensitive metadata hash for the given sensitive data key and value if present, otherwise returns an empty hash.
 
static hash getSensitiveMetadataFromAlias (string alias)
 returns a hash with the corresponding sensitive data key and sensitive data value as well as the value of the sensitive metadata hash for the given sensitive data alias corresponding to a sensitive data key and value
 
static auto getSensitiveData (string skey, string svalue,...)
 Returns the sensitive data for the given sensitive data key and value.
 
static auto getSensitiveDataArgs (string skey, string svalue, *list< auto > keylist)
 Returns the sensitive data for the given sensitive data key and value.
 
static hash< auto > getSensitiveDataFromAlias (string alias,...)
 returns a hash with the corresponding sensitive data key and sensitive data value as well as the value of one or more keys in the workflow sensitive data hash for the given sensitive data alias corresponding to a sensitive data key and value
 
static hash< auto > getSensitiveDataFromAliasArgs (string alias, *list< auto > keylist)
 returns a hash with the corresponding sensitive data key and sensitive data value as well as the value of one or more keys in the workflow sensitive data hash for the given sensitive data alias corresponding to a sensitive data key and value
 
static hash< auto > getSensitiveDataAliases ()
 returns a hash of all sensitive data aliases for the current order or an empty hash if there are none
 
static bool deleteSensitiveData (string skey, string svalue)
 Deletes the sensitive data hash for the given sensitive data key and value; changes have already been committed to the database when this method returns.
 
static bool deleteSensitiveDataKey (string skey, string svalue, softlist< auto > list)
 Deletes one or more keys from the workflow order data instance’s sensitive data hash for the given sensitive data key and value; changes have already been committed to the database when this method returns.
 
static hash getSensitiveDataKeyValues ()
 Returns a hash of sensitive data keys and values saved against the order; the sensitive data hashes themselves are not returned, just the information used to index sensitive data against the order.
 
static updateInstanceData (hash< auto > hash)
 Updates the values of one or more keys in the workflow execution instance’s instance data hash.
 
static deleteInstanceDataKey (softlist< auto > list)
 Deletes a single key or a list of keys from the workflow execution instance’s instance data hash.
 
static auto getInstanceData (...)
 Retrieves the values of one or more keys from the workflow execution instance’s instance data hash.
 
static auto getInstanceDataArgs (*list< auto > keylist)
 Retrieves the values of one or more keys from the workflow execution instance’s instance data hash.
 
static auto getWorkflowInstanceData (string field)
 Retrieves the value of a single key (system-defined property) from the workflow execution instance object itself.
 
static hash< auto > getWorkflowInstanceData (...)
 Retrieves the values of multiple keys (system-defined properties) from the workflow execution instance object itself.
 
static hash< auto > getWorkflowInstanceDataArgs (*list< auto > keylist)
 Retrieves the values of one or more keys (system-defined properties) from the workflow execution instance object itself as a hash.
 
static setOrderKeys (hash< auto > h, bool truncate=False)
 This method sets user-defined order keys against an order, so that the workflow order data instance can be quickly searched and retrieved using the key value.
 
static setOrderKey (string key, softlist< softstring > value, bool truncate=False)
 This method sets the values for a sinle user-defined order key against an order, so that the workflow order data instance can be quickly searched and retrieved using the key value.
 
static appendOrderKeys (hash< auto > h, bool truncate=False)
 This method appends user-defined order key values to a workflow order key, so that the workflow order data instance can be quickly searched and retrieved using the key value.
 
static appendOrderKeys (string key, softlist< softstring > value, bool truncate=False)
 This method appends user-defined order key values to a workflow order key, so that the workflow order data instance can be quickly searched and retrieved using the key value.
 
static auto getOrderKeys (...)
 This method retrieves the user-defined order key information saved against the workflow order data instance.
 
static auto getOrderKeysArgs (*softlist< auto > keylist)
 This method retrieves the user-defined order key information saved against the workflow order data instance.
 
static bool stepExecuted (string stepname)
 This method returns True if the step passed has been executed and has status OMQ::StatComplete ("C")
 
static *string getStepStatus (string stepname)
 Returns the current status of the given step for the current workflow order instance.
 
static *hash< auto > getStepInfo ()
 This method will return a hash of step information for the current step.
 
static hash< auto > getWorkflowMetadata ()
 returns workflow metadata for the currently running workflow as a hash
 
static setBlocked ()
 set the current workflow order status to OMQ::StatBlocked, can only be called from the attach function
 
static list getOrderNotes (*int count)
 Get Order Instance Notes.
 
static addOrderNote (string notestr)
 Add new note as described in Order Instance Notes.
 
static setCustomStatus (string stat)
 Sets a user-defined custom status for the current step.
 
static rescheduleOrder (date scheduled)
 reschedules the current workflow order instance for later processing
 
static reprioritizeOrder (int prio)
 changes the order priority for the current workflow order instance
 
static leaveParentFeedback (string key, auto value)
 leaves feedback for a parent workflow
 
static auto getChildFeedback (string key)
 gets feedback from a child workflow order with the given key
 
static *hash< auto > getChildFeedback ()
 gets all feedback from all child workflow orders as a hash
 
static setOption (hash< auto > hash)
 Changes option values on a workflow.
 
static setOption (string option, auto value)
 Changes a single option value on a workflow.
 
static auto getOption (...)
 Returns the value of the named workflow option(s)
 
static auto getOptionArgs (*softlist< string > args)
 Returns the value of the named workflow option or options.
 
static *softint parentWfiid ()
 Returns the parent workflow order data instance ID from a subworkflow or NOTHING if the current workflow order is not a subworkflow and therefore has no parent.
 
static *softint getWfiid ()
 returns the current workflow_instanceid as an integer; returns NOTHING if not called in a workflow order context (ex: onetimeinit function, etc)
 
static int sleep (softint arg)
 puts the current thread to sleep for a certain number of seconds
 
static int usleep (softint arg)
 puts the current thread to sleep for a certain number of microseconds
 
static int usleep (date arg)
 puts the current thread to sleep for a certain number of microseconds
 
static auto getConfigItemValue (string item, *hash< auto > local_context, bool expand_complex_values=True)
 returns the value of the given step configuration item
 
static hash< auto > getConfigItemHash (*hash< auto > local_context)
 returns a hash of all configuration items for the current step
 
- Static Public Member Methods inherited from OMQ::UserApi::UserApi
static *hash< auto > getUserServiceInfo (string name)
 returns information about the given user service (if it's currently loaded)
 
static SqlUtil::AbstractTable getSqlTable (string datasource, string table_name, bool register_dependency=True)
 get a cached table object (suitable for DML) if present, otherwise it creates one from scratch
 
static SqlUtil::AbstractTable getSqlTable (AbstractDatasource datasource, string table_name, bool register_dependency=True)
 get a cached table object (suitable for DML) if present, otherwise it creates one from scratch
 
static hash< auto > getSqlCacheInfo ()
 get information about cached object
 
static clearSqlTableCache (string datasource, *string table_name)
 clears all objects for given datasource from the cache (for example, if database objects have been updated in the dataserver)
 
static clearSqlTableCache (AbstractDatasource datasource, *string table_name)
 clears cached objects for given datasource (for example, if database objects have been updated in the dataserver)
 
static auto getValueMap (string mapname, string key)
 Gets a lookup value from the value map by a key; the value map must be registered to the current interface.
 
static list< auto > getValueMaps ()
 Gets all value maps valid for the current interface.
 
static bool postSlaEventSuccess (string sla, number value)
 posts a successful SLA event for SLA monitoring and performance tracking
 
static bool postSlaEventError (string sla, number value, string err, string desc)
 posts an unsuccessful SLA event for SLA monitoring and performance tracking
 
static flushSlaEvents ()
 flushes all pending SLA events to disk and returns after the data has been committed
 
static *hash< auto > getSystemServiceInfo (string name)
 returns information about the given system service (if it's currently loaded)
 
static *hash< auto > getServiceInfo (string type, string name)
 returns information about the given service (if it's currently loaded)
 
static list getRunningWorkflowList (*string name, *string ver)
 returns a list of hashes giving information about the currently-running workflow execution instances
 
static hash getRunningWorkflowInfo (softint id)
 returns a hash of the workflow execution instance info if the ID is valid or an empty hash if not
 
static softint createOrder (string name, *string version, hash< auto > params, string status=StatReady)
 creates a workflow order data instance in the database
 
static softint createOrder (int wfid, hash< auto > params, string status=StatReady)
 creates a workflow order data instance in the database
 
static softint createRemoteOrder (string remote, string name, *string version, hash< auto > params, string status=StatReady, bool register_dependency=True)
 creates a workflow order data instance in a remote Qorus instance
 
static softint createRemoteOrder (string remote, int wfid, hash< auto > params, string status=StatReady, bool register_dependency=True)
 creates a workflow order data instance in a remote Qorus instance
 
static hash< auto > execSynchronousWorkflow (string name, *string version, hash< auto > sdata, *hash< auto > opts, *hash< auto > ddata, softint priority=DefaultOrderPriority, *hash< auto > orderkeys, *softstring external_order_instanceid, *softint parent_workflow_instanceid)
 executes a workflow order synchronously and returns the final status and order ID in a hash
 
static hash< auto > execSynchronousWorkflow (int wfid, hash< auto > sdata, *hash< auto > opts, *hash< auto > ddata, softint priority=DefaultOrderPriority, *hash< auto > orderkeys, *softstring external_order_instanceid, *softint parent_workflow_instanceid)
 executes a workflow order synchronously and returns the final status and order ID in a hash
 
static hash< auto > execSynchronousWorkflowAsync (string name, *string version, hash< auto > sdata, *hash< auto > opts, *hash< auto > ddata, softint priority=DefaultOrderPriority, *hash< auto > orderkeys, *softstring external_order_instanceid, *softint parent_workflow_instanceid)
 executes a workflow order synchronously in the background and returns immediately
 
static hash< auto > execSynchronousWorkflowAsync (int wfid, hash< auto > sdata, *hash< auto > opts, *hash< auto > ddata, softint priority=DefaultOrderPriority, *hash< auto > orderkeys, *softstring external_order_instanceid, *softint parent_workflow_instanceid)
 executes a workflow order synchronously in the background and returns immediately
 
static int postUserEvent (string severity, auto info)
 posts an application event of class OMQ::QE_CLASS_USER
 
static hash runtimeProperties ()
 returns Qorus runtime properties as a hash
 
static auto callNetworkApiArgsWithAuthentication (string user, string pass, string call, softlist< auto > args)
 calls a system RPC API with authentication information (username and password)
 
static auto callNetworkApiArgs (string call, *softlist< auto > args)
 calls a system RPC API and returns the respose
 
static auto callNetworkApi (string call,...)
 calls a system RPC API and returns the result; the API is called with system permissions (no restrictions)
 
static auto callRestApi (string method, string path, *hash< auto > body_args)
 calls a system REST API method and returns the result
 
static auto callRestApiWithAuthentication (string user, string pass, string method, string path, *hash< auto > body_args)
 calls a system REST API method with authentication information and returns the result
 
- Static Private Member Methods inherited from OMQ::UserApi::UserApi
static QorusProgram DynamicLogic (True, False, CommonParseOptions|PO_NO_INHERIT_USER_CLASSES|PO_NO_INHERIT_USER_FUNC_VARIANTS|PO_NO_INHERIT_GLOBAL_VARS|PO_NO_INHERIT_USER_CONSTANTS|PO_NO_INHERIT_USER_HASHDECLS|PO_NEW_STYLE|PO_STRICT_ARGS|PO_REQUIRE_TYPES, QorusServerDefines, NOTHING, NOTHING,())
 Program for dynamic logic.
 
- Private Attributes inherited from OMQ::UserApi::UserApi
const DataProviderRootValues
 data provider root path values
 
const DataTypeRootValues
 data type root path values
 
const DataProviderPathTypeValues
 data type path provider type values
 

Detailed Description

Base class for workflow classes.

Since
Qorus 4.0.3

Member Function Documentation

◆ attach()

final OMQ::UserApi::Workflow::QorusWorkflow::attach ( )

This method is called when Qorus starts working on a workflow order data instance; it in turn calls attachImpl() which can be overridden in subclasses.

If any error is raised in the attach method (by calling WorkflowApi::stepError() in Qore code or WorkflowApi.stepError() in Java code) or by throwing an appropriate exception), the workflow order data instance will receive an OMQ::StatError status and the attach operation will fail.

Note
TempData can only be reliably set in the attach method, because a workflow can be restarted from any step after an error. Therefore you cannot ensure that TempData set in other step code will be available when executing the following step, in case an error occurs.

◆ attachImpl()

OMQ::UserApi::Workflow::QorusWorkflow::attachImpl ( )
private

This method is called when Qorus starts working on a workflow order data instance; this method may be overridden in subclasses.

If any error is raised in the attach method (by calling WorkflowApi::stepError() in Qore code or WorkflowApi.stepError() in Java code) or by throwing an appropriate exception), the workflow order data instance will receive an OMQ::StatError status and the attach operation will fail.

Note
TempData can only be reliably set in the attach method, because a workflow can be restarted from any step after an error. Therefore you cannot ensure that TempData set in other step code will be available when executing the following step, in case an error occurs.

◆ detach()

final OMQ::UserApi::Workflow::QorusWorkflow::detach ( string  status,
*string  external_order_instanceid 
)

This method is called when the workflow order data instance status is committed to the database; it in turn calls detachImpl() which can be overridden in subclasses.

Parameters
statusThe status being set for the workflow order data instance, see Workflow, Segment, and Step Status Descriptions
external_order_instanceidThe external key for the workflow data being processed, if any exists, otherwise NOTHING

The first argument passed to the method is the workflow order data instance's status (status descriptions) that will be written to the database. The second argument passed is the external order instance ID, if any exists.

◆ detachImpl()

OMQ::UserApi::Workflow::QorusWorkflow::detachImpl ( string  status,
*string  external_order_instanceid 
)
private

This method is called when the workflow order data instance status is committed to the database; this method may be overridden in subclasses.

Parameters
statusThe status being set for the workflow order data instance, see Workflow, Segment, and Step Status Descriptions
external_order_instanceidThe external key for the workflow data being processed, if any exists, otherwise NOTHING

The first argument passed to the method is the workflow order data instance's status (status descriptions) that will be written to the database. The second argument passed is the external order instance ID, if any exists.

◆ errorHandler()

final OMQ::UserApi::Workflow::QorusWorkflow::errorHandler ( string  errcode,
*hash< auto >  errinfo,
auto  opt 
)

This method is called when errors are raised; it in turn calls errorHandlerImpl() which can be overridden in subclasses.

Parameters
errcodethe error code string (ex: "QORE-EXCEPTION")
errinfothis parameter will only be present if the error has been defined by as a workflow error; if so, the hash should have at least the following keys (key names in square brackets (i.e. [name]) are optional):
  • desc: description of the error
  • severity: Error Severity Codes
  • status: either OMQ::StatRetry (meaning that the step should be retried) or OMQ::StatError
  • [retry-delay]: the delay in seconds before the error should be retried (only valid when status is OMQ::StatRetry)
  • [business]: if True, this error represents a business error (rather than a technical error); usually implying that there is a problem with the consistency of the order data
optan optional parameter that can be supplied by the workflow when an error is raised, normally a string providing additional information about the error

This method allows the workflow to do external logging or to take custom actions when errors are raised.

The default implementation in the base class is empty.

◆ errorHandlerImpl()

OMQ::UserApi::Workflow::QorusWorkflow::errorHandlerImpl ( string  errcode,
*hash< auto >  errinfo,
auto  opt 
)
private

This method is called when errors are raised and may be overridden in subclasses.

Parameters
errcodethe error code string (ex: "QORE-EXCEPTION")
errinfothis parameter will only be present if the error has been defined as a workflow error; if so, the hash should have at least the following keys (key names in square brackets (i.e. [name]) are optional):
  • desc: description of the error
  • severity: Error Severity Codes
  • status: either OMQ::StatRetry (meaning that the step should be retried) or OMQ::StatError
  • [retry-delay]: the delay in seconds before the error should be retried (only valid when status is OMQ::StatRetry)
  • [business]: if True, this error represents a business error (rather than a technical error); usually implying that there is a problem with the consistency of the order data
optan optional parameter that can be supplied by the workflow when an error is raised, normally a string providing additional information about the error

This method allows the workflow to do external logging or to take custom actions when errors are raised.

The default implementation in the base class is empty.

◆ oneTimeInit()

final OMQ::UserApi::Workflow::QorusWorkflow::oneTimeInit ( )

This method is executed once when the workflow execution instance starts or is reset; it in turn calls oneTimeInitImpl() which can be overridden in subclasses.

Note
Persistent objects with a high acquisition cost should be acquired in the oneTimeInit() method. Use the WorkflowApi::updateInstanceData() method (in Qore) or the WorkflowApi.updateInstanceData() method (in Java) to save resources acquired, and WorkflowApi::getInstanceData() (in Qore) or the WorkflowApi.getInstanceData() method (in Java) to retrieve the resources during the workflow's execution.

◆ oneTimeInitImpl()

OMQ::UserApi::Workflow::QorusWorkflow::oneTimeInitImpl ( )
private

This method is executed once when the workflow execution instance starts or is reset; this method may be overridden in subclasses.

Note
Persistent objects with a high acquisition cost should be acquired in the oneTimeInit() method. Use the WorkflowApi::updateInstanceData() method (in Qore) or the WorkflowApi.updateInstanceData() method (in Java) to save resources acquired, and WorkflowApi::getInstanceData() (in Qore) or the WorkflowApi.getInstanceData() method (in Java) to retrieve the resources during the workflow's execution.

The documentation for this class was generated from the following file: