Qorus Integration Engine®  4.1.4.p4_git
OMQ::MapperApi::MapperApi Class Reference

Mapper API class. More...

Static Public Member Methods

static *hash< auto > getUserContextInfo ()
 returns a hash for the current user context More...
 
static auto getGlobalConfigItemValue (string item, *hash< auto > local_context, bool expand_complex_values=True)
 returns the value of the given configuration item on global level; throws an exception if there is no value on global level for the configuration item More...
 
static auto getGlobalConfigItemValueWithDefault (string item, auto default_value, *hash< auto > local_context, bool expand_complex_values=True)
 returns the value of the given configuration item on global level; throws an exception if there is no value on global level for the configuration item More...
 
static hash< auto > getSystemInfo ()
 returns a hash of system info More...
 
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. More...
 
static auto expandTemplatedValue (auto value, *hash< auto > local_context, bool expand_complex_values=True)
 expands all variables in a templated string More...
 
static hash< auto > propGet ()
 returns a hash of all system properties in all domains More...
 
static *hash< auto > propGet (string domain)
 returns a hash of all key-value pairs in the given domain or NOTHING if the system property domain does not exist More...
 
static auto propGet (string domain, string key)
 returns the value of the given system property key in the given domain or NOTHING if the system property does not exist More...
 

Detailed Description

Mapper API class.

Since
Qorus 4.1

Member Function Documentation

◆ expandTemplatedValue()

static auto OMQ::MapperApi::MapperApi::expandTemplatedValue ( auto  value,
*hash< auto >  local_context,
bool  expand_complex_values = True 
)
static

expands all variables in a templated string

Parameters
valuetemplated string to be expanded; see Config Item / Building Block Template Substitution Strings for more information on this parameter
local_contextlocal context supplied by the caller (plus user context info is added - see MapperApi::getUserContextInfo() method)
expand_complex_valuesif True then lists and hashes will have their string values expanded recursively
Returns
the value of the string as substituted with all variables expanded recursively until there are no more expansions to perform (or the derived value is not a string)
Exceptions
LIST-VALUE-ERRORcannot parse list value expression
REST-EXPRESSION-ERRORcannot parse REST expression and argument
NOT-WF-CONTEXT-ERRORif WF specific context (e.g. static) variable is specified to be expanded
UNSUPPORTED-CONTEXT-ERRORif an unknown context variable is specified to be expanded
FORMAT-ERRORif the templated string doesn't have correct format (e.g. unescaped dollar sign that does not represent a variable)
SENSITIVE-DATA-FORMAT-ERRORif the "$sensitive:<skey>.<svalue>.field-ref..." value or "$sensitive-alias:<alias>.field-ref..." template string does not have the required format
Since
  • Qorus 4.1.1 added the expand_complex_values argument
See also
Config Item / Building Block Template Substitution Strings

◆ getGlobalConfigItemValue()

static auto OMQ::MapperApi::MapperApi::getGlobalConfigItemValue ( string  item,
*hash< auto >  local_context,
bool  expand_complex_values = True 
)
static

returns the value of the given configuration item on global level; throws an exception if there is no value on global level for the configuration item

Parameters
itemthe name of the configuration item to retrieve the value
local_contextthe caller can supply its "local" context for template variables (plus user context info is added - see MapperApi::getUserContextInfo() method)
expand_complex_valuesif True then lists and hashes will have their string values expanded recursively
Returns
the value of the given configuration item on global level
Exceptions
CONFIG-ITEM-ERRORthrown if the configuration item is not valid
Note
the value is always substituted with UserApi::expandTemplatedValue(); make sure and escape any "$" characters with a backslash ("\") to avoid template substitution
Since
  • Qorus 4.1.1 added the expand_complex_values argument
See also
getGlobalConfigItemValueWithDefault()

◆ getGlobalConfigItemValueWithDefault()

static auto OMQ::MapperApi::MapperApi::getGlobalConfigItemValueWithDefault ( string  item,
auto  default_value,
*hash< auto >  local_context,
bool  expand_complex_values = True 
)
static

returns the value of the given configuration item on global level; throws an exception if there is no value on global level for the configuration item

Parameters
itemthe name of the configuration item to retrieve the value
default_valuethe value to be returned if the value is not set
local_contextthe caller can supply its "local" context for template variables (plus user context info is added - see MapperApi::getUserContextInfo() method)
expand_complex_valuesif True then lists and hashes will have their string values expanded recursively
Returns
the value of the given global configuration item or default_value, if no value is set at the global level for the given configuration item
Note
Since
  • Qorus 4.1.1 added the expand_complex_values argument
See also
getGlobalConfigItemValue()

◆ getSystemInfo()

static hash<auto> OMQ::MapperApi::MapperApi::getSystemInfo ( )
static

returns a hash of system info

Returns
a hash of system info with the following keys:
  • instance-key: value of the system option by the same name
  • session-id: the session ID for the current Qorus application session
  • omq-version: the version string for the Qorus server
  • omq-version-code: a numeric code of the Qorus server version, where
    major = (x / 10000),
    minor = (x / 100) % 100, = x % 100
    this value is suitable for comparisons (ex: for Qorus 2.6.0, omq-version-code = 20600)
  • qore-version: the version string for the qore build used
  • datamodel-version: the datamodel version required by this version of Qorus
  • omq-schema: the datasource string for the system schema (without the password)
  • omquser-schema: the datasource string for the user schema (without the password)
  • starttime: the date and time when the instance was started
  • hostname: the hostname of the machine where the Qorus server is running
  • pid: the PID of the Qorus server process
  • threads: number of threads currently active
  • schema-properties: a hash of schema properties with the following keys:
  • omq-schema-version
  • omq-schema-compatibility
  • omq-load-schema-compatibility
  • logfile: the path for the system log file

◆ getUserContextInfo()

static *hash<auto> OMQ::MapperApi::MapperApi::getUserContextInfo ( )
static

returns a hash for the current user context

Example:
*hash<auto> h = MapperApi::getUserContextInfo();
Returns
a hash describing the current user context or NOTHING if called outside a workflow, service, or job; hash keys are as follows:
  • when called in a service:
    • "type": "service"
    • "servicetype": the type of service ("user" or "system")
    • "name": the name of the service
    • "version": the version of the service
    • "id": the service id
    • "context_user": the current username context, if any
  • when called in a job:
    • "type": "job"
    • "name": the name of the job
    • "version": the version of the job
    • "id": the job id
    • "job_instanceid": the job_instanceid of the current job instance
    • "context_user": the current username context, if any
  • when called in a workflow:
    • "type": "workflow"
    • "name": the name of the workflow
    • "version": the version of the workflow
    • "id": the workflow id
    • "workflow_instanceid": the workflow_instanceid of the current workflow instance (if available)
    • "stepname": the name of the current step (if available)
    • "stepversion": the version of the current step (if available)
    • "stepid": the id of the current step (if available)
    • "ind": the name of the current step index (if available)
    • "execid": the execution ID of the current workflow execution instance (if available)
    • "context_user": the current username context, if any

◆ getValueMap()

static auto OMQ::MapperApi::MapperApi::getValueMap ( string  mapname,
string  key 
)
static

Gets a lookup value from the value map by a key; the value map must be registered to the current interface.

Parameters
mapnamename of the value map
keya key name
Returns
the value assigned to the key
Exceptions
VALUE-MAP-ERRORthe given value map is unknown or not registered to the current interface

◆ propGet() [1/3]

static hash<auto> OMQ::MapperApi::MapperApi::propGet ( )
static

returns a hash of all system properties in all domains

Example:
hash<auto> h = MapperApi::propGet();
Returns
a hash of all system properties in all domains; the top-level keys are domain keys which have as values hashes with all key-value pairs set in the domain

◆ propGet() [2/3]

static *hash<auto> OMQ::MapperApi::MapperApi::propGet ( string  domain)
static

returns a hash of all key-value pairs in the given domain or NOTHING if the system property domain does not exist

Example:
*hash<auto> h = MapperApi::propGet(domain);
Returns
a hash of all key-value pairs in the given domain or NOTHING if the system property domain does not exist

◆ propGet() [3/3]

static auto OMQ::MapperApi::MapperApi::propGet ( string  domain,
string  key 
)
static

returns the value of the given system property key in the given domain or NOTHING if the system property does not exist

Example:
auto val = MapperApi::propGet(domain, key);
Returns
the value of the given system property key in the given domain

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