Simple module to assist on workflow development.
Created to be imported in Overview > Global Scripts and used on both forms and engine.
v1.0.5 breaking change - Compare() and Unique() renamed to compare() and unique() as per #20 .
Kind: global namespace
Version: 1.0.5
License: MIT License
- PRD :
object
- .util :
object
- .JSONobj :
object
- .parse(s, [reviver]) ⇒
object
|object
- .stringify(o, [replacer], [space]) ⇒
string
|string
- .test(inputJSON, whattotest) ⇒
boolean
- .get(inputJSON, whattoget, [returntype]) ⇒
string
|number
|boolean
|object
- .parse(s, [reviver]) ⇒
- .formOrEngine() ⇒
string
- .logerror(msg) ⇒
boolean
- .inspectType(input) ⇒
string
- .isString(input) ⇒
boolean
- .isNumber(input) ⇒
boolean
- .isBoolean(input) ⇒
boolean
- .isJavaVector(input) ⇒
boolean
- .coerceToString(input, [defVal]) ⇒
string
- .basicHTTPauthHeader(username, password) ⇒
string
- .shouldRetry(curcounter, maxretries) ⇒
boolean
- .compare(list1, list2, ignorecase) ⇒
Array.<Array.<string>>
- .unique(obj, ignorecase) ⇒
Array.<string>
|java.util.Vector
- .getObject2arr(list) ⇒
array.<(object|string)>
|null
- .JavaVectorToECMAArray(v) ⇒
Array.<string>
- .ECMAArrayToJavaVector(arr) ⇒
java.util.Vector
- .GCVget(GCVname, [returnType], [DefaultValue]) ⇒
string
|number
|boolean
- .getNamedPassword(NamedPassword, [try5times]) ⇒
string
|null
- .JSONobj :
- .web :
object
- .version() ⇒
string
- .setlogprefix(str)
- .init(obj1, [obj2], [obj3])
- .IDVget(ldapdn, entkey, attrkey, [fieldname]) ⇒
Array.<string>
- .IDVglobalQuery(dalquerykey, parameters, [fieldname]) ⇒
Array.<string>
- .util :
Utility functions for use in Identity Manager work flow development.
Kind: static namespace of PRD
Since: 1.0.0
- .util :
object
- .JSONobj :
object
- .parse(s, [reviver]) ⇒
object
|object
- .stringify(o, [replacer], [space]) ⇒
string
|string
- .test(inputJSON, whattotest) ⇒
boolean
- .get(inputJSON, whattoget, [returntype]) ⇒
string
|number
|boolean
|object
- .parse(s, [reviver]) ⇒
- .formOrEngine() ⇒
string
- .logerror(msg) ⇒
boolean
- .inspectType(input) ⇒
string
- .isString(input) ⇒
boolean
- .isNumber(input) ⇒
boolean
- .isBoolean(input) ⇒
boolean
- .isJavaVector(input) ⇒
boolean
- .coerceToString(input, [defVal]) ⇒
string
- .basicHTTPauthHeader(username, password) ⇒
string
- .shouldRetry(curcounter, maxretries) ⇒
boolean
- .compare(list1, list2, ignorecase) ⇒
Array.<Array.<string>>
- .unique(obj, ignorecase) ⇒
Array.<string>
|java.util.Vector
- .getObject2arr(list) ⇒
array.<(object|string)>
|null
- .JavaVectorToECMAArray(v) ⇒
Array.<string>
- .ECMAArrayToJavaVector(arr) ⇒
java.util.Vector
- .GCVget(GCVname, [returnType], [DefaultValue]) ⇒
string
|number
|boolean
- .getNamedPassword(NamedPassword, [try5times]) ⇒
string
|null
- .JSONobj :
Proxy for the actual JSON object used in browsers (JSON) or workflow engine (ScriptVault.JSON).
Wraps the parse() and stringify() calls in try/catch blocks to report errors via logerror() instead of
letting the workflow engine break its regular flow when an error occurs.
Kind: static namespace of util
Since: 1.0.2
- .JSONobj :
object
- .parse(s, [reviver]) ⇒
object
|object
- .stringify(o, [replacer], [space]) ⇒
string
|string
- .test(inputJSON, whattotest) ⇒
boolean
- .get(inputJSON, whattoget, [returntype]) ⇒
string
|number
|boolean
|object
- .parse(s, [reviver]) ⇒
Wrapper for the parse() call on the host environment's JSON object.
See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse
Kind: static method of JSONobj
Since: 1.0.2
Param | Type | Description |
---|---|---|
s | string |
String with valid JSON syntax |
[reviver] | function |
(Optional) If a function, this prescribes how the value originally produced by parsing is transformed, before being returned. |
Wrapper for the stringify() call on the host environment's JSON object.
See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify
Kind: static method of JSONobj
Since: 1.0.2
Param | Type | Description |
---|---|---|
o | object |
ECMA object to convert to JSON |
[replacer] | function | Array.<string> | Array.<number> |
(Optional) A function that alters the behavior of the stringification process, or an array of String and Number objects that serve as a whitelist for selecting/filtering the properties of the value object to be included in the JSON string. If this value is null or not provided, all properties of the object are included in the resulting JSON string |
[space] | string | number |
(Optional) A String or Number object that's used to insert white space into the output JSON string for readability purposes. If this is a Number, it indicates the number of space characters to use as white space; this number is capped at 10 (if it is greater, the value is just 10). Values less than 1 indicate that no space should be used. If this is a String, the string (or the first 10 characters of the string, if it's longer than that) is used as white space. If this parameter is not provided (or is null), no white space is used. |
Verify if an ECMA object has the selected location.
Note: To reference properties with a dot in their name use the format ["property.name"] .
Ported from IDM engine to RBPM. IDM Engine version at https://github.com/fchierad/IDM-ECMAlib/blob/v1.0.2/JSONlib-JS.js
Kind: static method of JSONobj
Returns: boolean
- true if the path is found, false otherwise
Since: 1.0.3
Param | Type | Description |
---|---|---|
inputJSON | object | string |
Input JSON (ECMA object). If a string-serialized JSON is provided it will be converted to a JSON object internally |
whattotest | string |
Dot-separated list of properties as if you are accessing them via ECMAscript |
Retrieves a property of an ECMA object (or its subordinate object) and returns it in the specified type.
Note: To reference properties with a dot in their name use the format ["property.name"] .
Ported from IDM engine to RBPM. IDM Engine version at https://github.com/fchierad/IDM-ECMAlib/blob/v1.0.2/JSONlib-JS.js
Kind: static method of JSONobj
Returns: string
| number
| boolean
| object
- Selected property's value in the selected format. If parsing of the object fails returns an empty string
Since: 1.0.3
Param | Type | Description |
---|---|---|
inputJSON | object | string |
Input JSON (ECMA object). If a string-serialized JSON is provided it will be converted to a JSON object internally |
whattoget | string |
Dot-separated list of properties as if you are accessing them via ECMAscript |
[returntype] | string |
(Optional) Desired return type. Valid values are: string, number, raw. Defaults to raw in case whatever is provided is not one of the 3 valid options |
Try to detect if we are in a web browser or in the User App/RBPM/IDMAPPs workflow engine.
Kind: static method of util
Returns: string
- 'form' if in a Browser, 'engine' if on the workflow engine. 'detection failed' otherwise.
Since: 1.0.0
Output error message based on where the code is running.
Output to the console.log() if in a browser, to catalina.out if in the workflow engine.
Prepends the value of the module's internal 'prefix' variable.
Kind: static method of util
Returns: boolean
- true if the message was returned successfully, false otherwise.
Since: 1.0.0
Param | Type | Description |
---|---|---|
msg | string |
Error message to be logged. |
Returns the type of an ECMA object or class of a Java object.
For ECMA relies on typeof and instanceof, if neither works uses Object.prototype.toString .
For Java objects just calls getClass().
Prints result when module is ran in debug mode, returns result as string.
Kind: static method of util
Returns: string
- analysis result
Since: 1.0.5
Param | Type | Description |
---|---|---|
input | any |
ECMA or Java input |
Checks if the provided input is an ECMA String (primitive or object).
Kind: static method of util
Returns: boolean
- true if string, false otherwise
Since: 1.0.5
Param | Type | Description |
---|---|---|
input | any |
Input value whose type will be evaluated |
Checks if the provided input is an ECMA Number (primitive or object).
Kind: static method of util
Returns: boolean
- true if number, false otherwise
Since: 1.0.5
Param | Type | Description |
---|---|---|
input | any |
Input value whose type will be evaluated |
Checks if the provided input is an ECMA Boolean (primitive or object).
Kind: static method of util
Returns: boolean
- true if boolean, false otherwise
Since: 1.0.5
Param | Type | Description |
---|---|---|
input | any |
Input value whose type will be evaluated |
(Engine only) Checks if the provided input is a Java Vector.
Kind: static method of util
Returns: boolean
- true if Java Vector, false otherwise
Since: 1.0.5
Param | Type | Description |
---|---|---|
input | any |
Input value whose type will be evaluated |
Coerces the result to an ECMA string.
Coercion rules for this function:
If the first input parameter is null or undefined returns default value.
If the first input parameter is an Array it returns the array joined by ' '.
If the first input parameter is a String, Number or Boolean it returns a string.
If the first input parameter is an object other than an Array it returns the default value.
If the second input value is not null then the default value becomes the second input value.
If the coercion to string from String, Number, Boolean or Array resulted in empty string, return default value.
Kind: static method of util
Returns: string
- resulting string.
Since: 1.0.0
Param | Type | Description |
---|---|---|
input | any |
Input parameter to be coerced. |
[defVal] | string |
Default value to be used |
(Engine only) Returns basic HTTP auth header. Format is: Basic B64encodedUSERNAME:PASSWORD
Kind: static method of util
Returns: string
- HTTP Basic 'Authorization' header's value.
Since: 1.0.3
Param | Type | Description |
---|---|---|
username | string |
HTTP auth user's name. |
password | string |
HTTP auth user's password. |
(Engine only) Function to coerce provided flowdata and return if we are past max retries or not.
Kind: static method of util
Returns: boolean
- true if maxretries is greater than current counter, false otherwise.
Since: 1.0.3
Param | Type | Description |
---|---|---|
curcounter | string |
Current Counter |
maxretries | string |
Maximum retries value |
(Engine) Compares 2 unidimensional ECMA Arrays or Java Vectors and returns an Array of arrays with comparison results.
(Form) Compares 2 unidimensional ECMA Arrays and returns an Array of arrays with comparison results.
Kind: static method of util
Returns: Array.<Array.<string>>
- ECMA Array with 3 parts. [ [ elements only present on list1 ], [ elements only present on list2 ], [ elements present on both] ]
Since: 1.0.2
Param | Type | Description |
---|---|---|
list1 | Array.<string> | java.util.Vector |
ECMA Array or Java Vector. |
list2 | Array.<string> | java.util.Vector |
ECMA Array or Java Vector. |
ignorecase | boolean |
Changes string comparison to case insensitive. This also causes the casing of the results will match the casing of their first time appearing in the list provided. |
(Engine) Parses an unidimensional ECMA Array or Java Vector and returns the same type of object with only unique entries.
(Form) Parses an unidimensional ECMA Array and returns the same type of object with only unique entries.
Kind: static method of util
Returns: Array.<string>
| java.util.Vector
- ECMA Array or Java Vector. If obj is not a valid type returns empty ECMA Array.
Since: 1.0.2
Param | Type | Description |
---|---|---|
obj | Array.<string> | java.util.Vector |
ECMA Array or Java Vector. |
ignorecase | boolean |
Changes string comparison to case insensitive. This also causes the casing of the results will match the casing of their first time appearing in the list provided. |
(Engine only) Parses the result from flowdata.getObject into an Array of strings and ECMA objects.
Each DOM element node will be an object's property name, and each property will contain
an array of items. Those items cam be strings or other objects.
Kind: static method of util
Returns: array.<(object|string)>
| null
- ECMA Array of objects and string. If error occur returns null.
Since: 1.0.2
Param | Type | Description |
---|---|---|
list | java.util.ArrayList |
Java object resulting from flowdata.getObject() |
(Engine only) Converts a unidimensional Java Vector whose entries are strings to an ECMA Array.
https://docs.oracle.com/javase/8/docs/api/java/util/Vector.html
Kind: static method of util
Returns: Array.<string>
- ECMA array.
Since: 1.0.0
Param | Type | Description |
---|---|---|
v | java.util.Vector |
Java Vector. |
(Engine only) Converts a unidimensional ECMA array whose entries are strings to a Java Vector.
https://docs.oracle.com/javase/8/docs/api/java/util/Vector.html
Kind: static method of util
Returns: java.util.Vector
- Java Vector.
Since: 1.0.0
Param | Type | Description |
---|---|---|
arr | Array.<string> |
ECMA array. |
(Engine only) Wraper for GCV.get . Attempts to retrieve the GCV value. returns the default value (or '' if no default provided)
Kind: static method of util
Returns: string
| number
| boolean
- GCV.get result or default value.
Since: 1.0.2
Param | Type | Description |
---|---|---|
GCVname | string |
Name of the GCV to be retrieved. |
[returnType] | string |
'string', 'number' or 'boolean'. Forces coercion to said type for the return. Defaults to 'string' if not provided or any other value. |
[DefaultValue] | string |
Default value to be used if the GCV.get() fails. Defaults to '' if not provided. |
(Engine only) Wraper for GCV.getValueForNamedPassword. Attempts to retrieve the
named password value using a GCV-ref as the bridge for the same.
If the second parameter is true and the named password read fails the function attemps
up to 5 retries with 1 second pause in between them.
Kind: static method of util
Returns: string
| null
- GCV.getValueForNamedPassword result or null.
Since: 1.0.2
Param | Type | Description |
---|---|---|
NamedPassword | string |
Name of the GCV-ref to the Named Password to be retrieved. |
[try5times] | any |
If not provided or null a single read is attempted. If provides and read fails try 4 more times, with 1 second pause between them. |
Functions and objects that can only be accessed in work flow forms.
Kind: static namespace of PRD
Since: 1.0.4
Sets library in debug mode. The other way to do so is to pass true as the second parameter on the library import.
Kind: static method of web
Since: 1.0.5
Param | Type | Description |
---|---|---|
bool | boolean |
true to set the library to debug mode, false to disable debug more. |
(Form only) When added in the event section of a form field, allow us to show and hide that field by using
field.fireEvent( event-name, action );
Where event-name is the event's name and action is either 'show' or 'hide'
Since the field visibility functions only exist inside the field context we need to pass both objects from where
the function is being called to use them inside that scope/context. Inside the event we just need to add the line:
IAtools.fieldVisibility( event, field );
to properly use this function. No need to change anything on the line above, it is already passing the event and field objects
as seen in the scope of that particular form field.
no return value provided.
Kind: static method of web
Since: 1.0.4
Param | Type | Description |
---|---|---|
event | object |
event object as seen by the field's scope |
field | object |
field object as seen by the field's scope |
Return module version.
Kind: static method of PRD
Returns: string
- Module's version in the format M.m.p (Major, minor, patch)
Since: 1.0.1
Set prefix for the log activities generated by logerror() on both engine and form.
Given that forms instantiate the module on load, setting the value inside a form would affect only said form.
Given that the workflow engine can pause processing at points and remove the thread from memory, reading the same
again later, calling this function anywhere outside the Overview > Global Scripts might cause the value set to be lost
after such pauses. One example of such pauses/behavior is when a workflow reaches an approval activity.
Kind: static method of PRD
Since: 1.0.2
Param | Type | Description |
---|---|---|
str | string |
String that will be appended to any logerror() call. |
(Form only) Initializes references to the RBPM/IDMAPPS framework objects and save the same in the internal storage.
Uses IDVault internally on IDVget(), IDVglobalQuery(), GCVget(), getNamedPassword().
Exports field as PRD.web.field and form as PRD.web.form for usage inside global scripts.
Refactored to accept 1 to 3 parameters with the framework objects in any order.
Returns nothing.
Kind: static method of PRD
Since: 1.0.0
Param | Type | Description |
---|---|---|
obj1 | object |
One of the three IDMAPPS framework object |
[obj2] | object |
One of the three IDMAPPS framework object |
[obj3] | object |
One of the three IDMAPPS framework object |
Performs an IDVault.get and returns an ECMA array with the result.
Refactored on v1.0.4 to replace the 4th optional parameter from IDVault injection to a form's field name.
This change could break forms using prior versions, please double check your form code before moving to v1.0.4.
Kind: static method of PRD
Returns: Array.<string>
- ECMA array with the results. Empty if IDVault.get returned null, array with one or more elements otherwise.
Since: 1.0.0
Param | Type | Description |
---|---|---|
ldapdn | string |
LDAP Fully Distinguised name of the eDirectory object to be queried. |
entkey | string |
DAL entity key. |
attrkey | string |
DAL attribute key. Attrribute must be configured under the DAL entity. |
[fieldname] | string |
(form mode only) Name of the field to be auto-populated by the function. If the field name does not exist the form itself will present the error: "An error 'Field avocado not found or not instantiated yet.' was encountered while executing the script 'in IDVault.get()'". |
Performs an IDVault.globalQuery and returns an object with the result.
Refactored on v1.0.4 to replace the 4th optional parameter from IDVault injection to a form's field name.
This change could break forms using prior versions, please double check your form code before moving to v1.0.4.
Kind: static method of PRD
Returns: Array.<string>
- Array with LDAP DNs returned.
Since: 1.0.1
Param | Type | Description |
---|---|---|
dalquerykey | string |
DAL Query key. |
parameters | object |
ECMA object with the paramters defined in the DAL Query. {parametername:parametervalue} |
[fieldname] | object |
(form mode only) Name of the field to be auto-populated by the function. |