LSPS documentation logo
LSPS Documentation
Functions

Proxy

createProxySet(parentProxySet : RecordProxySet) : RecordProxySet

Creates new record proxy set with parent proxy set.

Parameters:

  • parentProxySet
getProxiedRecord(proxy* : T) : T

Returns proxied record of the proxy.

Parameters:

  • proxy
getProxyLevel(record : Record) : Integer
getProxySet(record : Record) : RecordProxySet
isProxy(record* : Record) : Boolean

Returns true if the record is proxy, false otherwise.

Parameters:

  • record

Throws:

  • NullParameterError if a mandatory parameter is null
mergeAllProxies(checkConflicts* : Boolean, records* : Collection<T>) : List<T>SIDE EFFECT

Merges changes from the proxies to the proxied records. It returns proxied records with applied changes.

Parameters:

  • checkConflicts If the value is true optimistic lock conflicts are checked. In other case the merge overwrites previous changes.
  • records

Throws:

  • NullParameterError if a mandatory parameter is null
mergeProxies(checkConflicts* : Boolean, records : T...) : List<T>SIDE EFFECT

Merges changes from the proxies to the proxied records. It returns proxied records with applied changes.

Parameters:

  • checkConflicts If the value is true optimistic lock conflicts are checked. In other case the merge overwrites previous changes.
  • records
proxies(collection* : Collection<T>, properties : Property...) : Collection<T>

Creates change proxies on records from the collection and change proxies for values referenced by named properties. The proxy objects keeps changes that should be executed on the record. The proxy objects are added to the proxy set if specified.

Parameters:

  • collection
  • properties

Throws:

  • NullParameterError if a mandatory parameter is null
proxy(recordType* : Type<T>) : T

Creates a proxy without proxied record. It can be used only for shared records. When merged a shared record is created.

Parameters:

  • recordType

Throws:

  • NullParameterError if a mandatory parameter is null
proxy(record* : T, properties : Property...) : T

Creates proxy on the record and proxies for values referenced by named properties.

Parameters:

  • record
  • properties

Throws:

  • NullParameterError if a mandatory parameter is null
proxyOfProperties(record* : Record, properties : Property...) : voidSIDE EFFECT

Creates change proxy for all object referenced by the property and sets the proxy values to the property. If there are no listed properties the action is executed for all properties of the record type.

Parameters:

  • record
  • properties

Throws:

  • NullParameterError if a mandatory parameter is null
removeFromProxySet(record* : Record) : void

Collection

+(collection* : Collection<E>, elements* : Collection<E>) : Collection<E>

Returns a collection created by appending the specified elements to the end of the collection. The original order of the added elements is preserved. If the input collection is a set, the returned type is Set. If the input collection is a list, the returned type is List.

[1,2] + {2,3} //returns [1,2,2,3]; {2,3} + [1,2] //returns {2,3,1}

Parameters:

  • collection input collection
  • elements element to appended to the input collection

Throws:

  • NullParameterError if a mandatory parameter is not specified
+(left* : Map<K, V>, right* : Map<K, V>) : Map<K, V>

Returns a map created as the union of the keys and their values of the two input maps. If a key is present in both maps, its value is set to the value of the key specified by the right map.

[1 -> "a"] + [1 -> "b", 2 -> "c"] //returns [1->"b",2->"c"]

Parameters:

  • left left map
  • right right map

Throws:

  • NullParameterError if a mandatory parameter is not specified
+(list* : List<E>, collection* : Collection<E>) : List<E>

Returns a list created by appending the specified elements to the end of the list. The original order of the added elements is preserved in the returned list.

Parameters:

  • list input list
  • collection elements to be appended to the input list

Throws:

  • NullParameterError if a mandatory parameter is not specified
+(set* : Set<E>, collection* : Collection<E>) : Set<E>

Returns a set created by appending the specified elements to the end of the input set. The original order of the added elements is preserved.

{"s", "e", "a", "t"} + ["e", "d"] // returns{"s","e","a","t","d"}

Parameters:

  • set input set
  • collection elements to be appended to the input set

Throws:

  • NullParameterError if a mandatory parameter is not specified
-(collection* : Collection<E>, elements* : Collection<E>) : Collection<E>

Removes all occurrences of the elements from the collection and returns the resulting collection. If the input collection is a set, the returned type is Set. If the input collection is a list, the returned type is List.

[1,1,2,3] - [1];
// returns: [2,3]
{ "hello", 1,2,3} - ["hello"]
// returns = {1,2,3}

Parameters:

  • collection input collection
  • elements elements to remove

Throws:

  • NullParameterError if a mandatory parameter is not specified
-(list* : List<E>, elements* : Collection<E>) : List<E>

Removes all occurrences of the elements from the input list and returns the resulting list.

[ "hello", "hello", 1,2,3] - ["hello"]
// returns = [1,2,3]

Parameters:

  • list input list
  • elements elements to remove

Throws:

  • NullParameterError if a mandatory parameter is not specified
-(set* : Set<E>, elements* : Collection<E>) : Set<E>

Removes the elements from the input set and returns the resulting set.

{1,2,3} - [1];
// returns: [2,3]

Parameters:

  • set input set
  • elements elements to remove

Throws:

  • NullParameterError if a mandatory parameter is not specified
add(collection* : Collection<E>, elements : E...) : Collection<E>

Returns a collection with the input-collection items and the specified elements added to the end of the collection. If the input collection is a set, the returned collection is Set. If the input collection is a list, the returned collectionc is List.

Parameters:

  • collection input collection
  • elements elements to append to the returned collection

Throws:

  • NullParameterError if a mandatory parameter is not specified
add(list* : List<E>, elements : E...) : List<E>

Returns a list with the input-list items and the specified elements added to the end of the list.

[1,2,3].add(4, 4, 5)//returns [1,2,3,4,4,5]

Parameters:

  • list input list
  • elements elements to append to the returned list

Throws:

  • NullParameterError if a mandatory parameter is not specified
add(set* : Set<E>, elements : E...) : Set<E>

Returns a set with the input-set items and the specified elements added to the end of the set.

{1,2,3}.add(4, 4, 5)//returns {1,2,3,4,5}

Parameters:

  • set input set
  • elements elements to append to the returned set

Throws:

  • NullParameterError if a mandatory parameter is not specified
add(map* : Map<K, V>, key : K, value : V) : Map<K, V>

Returns a map with the input-map items and the element with the specified key-value pair added to the end of the map. If the key already exists in the map, the specified value overwrites the value of the existing key.

Parameters:

  • map input map
  • key key to add
  • value key value to add

Throws:

  • NullParameterError if a mandatory parameter is not specified
addAll(collections* : Collection<E>...) : Collection<E>

Returns a collection created as the concatenation of the specified collections. If the first input collection is a set, the returned type is Set. If the first input collection is a list, the returned type is List.

addAll([1,2,3], {"a", "b"}, {true, false, null})
 //returns [1,2,3,"a","b",true,false,null]

Parameters:

  • collections input collections

Throws:

  • NullParameterError if a mandatory parameter is not specified
addAll(maps* : Map<K, V>...) : Map<K, V>

Returns a map created as the union of keys and their respective values of all input maps. If more than one map contains the same key, its value is set to the value of the key specified by the most recent map.

addAll([1 -> "a"], [1 -> "b", 2 -> "a"], [1 -> "c"] ) //returns [1->"c",2->"a"]

Parameters:

  • maps input maps

Throws:

  • NullParameterError if a mandatory parameter is not specified
addAll(list* : List<E>, collections* : Collection<E>...) : List<E>

Returns a list created as concatenation of the input list and collections.

addAll([1,2],{3,4}, [4,5]) // returns [1,2,3,4,4,5]

Parameters:

  • list input list
  • collections collections to add to the list

Throws:

  • NullParameterError if a mandatory parameter is not specified
addAll(set* : Set<E>, collections* : Collection<E>...) : Set<E>

Returns a set created by concatenating the set and collections.

addAll({1,2},[3,4], [4,5]) //returns {1,2,3,4,5}

Parameters:

  • set input set
  • collections collections to add to the set

Throws:

  • NullParameterError if a mandatory parameter is not specified
addAll(collection* : Collection<E>, index* : Integer, elements* : Collection<E>...) : Collection<E>

Returns a collection with the input-collection items and the specified elements inserted at the position defined by the index parameter. The element originally located at the index position and any subsequent elements to the right are shifted to the indices incremented by the number of the elements added to the collection. The returned collection preserves the original order of the added elements. If the input collection is a set, the returned collection is Set. If the input collection is a list, the returned collection is List.

addAll({1,2}, 1, {42, 73}, {13})//returns {1,42,73,13,2}

Parameters:

  • collection input collection
  • index index position of the adding
  • elements elements to add

Throws:

  • NullParameterError if a mandatory parameter is not specified
  • OutOfBoundsError if the specified index is out of range (index < 0 or index > size(collection))
addAll(list* : List<E>, index* : Integer, elements* : Collection<E>...) : List<E>

Returns a list with the input-list items and the specified elements inserted at the position defined by the index parameter. The element originally located at the index position and any subsequent elements to the right are shifted to the indices incremented by the number of the elements added to the list. The returned list preserves the original order of the added elements.

addAll([1,2], 1, [42, 73], [13]) //returns [1,42,73,13,2]

Parameters:

  • list input list
  • index index position of the adding
  • elements elements to add

Throws:

  • NullParameterError if a mandatory parameter is not specified
  • OutOfBoundsError if the specified index is out of range (index < 0 or index > size(list))
addAll(set* : Set<E>, index* : Integer, elements* : Collection<E>...) : Set<E>

Returns a set with the input-set items and the specified elements inserted at the position defined by the index parameter. The element originally located at the index position and any subsequent elements to the right are shifted to the indices incremented by the number of the elements added to the set. The returned set preserves the original order of the added elements.

addAll({1,2}, 1, {42, 73}, {13})//returns {1,42,73,13,2}

Parameters:

  • set input set
  • index index position of the adding
  • elements elements to add

Throws:

  • NullParameterError if a mandatory parameter is not specified
  • OutOfBoundsError if the specified index is out of range (index < 0 or index > size(set))
addAt(collection* : Collection<E>, index* : Integer, elements : E...) : Collection<E>

Returns a collection created by adding the input elements to the input collection at the position specified by the index. The element at the index position and the subsequent elements are shifted to the index positions incremented by the number of the elements added to the set. If the input collection is a set, the returned type is Set. If the input collection is a list, the returned type is List.

Parameters:

  • collection input collection
  • index target index position
  • elements elements to insert at the target index position

Throws:

  • NullParameterError if a mandatory parameter is not specified
  • OutOfBoundsError if the index is out of range (index < 0 or index > size(collection))
addAt(list* : List<E>, index* : Integer, elements : E...) : List<E>

Returns a list created by adding the input elements to the input list at the position specified by the index. The element at the index position and the subsequent elements are shifted to the index positions incremented by the number of the elements added to the list.

addAt([1,1,2,3], 1, "a", 4.2) //returns [1,"a",4.2,1,2,3]

Parameters:

  • list input list
  • index target index position
  • elements element to insert at the target index position

Throws:

  • NullParameterError if a mandatory parameter is not specified
  • OutOfBoundsError if the index is out of range (index < 0 or index > size(list))
addAt(set* : Set<E>, index* : Integer, elements : E...) : Set<E>

Returns a set created by adding the input elements to the input set at the position specified by the index. The element at the index position and the subsequent elements are shifted to the index positions incremented by the number of the elements added to the set.

addAt({1,1,2,3}, 1, "a", 4.2) //returns [1,"a",4.2,1,2,3]

Parameters:

  • set input set
  • index target index position
  • elements element to insert to the target index position

Throws:

  • NullParameterError if a mandatory parameter is not specified
  • OutOfBoundsError if the index is out of range (index < 0 or index > size(set))
collect(collection* : Collection<E>, function* : {E : T}) : Collection<T>

Runs the function on each collection element and returns a collection with the output values as its elements. If the input collection is a set, the returned type is Set. If the input collection is a list, the returned type is List.

collect({1,2}, {i:Integer -> i + 1}) //returns {2,3}

Parameters:

  • collection input collection
  • function function to run on each collection element

Throws:

  • NullParameterError if a mandatory parameter is not specified
collect(list* : List<E>, function* : {E : T}) : List<T>

Runs the function on each list element and returns a list with the output values as its elements.

collect([1,2], {i:Integer -> i + 1}) //returns [2,3]

Parameters:

  • list input list
  • function function to run on each list element

Throws:

  • NullParameterError if a mandatory parameter is not specified
collect(map* : Map<K, V>, function* : {K, V : E}) : List<E>

Runs the function on each map key-value pair and returns a list with the output values as its elements.

collect(["key" -> "value"], { key:String, value:String -> key + " " + value}) // returns ["key value"]

Parameters:

  • map input map
  • function function to run on each key-value pair of the map

Throws:

  • NullParameterError if a mandatory parameter is not specified
collect(set* : Set<E>, function* : {E : T}) : Set<T>

Runs the function on each set element and returns a set with the output values as its elements.

collect({1,2}, {i:Integer -> i + 1}) //returns {2,3}

Parameters:

  • set input set
  • function function to run on each set element

Throws:

  • NullParameterError if a mandatory parameter is not specified
collectWithIndex(collection* : Collection<E>, function* : {Integer, E : T}) : Collection<T>

Runs the function on each element of the input collection and returns a collection with the output values as its elements. The function takes 2 parameters: the index of the element and the element itself. If the input collection is a set, the returned type is Set. If the input collection is a list, the returned type is List.

collectWithIndex(
   collection -> {"a", "b"},
   function -> { index:Integer, item:String -> if index == 0 then item := "c" else item :="d" end }
 ) //returns {"c","d"}

Parameters:

  • collection input collection
  • function function to run on each collection element

Throws:

  • NullParameterError if a mandatory parameter is null
collectWithIndex(list* : List<E>, function* : {Integer, E : T}) : List<T>

Runs the function on each list element and returns a list with the output values as its elements. The function takes 2 parameters: the index of the element and the element itself.

collectWithIndex(
   ["a", "b"],
   { index:Integer, item:String -> if index == 0 then item := "c" else item :="d" end }
 ) //returns ["c","d"]

Parameters:

  • list input list
  • function function to run on each list element

Throws:

  • NullParameterError if a mandatory parameter is null
collectWithIndex(set* : Set<E>, function* : {Integer, E : T}) : Set<T>

Runs the function on each set element and returns a set with the output values as its elements. The function takes 2 parameters: the index of the element and the item element.

collectWithIndex(
   {"a", "b"},
   { index:Integer, item:String -> if index == 0 then item := "c" else item :="d" end }
 ) //returns {"c","d"}

Parameters:

  • set input set
  • function function to run on each set element

Throws:

  • NullParameterError if a mandatory parameter is null
compact(collection* : Collection<E>) : Collection<E>

Removes the elements with the null value from the input collection and returns a collection with the non-null elements. If the input collection is a set, the returned type is Set. If the input collection is a list, the returned type is List.

compact({"a", "b", null}) // returns {"a","b"}

Parameters:

  • collection input collection

Throws:

  • NullParameterError if a mandatory parameter is null
compact(list* : List<E>) : List<E>

Removes the elements with the null value from the input list and returns a list with the non-null elements.

compact(["a", "b", null]) // returns ["a","b"]

Parameters:

  • list input list

Throws:

  • NullParameterError if a mandatory parameter is null
compact(set* : Set<E>) : Set<E>

Removes the elements with the null value from the input set and returns a set with the non-null elements.

compact({"a", "b", null}) // returns {"a","b"}

Parameters:

  • set input set

Throws:

  • NullParameterError if a mandatory parameter is null
contains(collection* : Collection<Object>, elements : Object...) : Boolean

Returns true if the collection contains all specified elements.

contains(["a","b"], "a", "b") //returns true

Parameters:

  • collection input collection
  • elements elements

Throws:

  • NullParameterError if a mandatory parameter is not specified
containsAll(collection* : Collection<Object>, elements* : Collection<Object>) : Boolean

Returns true if the collection contains all elements from the specified collection.

containsAll({1,2,3}, [1, 1, 2]) //returns true

Parameters:

  • collection input collection
  • elements collection of elements to check

Throws:

  • NullParameterError if a mandatory parameter is not specified
containsAny(collection* : Collection<Object>, elements* : Collection<Object>) : Boolean

Returns true if the collection contains any of the specified elements.

containsAny([1,1,11], {1, 3}) // returns true

Parameters:

  • collection input collection
  • elements collection of elements checked

Throws:

  • NullParameterError if a mandatory parameter is not specified
containsKeys(map* : Map<Object, Object>, keys : Object...) : Boolean

Returns true if the map contains all specified keys.

containsKeys(["a"-> 1, "b" -> 2], "a", "c") //returns false

Parameters:

  • map input map
  • keys keys to check

Throws:

  • NullParameterError if a mandatory parameter is not specified
containsValues(map* : Map<Object, Object>, values : Object...) : Boolean

Returns true if the map contains all specified values.

containsKeys(["a"-> 1, "b" -> 2], 1, 2) //returns true

Parameters:

  • map input map
  • values values to check

Throws:

  • NullParameterError if a mandatory parameter is not specified
count(collection* : Collection<E>, condition* : {E : Boolean}) : Integer

Returns the number of elements in the given collection which satisfy the given condition.

count([1,2,3,4,55], {i:Integer -> i > 3}) //returns 2

Parameters:

  • collection input collection
  • condition condition the elements must meet

Throws:

  • NullParameterError if a mandatory parameter is not specified
exists(collection* : Collection<E>, condition* : {E : Boolean}) : Boolean

Returns true if the condition is true for at least one element in the collection.

exists([1,2,3,4,55], {i:Integer -> i > 54}) //returns trues

Parameters:

  • collection input collection
  • condition condition to check on collection elements

Throws:

  • NullParameterError if a mandatory parameter is not specified
findIndex(collection* : Collection<E>, condition* : {E : Boolean}) : Integer

Returns the index of the first collection element which satisfies the specified condition. If the condition is false for all elements of the collection, it returns -1.

findIndex(
 collection -> [1,22,3, 44],
 condition -> { i:Integer -> i > 21 }
) //returns 1

Parameters:

  • collection input collection
  • condition condition to check against each element

Throws:

  • NullParameterError if a mandatory parameter is null
findIndex(collection* : Collection<E>, fromIndex : Integer, condition* : {E : Boolean}) : Integer

Returns the index of the first collection element starting at fromIndex inclusive, which satisfies the specified condition. If the condition is false for all elements of the collection starting at fromIndex, it returns -1. If the fromIndex parameter is null or is less than 0, index 0 is used as the fromIndex.

findIndex(
 collection -> [1,22,3, 44],
 fromIndex -> 2,
 condition -> { i:Integer -> i > 21 }
) //returns 3

Parameters:

  • collection input collection
  • fromIndex start condition check from this index position
  • condition closure with the condition to check

Throws:

  • NullParameterError if a mandatory parameter is null
findIndex(collection* : Collection<E>, fromIndex : Integer, toIndex : Integer, condition* : {E : Boolean}) : Integer

Returns the index of the first collection element starting at fromIndex inclusive and ending with the toIndex exclusive which satisfies the specified condition. If the condition is false for all elements of the collection in the specified range, it returns -1. If the fromIndex parameter is null or is less than 0, index 0 is used as the fromIndex. If the toIndex parameter is null or greater or equal to the size of the collection, it is set to the last index of the collection.

findIndex(
 collection -> [1,22,3, 44],
 fromIndex -> 2,
 toIndex -> 3,
 condition -> { i:Integer -> i > 21 }
) //returns -1

Parameters:

  • collection input collection
  • fromIndex start condition check from this index position
  • toIndex finish condition check at this position
  • condition closure with the condition to check

Throws:

  • NullParameterError if a mandatory parameter is null
findLastIndex(collection* : Collection<E>, condition* : {E : Boolean}) : Integer

Returns the index of the last collection element which satisfies the specified condition. If the condition is false for all elements of the collection, it returns -1.

findLastIndex(
 collection -> [1,22,3, 44],
 condition -> { i:Integer -> i > 21 }
) // returns 3

Parameters:

  • collection input collection
  • condition condition to check

Throws:

  • NullParameterError if a mandatory parameter is null
findLastIndex(collection* : Collection<E>, toIndex : Integer, condition* : {E : Boolean}) : Integer

Returns the index of the last collection element which meets the condition. The check takes the elements starting from the toIndex position and continues toward index 0. If no element meets the condition, it returns -1. If toIndex is null, or greater or equal to the size of the collection, it is set to the last index of the collection.

findLastIndex( collection -> [1, 33, 4, 22,3, 44], toIndex -> 5, condition -> { i:Integer -> i > 21 }) ) //returns 3 (checked 3 and 22; //returned the position of 22)

Parameters:

  • collection input collection
  • toIndex finish condition check at this index
  • condition closure condition to check on collection elements

Throws:

  • NullParameterError if a mandatory parameter is null
findLastIndex(collection* : Collection<E>, fromIndex : Integer, toIndex : Integer, condition* : {E : Boolean}) : Integer

Returns the index of the last collection element that meets the condition. The function searches starting from the toIndex and ending at the element preceeding the fromIndex element. If no element that meets the condition is found in the specified element range, it returns -1. If the fromIndex parameter is null or less than 0, the search finishes at the beginning of the collection (index 0). If the toIndex parameter is null or greater or equal to the size of the collection, it is considered to be the end of the collection.

findLastIndex(
 collection -> [1, 33, 4, 22,3, 44],
 fromIndex -> 1,
 toIndex -> 4,
 condition -> { i:Integer -> i > 21 })
 //returns 3 (the index of 22)

Parameters:

  • collection input collection
  • fromIndex start condition check at this index
  • toIndex finish condition check at this index
  • condition closure condition to check on collection elements

Throws:

  • NullParameterError if a mandatory parameter is null
fold(collection* : Collection<E>, initialValue : T, function* : {T, E : T}) : T

Combines the elements of the collection using the binary function, an operation upon two operands of the same type. The binary function executes over the input collection from left to right. The first input T for the function is defined by initialValue and the first element in the collection. In each next iteration, the function returns the resulting computed value which is used as the input value for the next iteration with the next element of the collection. The last computed value is the result of the fold function.

fold([1,2,3], 4, { i:Integer, n:Integer -> i + n});
// returns 10: 4 + 1 = 5; 5 + 2 = 7; 7 + 3 = 10 
fold([ "b", "c", "d"] , "a;", { param1:String, param2:String -> param1 + " " + param2+ ";"})
//returns  "a; b; c; d;"

Parameters:

  • collection input collection
  • initialValue first T parameter value for the binary function
  • function binary function

Throws:

  • NullParameterError if a mandatory parameter is not specified
foldWithIndex(collection* : Collection<E>, initialValue : T, function* : {Integer, T, E : T}) : T

Combines the elements of the collection using the binary function, an operation upon two operands of the same type. The binary function executes over the input collection from left to right. The first input T for the function is defined by initialValue and the first element in the collection. In each next iteration, the function returns the resulting computed value which is used as the input value for the next iteration with the next element of the collection. Input of the function includes the index number of the E element. The last computed value is the result of the fold function.

foldWithIndex(["a","b","c","d"],"d",{i:Integer, t:String, e:String -> t + e + " index: " + i.toString() + "; "})
// returns "da index: 0; b index: 1; c index: 2; d index: 3; "

Parameters:

  • collection input collection
  • initialValue first T parameter value for the binary function
  • function binary function with the E index as it Integer input parameter

Throws:

  • NullParameterError if a mandatory parameter is not specified
forAll(collection* : Collection<E>, condition* : {E : Boolean}) : Boolean

Returns true if the condition is true for all elements in the collection.

forAll({4,3,2,1}, {e:Integer -> e > 0});
 //returns true
 forAll({4,3,2,1}, {e:Integer -> e > 1})
 //returns false

Parameters:

  • collection input collection
  • condition condition to check on all elements

Throws:

  • NullParameterError if a mandatory parameter is not specified
getDuplicates(collection* : Collection<E>) : Set<E>

Returns the set of duplicate elements in the given collection.

getDuplicates([1,2,3,1, "a","a", "b"])
 //result {1,"a"}

Parameters:

  • collection

Throws:

  • NullParameterError if a mandatory parameter is null
getFirst(collection* : Collection<E>) : E

Returns the first element of the collection, or null if the collection is empty.

getFirst({4,3,2,1})
//returns 4

Parameters:

  • collection input collection

Throws:

  • NullParameterError if a mandatory parameter is null
getFirst(collection* : Collection<E>, condition* : {E : Boolean}) : E

Returns the first element for which the condition is true. Returns <code>null</cod> if the collection is empty or the condition is not true for any of the collection elements.

getFirst({4,3,2,1},{e:Integer -> e<4})
//returns 3

Parameters:

  • collection input collection
  • condition condition to check

Throws:

  • NullParameterError if a mandatory parameter is null
getLast(collection* : Collection<E>) : E

Returns the last item of the collection, or null if the collection is empty.

getLast({4,3,2,1})
 //returns 1

Parameters:

  • collection input collection

Throws:

  • NullParameterError if a mandatory parameter is null
getLast(collection* : Collection<E>, condition* : {E : Boolean}) : E

Returns the last element for which the condition is true. Returns <code>null</cod> if the collection is empty or the condition is not true for any of the collection elements.

getLast([1,2,4,3,1],{e:Integer -> e>1});
 //returns 3
 getLast({4,3,2,1},{e:Integer -> e>1});
 //returns 2

Parameters:

  • collection input collection
  • condition condition to check

Throws:

  • NullParameterError if a mandatory parameter is null
groupBy(collection* : Collection<E>, classifier* : {E : K}) : Map<K, List<E>>

The function performs a group-by operation on the collection elements according to the value returned by the classifier function, and returns the result in a map.

groupBy([1,2,3,4,5], {e:Integer -> e < 3});
//returns [false->[3,4,5],true->[1,2]]
groupBy(["a", "b", "c", 1, 2, now()], {e:Object -> e.getType()})
 //returns [Integer->[1,2],String->["a","b","c"],Date->[d'2018-06-05 16:19:29.106']]

Parameters:

  • collection input collection
  • classifier classifier function that returns the groups

Throws:

  • NullParameterError if a mandatory parameter is null
hasDuplicates(collection* : Collection<Object>) : Boolean

Returns true if the collection contains duplicate elements, false otherwise.

hasDuplicates([2,2])
 //returns true

Parameters:

  • collection

Throws:

  • NullParameterError if a mandatory parameter is null
indexOf(collection* : Collection<Object>, element : Object) : Integer

Returns the index of the first occurrence of the specified element in the collection; returns -1 if the collection does not contain the specified element.

indexOf([0,1,2,3,4, 2], 2)
//returns 2

Parameters:

  • collection input collection
  • element element to find the index of

Throws:

  • NullParameterError if a mandatory parameter is not specified
isEmpty(collection* : Collection<Object>) : Boolean

Returns true if the collection contains no elements.

isEmpty([])
// returns true

Parameters:

  • collection collection to check

Throws:

  • NullParameterError if a mandatory parameter is not specified
isEmpty(map* : Map<Object, Object>) : Boolean

Returns true if the specified map contains no elements.

isEmpty([null -> null]);
 //returns false
isEmpty(["" -> ""]);
 //returns false
isEmpty([->]);
//returns true

Parameters:

  • map

Throws:

  • NullParameterError if a mandatory parameter is not specified
isSubset(set1* : Set<Object>, set2* : Set<Object>) : Boolean

Returns true if set1 is a subset of set2.

isSubset({1,2,3},{1,2,3,4});
 //returns true
isSubset({null,1,2,3},{1,2,3,4})
//returns false

Parameters:

  • set1 potential subset
  • set2 superset

Throws:

  • NullParameterError if a mandatory parameter is not specified
join(collection* : Collection<Object>) : String

Concatenates all non-empty string representations of the collection elements separating them with a comma and space (", ").

join(["a", "b", "c", null, "", "d"])
 //returns "a, b, c, d"

Parameters:

  • collection collection of elements to join

Throws:

  • NullParameterError if a mandatory parameter is not specified
join(collection* : Collection<Object>, joinString : String) : String

Concatenates all non-empty string representations of the collection elements separating them with joinString.

join(["a", "b", "c", null, "", "d"], ", ")
 //returns "a, b, c, d"

Parameters:

  • collection collection of elements to join
  • joinString element-string separator

Throws:

  • NullParameterError if a mandatory parameter is not specified
join(collection* : Collection<Object>, joinString : String, includeEmpty : Boolean) : String

Concatenates all string representations of the collection elements. The element are separated with joinString. If includeEmpty is true, null and empty elements are included in the resulting string.

join(["a", "b", "c", null, "", "d"], ", ", false)
 // returns "a, b, c, d"

join(["a", "b", "c", null, "", "d"], ", ", true) //returns "a, b, c, , , d"</pre>

Parameters:

  • collection collection with elements to join
  • joinString element-string separator
  • includeEmpty whether to include empty elements in the result

Throws:

  • NullParameterError if a mandatory parameter is not specified
keys(map* : Map<K, V>) : Set<K>

Returns a set of keys contained in the specified map.

keys([1->"a", 2->"b", 3 -> "a"])
 //returns  {1,2,3}

Parameters:

  • map input map

Throws:

  • NullParameterError if a mandatory parameter is not specified
keysOf(map* : Map<K, V>, element : V) : Set<K>

Returns the keys for all occurrences of the specified value included in the map.

keysOf([1->"a", 2->"b", 3 -> "a"], "a")
 //returns {1,3}

Parameters:

  • map input map
  • element value for which to return the map keys

Throws:

  • NullParameterError if a mandatory parameter is not specified
lastIndexOf(collection* : Collection<Object>, element : Object) : Integer

Returns the index of the last occurrence of the specified element in the collection; returns -1 if the collection does not contain the specified element.

lastIndexOf([1,2,3,1,5,6], 1)
 //returns 3

Parameters:

  • collection input collection
  • element element to find the last occurence of

Throws:

  • NullParameterError if a mandatory parameter is not specified
listUnion(collections : Collection<Collection<E>>...) : List<E>

Returns a list containing all elements from all the collections. Null values of collection are treated as empty collections.

listUnion([[null, 1,2,3, "hello"], [1,2,55]])
 = [null,1,2,3,"hello",1,2,55]

Parameters:

  • collections input collection with collections
map(keys* : Collection<K>, valueFunction* : {K : V}) : Map<K, V>

Returns a map with the collection elements as its keys and values computed from the collection elements by the valueFunction.

map({1,2,3}, {e:Integer -> e + 10} )
 //returns [1->11,2->12,3->13]

Parameters:

  • keys collection with key values
  • valueFunction function to compute the values for a key

Throws:

  • NullParameterError if a mandatory parameter is not specified
map(keys* : Collection<K>, values* : Collection<V>) : Map<K, V>

Returns a map by combining collections of keys and values. The number of keys must be equal to the number of values. At least one key and one value must be specified in order to determine the type of the map. If the keys parameter contains the same key several times, the most recently used key-value pair is included in the resulting map.

map([1,1,3, null],["a","b","c", null])
//result  [1->"b",3->"c", null->null]

Parameters:

  • keys
  • values

Throws:

  • NullParameterError if a mandatory parameter is not specified
  • WrongSizeError if either the number of keys is not equal to the number of values, or one of the input collection is empty
map(collection* : Collection<E>, keyFunction* : {E : K}, valueFunction* : {E : V}) : Map<K, V>

Returns a map with keys and values both computed based on the collection elements. For each map key-value pair, the key is calculated with the keyFunction and the value with the valueFunction. Both have the collection element as their input.

map({1,2,3}, {e:Integer -> e + 1 }, {e:Integer -> e + 10} )
 //returns [2->11,3->12,4->13]

Parameters:

  • collection input collection
  • keyFunction function that returns the key
  • valueFunction function that returns the value

Throws:

  • NullParameterError if a mandatory parameter is not specified
max(collection* : Collection<Date>) : Date

Returns the minimum element of the collection or null if the collection is empty.

Parameters:

  • collection input collection

Throws:

  • NullParameterError if a mandatory parameter is null
max(collection* : Collection<LocalDate>) : LocalDate

Returns maximal value from collection; or null, if the collection is empty.

Parameters:

  • collection

Throws:

  • NullParameterError if a mandatory parameter is null
max(collection* : Collection<Decimal>) : Decimal

Returns the maximum element of the collection or <code>null</ccode> if the collection is empty.

max([0.1,1.4,2.2,3.9,-2.8]) //returns 3.9

Parameters:

  • collection input collection

Throws:

  • NullParameterError if a mandatory parameter is null
max(collection* : Collection<Integer>) : Integer

Returns the maximum element of the collection or <code>null</ccode> if the collection is empty.

max([0,1,2,3,-2]) //returns 3

Parameters:

  • collection input collection

Throws:

  • NullParameterError if a mandatory parameter is null
max(collection* : Collection<String>) : String

Returns the string that is first as per Java lexicographic ordering of strings. Returns null if the collection is empty.

max(["haha", "yes", "no"]) //returns "yes"

Parameters:

  • collection input collection

Throws:

  • NullParameterError if a mandatory parameter is null
min(collection* : Collection<Date>) : Date

Returns the minimum element of the collection or null if the collection is empty.

Parameters:

  • collection input collection

Throws:

  • NullParameterError if a mandatory parameter is null
min(collection* : Collection<LocalDate>) : LocalDate

Returns minimal value from collection; or null, if the collection is empty.

Parameters:

  • collection

Throws:

  • NullParameterError if a mandatory parameter is null
min(collection* : Collection<Decimal>) : Decimal

Returns the minimum element of the collection or null if the collection is empty.

min([0.9,1.0,2.4,3.1,-2.9]) //returns -2.9

Parameters:

  • collection input collection

Throws:

  • NullParameterError if a mandatory parameter is null
min(collection* : Collection<Integer>) : Integer

Returns the minimum element of the collection or <code>null</ccode> if the collection is empty.

min([0,1,2,3,-2]) //returns -2

Parameters:

  • collection input collection

Throws:

  • NullParameterError if a mandatory parameter is null
min(collection* : Collection<String>) : String

Returns the string that is first as per Java lexicographic ordering of strings. Returns null if the collection is empty.

min(["haha", "yes", "no"]) //returns "haha"

Parameters:

  • collection input collection

Throws:

  • NullParameterError if a mandatory parameter is null
notEmpty(collection* : Collection<Object>) : Boolean

Returns true, if the specified collection contains at least one element.

Parameters:

  • collection

Throws:

  • NullParameterError if a mandatory parameter is null
notEmpty(map* : Map<Object, Object>) : Boolean

Returns true if the input map contains at least one element.

notEmpty([1->1]) // returns true

Parameters:

  • map input map

Throws:

  • NullParameterError if a mandatory parameter is null
remove(collection* : Collection<E>, elements : Object...) : Collection<E>

Removes the first occurrence of each of the elements from the input collection and returns the resulting collection. If the input collection is a set, the returned type is Set. If the input collection is a list, the returned type is List.

remove([1,1,2,3] ,1,2);
// returns: [1,3]
remove({1,2,3} , 2)
// returns = {1,3}

Parameters:

  • collection input collection
  • elements elements to remove

Throws:

  • NullParameterError if a mandatory parameter is not specified
remove(list* : List<E>, elements : Object...) : List<E>

Removes the first occurrence of the elements from the input list and returns the resulting list.

removeAll([1,1,2,3] ,[1]);
// returns: [2,3]

Parameters:

  • list input list
  • elements elements to remove from the input list

Throws:

  • NullParameterError if a mandatory parameter is not specified
remove(set* : Set<E>, elements : Object...) : Set<E>

Removes the elements from the input set and returns the resulting set.

remove({1,2,3,"hello"} , "hello", 2)
// returns = {1,3}

Parameters:

  • set input set
  • elements elements to remove

Throws:

  • NullParameterError if a mandatory parameter is not specified
removeAll(collection* : Collection<E>, elements* : Collection<Object>) : Collection<E>

Removes all occurrences of the elements from the input collection and returns the resulting collection. If the input collection is a set, the returned type is Set. If the input collection is a list, the returned type is List.

removeAll([1,1,2,3] ,[1]);
// returns: [2,3]
removeAll({ "hello", 1,2,3} , ["hello"])
// returns = {1,2,3}

Parameters:

  • collection input collection
  • elements elements to remove

Throws:

  • NullParameterError if a mandatory parameter is not specified
removeAll(list* : List<E>, elements* : Collection<Object>) : List<E>

Removes all occurrences of the elements from the input list and returns the resulting list.

removeAll([ "hello", "hello", 1,2,3], ["hello"])
// returns  [1,2,3]

Parameters:

  • list input list
  • elements elements to remove

Throws:

  • NullParameterError if a mandatory parameter is not specified
removeAll(set* : Set<E>, elements* : Collection<Object>) : Set<E>

Removes the elements from the input set and returns the resulting set.

{1,2,3} - [1];
// returns: {2,3}

Parameters:

  • set input set
  • elements elements to remove

Throws:

  • NullParameterError if a mandatory parameter is not specified
removeAt(collection* : Collection<E>, index* : Integer) : Collection<E>

Removes the element at the index position in the input collection and returns the new collection. If the input collection is a set, the returned type is Set. If the input collection is a list, the returned type is List.

removeAt([1,2,3,4], 2)
// returns [1,2,4]

Parameters:

  • collection input collection
  • index element to remove

Throws:

  • NullParameterError if a mandatory parameter is not specified
  • OutOfBoundsError if the specified index is out of range (index < 0 or index >= size(collection))
removeAt(list* : List<E>, index* : Integer) : List<E>

Removes the element at the index position in the input list and returns the new list.

removeAt([1,2,3,4], 2)
// returns [1,2,4]

Parameters:

  • list
  • index

Throws:

  • NullParameterError if a mandatory parameter is not specified
  • OutOfBoundsError if the specified index is out of range (index < 0 or index >= size(list))
removeAt(set* : Set<E>, index* : Integer) : Set<E>

Removes the element at the index position in the input set and returns the new set.

removeAt({1,2,3,4}, 2)
// returns {1,2,4}

Parameters:

  • set
  • index

Throws:

  • NullParameterError if a mandatory parameter is not specified
  • OutOfBoundsError if the specified index is out of range (index < 0 or index >= size(set))
removeKey(map* : Map<K, V>, keys : Object...) : Map<K, V>

Removes all key-value pairs with the keys defined by the keys parameter and returns the resulting map.

removeKey([ 1 -> "a", "a" -> 2, 3 -> "c"], "a", "c")
 // returns ["a"->2,3->"c"]

Parameters:

  • map input map
  • keys key to remove

Throws:

  • NullParameterError if a mandatory parameter is not specified
removeKeys(map* : Map<K, V>, keys* : Collection<Object>) : Map<K, V>

Removes all key-value pairs with the keys defined by the keys parameter and returns the resulting map.

removeKeys([ 1 -> "a", "a" -> 2, 3 -> "c"], ["a", "c"])
 // returns ["a"->2,3->"c"]

Parameters:

  • map input map
  • keys keys to remove

Throws:

  • NullParameterError if a mandatory parameter is not specified
removeRange(collection* : Collection<E>, fromIndex : Integer, toIndex : Integer) : Collection<E>

Returns a collection with the elements of the input collection that are out of the specified element range. The range of removed elements starts with fromIndex and finishes at the element preceding the toIndex element. If fromIndex is null or is less than 0, the range starts from the beginning of the collection (index 0). If toIndex is null or greater or equal to the size of the collection, the range ends at the end of the collection. If the input collection is a set, the returned type is Set. If the input collection is a list, the returned type is List.

removeRange([0, 1, 2, 3, 4], 2, 4) // returns [0,1,4]

Parameters:

  • collection input collection
  • fromIndex first element of the range that is removed
  • toIndex first element after the range that is retained

Throws:

  • NullParameterError if a mandatory parameter is null
  • OutOfBoundsError fromIndex > toIndex
removeRange(list* : List<E>, fromIndex : Integer, toIndex : Integer) : List<E>

Removes the elements of the input list that are in the specified element range from the input list and return the resulting list. The range of removed elements starts with fromIndex and finishes at the element preceding the toIndex element. If fromIndex is null or is less than 0, the range starts from the beginning of the list (index 0). If toIndex is null or greater or equal to the size of the list, the range ends at the end of the list.

removeRange({0, 1, 2, 3, 4}, 2, 4) // returns {0,1,4}

Parameters:

  • list input list
  • fromIndex first element of the range that is removed
  • toIndex first element after the range that is retained

Throws:

  • NullParameterError if a mandatory parameter is null
  • OutOfBoundsError fromIndex > toIndex
removeRange(set* : Set<E>, fromIndex : Integer, toIndex : Integer) : Set<E>

Removes the elements of the input set that in the specified element range and returns the resulting set. The range of removed elements starts with fromIndex and finishes at the element preceding the toIndex element. If fromIndex is null or is less than 0, the range starts from the beginning of the set (index 0). If toIndex is null or greater or equal to the size of the set, the range ends at the end of the set.

removeRange([0, 1, 2, 3, 4], 2, 4) // returns [0,1,4]

Parameters:

  • set input set
  • fromIndex first element of the range that is removed
  • toIndex first element after the range that is retained

Throws:

  • NullParameterError if a mandatory parameter is null
  • OutOfBoundsError fromIndex > toIndex
removeValue(map* : Map<K, V>, values : Object...) : Map<K, V>

Returns a map created by removing all key-value pairs with the values defined by the values parameter.

removeValue([ 1 -> "a", "a" -> 2, 3 -> "c"], "a", "c")
 // returns ["a"->2]

Parameters:

  • map input map
  • values values to remove

Throws:

  • NullParameterError if a mandatory parameter is not specified
replace(collection* : Collection<E>, element1 : Object, element2 : E) : Collection<E>

Returns a collection created by replacing all occurrences of element1 with element2 in the input collection. If the input collection is a set, the returned type is Set. If the input collection is a list, the returned type is List.

replace([1,2,3,1,2,3],1, "hello")
// returns ["hello",2,3,"hello",2,3]

Parameters:

  • collection input collection
  • element1 value to replace with the new value
  • element2 new value

Throws:

  • NullParameterError if a mandatory parameter is not specified
replace(list* : List<E>, element1 : Object, element2 : E) : List<E>

Returns a list created by replacing all occurrences of element1 with element2 in the input list.

replace([1,1,2,3], 1, "hello")
// returns ["hello","hello",2,3]

Parameters:

  • list input list
  • element1 element value to replace with the new element
  • element2 the new element

Throws:

  • NullParameterError if a mandatory parameter is not specified
replace(set* : Set<E>, element1 : Object, element2 : E) : Set<E>

Returns a set created by replacing element1 with element2 in the input set.

replace({1,1,2,3}, 1, "hello")
 = {"hello",2,3}

Parameters:

  • set input set
  • element1 set element to replace with the new element
  • element2 new element

Throws:

  • NullParameterError if a mandatory parameter is not specified
replaceValue(map* : Map<K, V>, value1 : Object, value2 : V) : Map<K, V>

Returns a map created by replacing all values defined by value1<i> with <i>value2 in the input map.

replaceValue([ 1 -> 1.0, 2 -> 1.0, 3 -> 2.0], 1.0, 4.2)
// return [1 -> 4.2, 2 -> 4.2, 3 -> 2]

Parameters:

  • map input map
  • value1 value to be replaced with the new value
  • value2 new value

Throws:

  • NullParameterError if a mandatory parameter is not specified
retainAll(collection* : Collection<E>, collections* : Collection<E>...) : Collection<E>

Returns a collection of the elements from the input collection that are contained in each of the collections. The relative order of the retained elements remains unchanged. If the input collection is a set, the returned type is Set. If the input collection is a list, the returned type is List.

retainAll([1,1,2,3], [1,3,4,5], [1,1,1,3,4,5]);
// returns [1,1,3]
retainAll({1,2,3}, [1,2,3,4,5], [1,3,4])
//returns  {1,3}

Parameters:

  • collection input collection
  • collections collection with elements that should be added to the output collection

Throws:

  • NullParameterError if a mandatory parameter is not specified
retainAll(list* : List<E>, collections* : Collection<E>...) : List<E>

Returns a list of the elements from the input list that are contained in each of the collections. The relative order of the retained elements remains unchanged.

retainAll([1,1,2,3], [1,3,4,5], [1,1,1,3,4,5]);
// returns [1,1,3]

Parameters:

  • list input list
  • collections collection

Throws:

  • NullParameterError if a mandatory parameter is not specified
retainAll(set* : Set<E>, collections* : Collection<E>...) : Set<E>

Returns a set created by the intersection all the collections, the input set and the collections. The relative order of the retained elements remains unchanged.

retainAll({1,2,3}, [1,2,3,4,5], {1,3,4})
//returns  {1,3}

Parameters:

  • set input set
  • collections collections

Throws:

  • NullParameterError if a mandatory parameter is not specified
reverse(collection* : Collection<E>) : Collection<E>

Reverses the order of the elements in the input collection and returns them in a new collection. If the input collection is a set, the returned type is Set. If the input collection is a list, the returned type is List.

reverse([1,1,2.1,2.1,3,4.2])
 // returns [4.2,3,2.1,2.1,1,1];
 reverse({1,1,2.1,3,4.2})
 // returns {4.2,3,2.1,1} 

Parameters:

  • collection input collection

Throws:

  • NullParameterError if a mandatory parameter is not specified
reverse(list* : List<E>) : List<E>

Reverses the order of the elements in the input list and returns them in a new list.

reverse([1,1,2.1,2.1,3,4.2])
 // returns [4.2,3,2.1,2.1,1,1]

Parameters:

  • list input list

Throws:

  • NullParameterError if a mandatory parameter is not specified
reverse(set* : Set<E>) : Set<E>

Reverses the order of the elements in the input set and returns them in a new set.

 reverse({1,1,2.1,3,4.2})
 // returns {4.2,3,2.1,1} 

Parameters:

  • set input set

Throws:

  • NullParameterError if a mandatory parameter is not specified
select(collection* : Collection<E>, condition* : {E : Boolean}) : Collection<E>

Returns a colection with those elements from the input collection for which the condition is true. If the input collection is a set, the returned type is Set. If the input collection is a list, the returned type is List.

select([1,1,2.1,3,4.2],{ d:Decimal -> d > 2})
// returns [2.1,3,4.2]

Parameters:

  • collection input collection
  • condition condition the collection elements must satisfy

Throws:

  • NullParameterError if a mandatory parameter is not specified
select(collection* : Collection<Object>, type* : Type<E>) : Collection<E>

Returns a collection with those input-collection elements that are of the given type. The null elements are excluded. If the input collection is a set, the returned type is Set. If the input collection is a list, the returned type is List.

select([1,1,2.1,3,4.2, null],Integer)
 // returns  [1,1,3]
select({1,2.1,3,4.2, null},Integer)
// returns {1,3}

Parameters:

  • collection input collection
  • type type of elements to return

Throws:

  • NullParameterError if a mandatory parameter is not specified
select(list* : List<E>, condition* : {E : Boolean}) : List<E>

Returns a list with those elements from the input list which meet the condition.

select([1,1,2.1,2.1,3,4.2],{ d:Decimal -> d > 2})
// returns [2.1,2.1,3,4.2]

Parameters:

  • list input list
  • condition condition the list elements must satisfy

Throws:

  • NullParameterError if a mandatory parameter is not specified
select(list* : List<Object>, type* : Type<E>) : List<E>

Returns a list with those input-list elements that are of the given type. The null elements are excluded.

select({1,2.1,3,4.2, null},Integer)
// returns {1,3}

Parameters:

  • list input list
  • type type of elements to return

Throws:

  • NullParameterError if a mandatory parameter is not specified
select(map* : Map<K, V>, condition* : {K, V : Boolean}) : Map<K, V>

Returns a map with those elements of the input map for which the condition closure return true

select([1 -> "a", 2 -> "b", 3 -> "b"], {k:Integer, v:String -> k > 1 and v =="b"})
// returns [2->"b",3->"b"]

Parameters:

  • map input map
  • condition condition to check

Throws:

  • NullParameterError if a mandatory parameter is not specified
select(set* : Set<E>, condition* : {E : Boolean}) : Set<E>

Returns a set with those elements from the input set which meet the condition.

select({1,1,2.1,3,4.2},{ d:Decimal -> d > 2})
 // returns {2.1,3,4.2}

Parameters:

  • set input set
  • condition condition the set elements must satisfy

Throws:

  • NullParameterError if a mandatory parameter is not specified
select(set* : Set<Object>, type* : Type<E>) : Set<E>

Returns a set with those input-set elements that are of the given type. The null elements are excluded.

select({1,2.1,3,4.2, null},Integer)
// returns {1,3}

Parameters:

  • set input set
  • type type of elements to return

Throws:

  • NullParameterError if a mandatory parameter is not specified
setAt(collection* : Collection<E>, index* : Integer, element : E) : Collection<E>

Replaces the element of the collection at the index position with the new element and returns the new collection. If the input collection is a set, the returned type is Set. If the input collection is a list, the returned type is List.

setAt([1,2,4], 2, 3) //returns [1,2,3]

Parameters:

  • collection input collection
  • index index of the element to replace
  • element new element

Throws:

  • NullParameterError if a mandatory parameter is not specified
  • OutOfBoundsError if the specified index is out of range (index < 0 or index >= size(collection))
setAt(list* : List<E>, index* : Integer, element : E) : List<E>

Replaces the element of the list at the index position with the new element and returns the new list.

setAt([1,2,4], 2, 3) //returns [1,2,3]

Parameters:

  • list
  • index
  • element

Throws:

  • NullParameterError if a mandatory parameter is not specified
  • OutOfBoundsError if the specified index is out of range (index < 0 or index >= size(list))
setAt(set* : Set<E>, index* : Integer, element : E) : Set<E>

Replaces the element of the set at the index position with the new element and returns the new set.

setAt([1,2,4], 2, 3) //returns [1,2,3]

Parameters:

  • set input set
  • index index of the element to replace
  • element new element

Throws:

  • NullParameterError if a mandatory parameter is not specified
  • OutOfBoundsError if the specified index is out of range (index < 0 or index >= size(set))
size(collection* : Collection<Object>) : Integer

Returns the number of elements in the collection.

Parameters:

  • collection input collection

Throws:

  • NullParameterError if a mandatory parameter is not specified
size(map* : Map<Object, Object>) : Integer

Returns the number of elements in the map.

Parameters:

  • map input map

Throws:

  • NullParameterError if a mandatory parameter is not specified
sort(collection* : Collection<Date>, ascending* : Boolean) : Collection<Date>

Sorts the input-collection elements sorted in ascending or descending order and returns the resulting collection.

sort([d'2015-12-24 20:00:00.000', now()] , true)
//returns  [d'2015-12-24 20:00:00.000',d'2018-06-04 10:25:01.142']

Parameters:

  • collection input collection
  • ascending whether to sort in ascending or descending order

Throws:

  • NullParameterError if a mandatory parameter is null
sort(collection* : Collection<Decimal>, ascending* : Boolean) : Collection<Decimal>

Sort the input-collection elements in ascending or descending order and returns the resulting collection.

sort([ 2e+12, 0, -1.2342e0, -4.2] , true) //returns [-4.2,-1.2342,0,2000000000000]

Parameters:

  • collection input collection
  • ascending whether to sort in ascending or descending order

Throws:

  • NullParameterError if a mandatory parameter is null
sort(collection* : Collection<Integer>, ascending* : Boolean) : Collection<Integer>

Sorts the input-collection elements in ascending or descending order and returns the resulting collection.

sort([ 1, 0, 1, -4], true) //returns [-4,0,1,1]

Parameters:

  • collection input collection
  • ascending whether to sort in ascending or descending order

Throws:

  • NullParameterError if a mandatory parameter is null
sort(collection* : Collection<String>, ascending* : Boolean) : Collection<String>

Sorts the input-collection elements in ascending or descending order and returns the resulting collection.

sort(["č", "4","aa", "#", "C", "c"], true) //returns ["#","4","C","aa","c","č"]

Parameters:

  • collection input collection
  • ascending whether to sort in ascending or descending order

Throws:

  • NullParameterError if a mandatory parameter is null
sort(collection* : Collection<E>, comparator* : {E, E : Integer}) : Collection<E>

Sorts the collection elements according to the comparator closure and returns the resulting collection. The comparator defines the total ordering function: It takes two elements of the input collection and returns a negative integer when the first parameter is less than the second parameter, zero when the first parameter is equal to the second parameter, or a positive integer when the first parameter is greater than the second parameter. If the input collection is a set, the returned type is Set. If the input collection is a list, the returned type is List.

sort({ 100, 1, 123, 342}, { a:Integer, b:Integer -> if a > b then 1 elsif a=b then 0 else -2 end}) //returns {1,100,123,342}

Parameters:

  • collection input collection
  • comparator comparator closure

Throws:

  • NullParameterError if a mandatory parameter is not specified
sort(list* : List<Date>, ascending* : Boolean) : List<Date>

Sorts the input-list elements in ascending or descending order and returns the resulting list.

sort([d'2015-12-24 20:00:00.000', now()] , true)
//returns  [d'2015-12-24 20:00:00.000',d'2018-06-04 10:25:01.142']

Parameters:

  • list input list
  • ascending whether to sort in ascending or descending order

Throws:

  • NullParameterError if a mandatory parameter is null
sort(list* : List<Decimal>, ascending* : Boolean) : List<Decimal>

Sorts the input-list elements in ascending or descending order and returns the resulting list.

sort([ 2e+12, 0, 0,-1.2342e0, -4.2] , true) //returns [-4.2,-1.2342,0,0,2000000000000]

Parameters:

  • list input list
  • ascending whether to sort in ascending or descending order

Throws:

  • NullParameterError if a mandatory parameter is null
sort(list* : List<Integer>, ascending* : Boolean) : List<Integer>

Sorts the input-list elements in ascending or descending order and returns the resulting list.

sort([ 1, 0, 1, -4], true) //returns [-4,0,1,1]

Parameters:

  • list input list
  • ascending whether to sort in ascending or descending order

Throws:

  • NullParameterError if a mandatory parameter is null
sort(list* : List<String>, ascending* : Boolean) : List<String>

Sorts the input-list elements in ascending or descending order and returns the resulting list.

sort(["č", "4","aa", "#", "C", "c", "aa"], true) //returns ["#","4","C","aa","aa","c","č"]

Parameters:

  • list input list
  • ascending whether to sort in ascending or descending order

Throws:

  • NullParameterError if a mandatory parameter is null
sort(list* : List<E>, comparator* : {E, E : Integer}) : List<E>

Sorts the elements of the collection according to the comparator closure and returns the resulting list. The comparator defines the total ordering function: it takes two elements of the input collection and returns a negative integer when the first parameter is less than the second parameter, zero when the first parameter is equal to the second parameter, or a positive integer when the first parameter is greater than the second parameter.

sort( [4, 1, 3, 0, 2, 2], { a:Integer, b:Integer -> if a > b then 1 elsif a=b then 0 else -2 end})
//returns [0,1,2,2,3,4]

Parameters:

  • list input list
  • comparator comparator closure

Throws:

  • NullParameterError if a mandatory parameter is not specified
sort(set* : Set<Date>, ascending* : Boolean) : Set<Date>

Sorts the input-set elements sorted in ascending or descending order and returns the resulting set.

sort({d'2015-12-24 20:00:00.000', now(), now()} , true)
//returns  [d'2015-12-24 20:00:00.000',d'2018-06-04 10:25:01.142']

Parameters:

  • set input set
  • ascending whether to sort in ascending or descending order

Throws:

  • NullParameterError if a mandatory parameter is null
sort(set* : Set<Decimal>, ascending* : Boolean) : Set<Decimal>

Sorts the input-set elements in ascending or descending order and returns the resulting set.

Parameters:

  • set input set
  • ascending whether to sort in ascending or descending order

Throws:

  • NullParameterError if a mandatory parameter is null
sort(set* : Set<Integer>, ascending* : Boolean) : Set<Integer>

Sorts the input-set elements in ascending or descending order and returns the resulting set.

sort({ 1, 0, 1, -4, -4}, true) //returns {-4,0,1,1}

Parameters:

  • set input set
  • ascending whether to sort in ascending or descending order

Throws:

  • NullParameterError if a mandatory parameter is null
sort(set* : Set<String>, ascending* : Boolean) : Set<String>

Sorts the input-set elements in ascending or descending order and returns the resulting set.

sort({"č", "4","aa", "aa","#", "C", "c", "aa"}, true)
//returns {"#","4","C","aa","c","č"}

Parameters:

  • set input set
  • ascending whether to sort in ascending or descending order

Throws:

  • NullParameterError if a mandatory parameter is null
sort(set* : Set<E>, comparator* : {E, E : Integer}) : Set<E>

Sort the elements of the collection according to the comparator closure and returns the resulting set. The comparator defines the total ordering function: it takes two elements of the input collection and returns a negative integer when the first parameter is less than the second parameter, zero when the first parameter is equal to the second parameter, or a positive integer when the first parameter is greater than the second parameter.

sort({ 4, 1, 3, 0, 2, 2}, { a:Integer, b:Integer -> if a > b then 1 elsif a=b then 0 else -2 end})
//returns {0,1,2,3,4}

Parameters:

  • set input set
  • comparator comparator closure

Throws:

  • NullParameterError if a mandatory parameter is not specified
sortByKey(collection* : Collection<E>, keyExtractor* : {E : Object}, ascending* : Boolean, nullsFirst* : Boolean) : List<E>

Sorts the input-collection elements by the keys produced by the keyExtractor closure and returns the resulting collection. The keys must be comparable: they must be strings, decimals, integers, or dates. ascending defines whether the list elements are in natural or reverse order: When true, natural order is used. nullsFirst specifies whether null keys are considered smaller or greater in natural order: When true, null values are at the beginning of the list.

sortByKey(
  collection -> [10,3,2,13, null, 4],
  keyExtractor -> { i:Integer -> i },
  ascending -> true,
  nullsFirst -> true
) //returns [null, 2,3,4,10,13]

Parameters:

  • collection input collection
  • keyExtractor key extractor closure
  • ascending sorting order
  • nullsFirst ordering position of null values

Throws:

  • NullParameterError if a mandatory parameter is null
subCollection(collection* : Collection<E>, fromIndex : Integer, toIndex : Integer) : Collection<E>

Returns the part of the input collection which starts with the element on the fromIndex position and finishes at the element preceding the toIndex. If fromIndex is null or is less than 0, the sub-collection starts from the beginning of the collection. If toIndex is null or, equal or greater than the size of the collection, the sub-collection ends at the end of the input collection.

subCollection([0, 1, 2, 3, 4], -2, 10) // returns [0,1,2,3,4]

Parameters:

  • collection input collection
  • fromIndex index of the first element to include in the resulting collection
  • toIndex index of the first element to exclude from the resulting collection

Throws:

  • NullParameterError if a mandatory parameter is not specified
  • OutOfBoundsError if fromIndex > toIndex
subList(list* : List<E>, fromIndex : Integer, toIndex : Integer) : List<E>

Returns the part of the input list which starts with the element on the fromIndex position and finishes at the element preceding the toIndex. If fromIndex is null or is less than 0, the sub-list starts from the beginning of the list. If toIndex is null or, equal or greater than the size of the list, the sub-list ends at the end of the input list.

subList([1,1,2,3,4, 5], 2, 4) //returns [2,3]

Parameters:

  • list input list
  • fromIndex index of the first element to include in the returned list
  • toIndex index of the first element to exclude from the returned list

Throws:

  • NullParameterError if a mandatory parameter is not specified
  • OutOfBoundsError if fromIndex > toIndex
subset(set* : Set<E>, fromIndex : Integer, toIndex : Integer) : Set<E>

Returns the part of the input set which starts with the element on the fromIndex position and finishes at the element preceding the toIndex. If fromIndex is null or is less than 0, the sub-set starts from the beginning of the set. If toIndex is null or, equal or greater than the size of the set, the sub-set ends at the end of the input set.

subset({0, 1, 2, 3, 4}, null, 3) // returns {0,1,2}

Parameters:

  • set input set
  • fromIndex index of the first element to include in the resulting set
  • toIndex index of the first element to exclude from the resulting set

Throws:

  • NullParameterError if a mandatory parameter is not specified
  • OutOfBoundsError if fromIndex > toIndex
sum(collection* : Collection<E>) : E

Returns the sum of the decimals in the given collection.

sum( [1,3.2]) //returns 4.2

Parameters:

  • collection collection of Decimals

Throws:

  • NullParameterError if a mandatory parameter is not specified
swap(list* : List<T>, index1* : Integer, index2* : Integer) : List<T>

Swaps the elements at the given indexes in the input list and returns the resulting list. s swap ([1, 3, 2], 1, 2) // returns [1,2,3]

Parameters:

  • list input list
  • index1 index of the element to swap
  • index2 ndex of the element to swap

Throws:

  • NullParameterError if a mandatory parameter is not specified
toList(collection* : Collection<E>) : List<E>

Returns a list of elements of the input collection arranged in an arbitrary order.

toList([1,1,2,3,3]) ///returns [1,1,2,3,3]

Parameters:

  • collection input collection

Throws:

  • NullParameterError if a mandatory parameter is not specified
toSet(collection* : Collection<E>) : Set<E>

Returns a set with the elements of the input collection.

toSet([1 , 1, 2]) // returns {1,2}


toSet({1 , 1, 2}) // returns {1,2} 

Parameters:

  • collection input collection

Throws:

  • NullParameterError if a mandatory parameter is not specified
values(map* : Map<K, V>) : List<V>

Returns a list of values in the input map.

values([1 -> "b", 2 -> "c"]) // returns ["b","c"]

Parameters:

  • map input map

Throws:

  • NullParameterError if a mandatory parameter is not specified

Binary

createBinaryHandle(fileName* : String, description : String, content* : String, mime : String, charset : String) : BinaryHandleSIDE EFFECTDEPRECATED

Creates a persisted binary handle that represents a file. If the mime type is not specified, it is determined based on the file extension. If no charset is defined, UTF-8 is used.

Parameters:

  • fileName filename of the binary handle
  • description description of the binary handle
  • content content of the binary handle saved in binary
  • mime mime type
  • charset charset

Throws:

  • NullParameterError if a mandatory parameter is null
  • UnsupportedEncodingError if the specified charset is not supported
getBinaryHandle(id* : Integer) : BinaryHandleDEPRECATED

Returns a binary handle with the identifier.

Parameters:

  • id identifier of the binary handle

Throws:

  • NullParameterError if a mandatory parameter is null
  • BinaryHandleNotFoundError if there is no such a binary handle
getBinaryHandleMetadata(binaryData* : BinaryHandle) : Map<String, String>

Returns a binary handle metadata.

Parameters:

  • binaryData binary handle

Throws:

  • NullParameterError if a mandatory parameter is null
getResource(module* : String, path* : String) : File

Creates a file from the resource of a module of the model. If a model is based on module A and module A imports modules B and C, module B can access resourceses from C.

def File myFile := getResource("my_ imported_module", "output/myfile.txt")

Parameters:

  • module name of the model module with the resource
  • path relative path to the file from the module root

Throws:

  • NullParameterError if a mandatory parameter is null
  • ResourceNotFoundError if the module is not available or the resource is not found at the given path
resource(module* : String, path* : String) : BinaryHandleSIDE EFFECTDEPRECATED

Creates a binary handle from a module resource located at the specified path

Parameters:

  • module
  • path

Throws:

  • NullParameterError if a mandatory parameter is null
  • ResourceNotFoundError if the specified module is not available or the resource is not found at the given path
size(binary : Binary) : Integer

Returns the size of the binary in bytes.

def Integer contentSize : = size(myBinaryHolder.content)

Parameters:

  • binary binary
toBinary(string : String) : Binary

Converts the string to binary.

Parameters:

  • string string to convert
toString(binary* : Binary, charset : String) : String

Converts binary to a string encoded in the given charset. If no charset is defined, UTF-8 is used. The supported charsets are defined in java.nio.charset.StandardCharsets and include US-ASCII, ISO-8859-1, UTF-8, UTF-16BE, UTF-16LE, UTF-16, etc.

Parameters:

  • binary binary to encode
  • charset target charset

Throws:

  • NullParameterError if a mandatory parameter is null
  • UnsupportedEncodingError if the encoding is not supported

Enumeration

literalToName(literal* : Enumeration) : String

Transforms the input enumeration literal to its name represented as a string

literalToName(Level.BEGINNER).toLowerCase()
//returns "beginner"

Parameters:

  • literal input enumeration literal to transform

Throws:

  • NullParameterError if mandatory parameter is null
literals(enumeration* : Type<E>) : List<E>

Returns the list of literals of the input enumeration.

literals(Level)
//returns [common::Level.BEGINNER, common::Level.INTERMEDIATE, common::Level.ADVANCED]

Parameters:

  • enumeration input enumeration

Throws:

  • NullParameterError if mandatory parameter is null
nameToLiteral(enumeration* : Type<E>, name* : String) : E

Transforms the input name to the corresponding literal value of the input enumeration.

nameToLiteral(Level, "BEGINNER")
//returns the enumeratation literal common::Level.BEGINNER

Parameters:

  • enumeration input enumeration
  • name input name to transform

Throws:

  • NullParameterError if mandatory parameter is null
  • DoesNotExistError if the specified name does not corespond to any literal
toEnumeration(string* : String) : Enumeration

Transforms the input enumeration name to the corresponding enumeration value. The enumeration name must be in the following format: MODULE_NAME::ENUMERATION_NAME.LITERAL_NAME

toEnumeration("common::Level.BEGINNER")
//returns the enumeration literal common::Level.BEGINNER

Parameters:

  • string input enumeration name

Throws:

  • NullParameterError if a mandatory parameter is null or empty string
  • FormatError if the string is not a valid enumeration full name

Label

getLabel(literal* : Enumeration) : String

Returns the enumeration literal label.

Parameters:

  • literal enumertation literal

Throws:

  • NullParameterError if mandatory parameter is null
getLabel(property* : Property) : String

Returns the property label of the record or interface property.

getLabel(Registration.firstName)

Parameters:

  • property record or interface property

Throws:

  • NullParameterError if mandatory parameter is null
getLabel(type* : Type<Object>) : String

Returns the label of the record, enumeration, or interface type.

getLabel(RegistrationData)

Parameters:

  • type record, enumeration, or interface

Throws:

  • NullParameterError if mandatory parameter is null

Pdf

fillPdfTemplate(pdfTemplate* : Binary, fdfDocument* : Binary) : Binary

Populates the PDF form template with the values from the FDF document and returns the resulting PDF.

Parameters:

  • pdfTemplate
  • fdfDocument
fillPdfTemplate(pdfTemplate* : Binary, values : Map<Object, Object>) : Binary

Populates the PDF form template with the values specified by the values parameter using the FDF merging method and returns the resulting PDF document. The parameter names and values are specified by the parameters map.

Parameters:

  • pdfTemplate PDF template
  • values names and values for the PDF form template
fillXfaPdfTemplate(pdfTemplate* : Binary, data* : Record) : Binary

Returns a PDF document obtained by populating the XFA template with the specified data. The type of populated record must specify the XML mapping that conforms to the XML schema required by the template.

Parameters:

  • pdfTemplate XFA template
  • data input data
fillXfaPdfTemplate(pdfTemplate* : Binary, xml* : String) : Binary

Populates the XFA template with the specified data and returns the resulting PDF document. The input data must conform to the XML schema required by the template.

Parameters:

  • pdfTemplate PDF template
  • xml input data

Validation

findTag(name* : String) : Tag

Finds a tag with the given name which can be a simple name or full name. Returns null if the tag is not found. If the simple name is given and it is ambiguous (more validation tags with the name exist in different imported modules), an error is thrown.

Parameters:

  • name name of the tag

Throws:

  • NullParameterError if a mandatory parameter is not specified
  • AmbiguousNameError if the given name is ambiguous
validate(record : Record, property : Property, tags : Collection<Tag>, context : Map<String, Object>) : List<ConstraintViolation>

Validates the given record property against its constraints with the given tags. If the record is null, an empty list is returned. If the property parameter is null, all properties of the record are validated.

validate(new Simple(field -> "a"), null, null, null)

Parameters:

  • record input record
  • property record property to validate
  • tags tags
  • context input for complex constraints

Throws:

  • IncompatibleTypeError if the given property is not a property of the given record
validate(record : Collection<Record>, property : Property, tags : Collection<Tag>, context : Map<String, Object>) : List<ConstraintViolation>

Validates the given property in all records in the collection against the property constraints with the given tags. If the collection is null, an empty list is returned. Null elements of the collection are ignored. If the property parameter is null, all properties of the records are validated.

Parameters:

  • record collection of records
  • property property to validate
  • tags tags used
  • context context data needed by the validation

Throws:

  • IncompatibleTypeError if the given property is not a property of any given record in the collection

String

contains(string* : String, substring* : String) : Boolean

Returns true if the input string contains the substring.

"hello".contains("he") //returns true

Parameters:

  • string input string
  • substring substring to search for
find(string* : String, regexp* : String) : List<String>

Finds all occurrences of the regexp pattern in the specified string and returns them as a list of strings. If no string is matched, the function returns an empty list. The Java regular expression syntax as defined in the java.util.regex.Pattern class is used.

find("one two three fourteen", "([\w]+)")
//returns ["one", "two", "three", "fourteen"]

Parameters:

  • string input string
  • regexp regex pattern

Throws:

  • NullParameterError if mandatory parameter is null
format(pattern* : String, arguments : Object...) : String

Formats the objects in the arguments parameter using the format in the pattern parameter and returns the resulting string. The pattern uses the syntax defined in the java.util.Formatter class restricted to the formatting commands that apply to the Java data types used to represent the Expression Language data types. The arguments data type are transformed according to the following table:

Boolean -> java.lang.Boolean String -> java.lang.String Date -> java.util.Date Integer -> java.math.BigDecimal Decimal -> java.math.BigDecimal other data types -> java.lang.String using the function core::toString

The format() function uses the server locale for formatting numbers and dates.

format( "The boolean is 100%% %2$s, %1$s !",  "John", false);
 //returns "The boolean is 100% false, John !"
format( "Today is %tB %tm", now(), now());
 //returns "Today is June 06"

Parameters:

  • pattern pattern to process
  • arguments arguments for the pattern

Throws:

  • NullParameterError if a mandatory parameter is not specified
  • FormatError if the specified format is incorrect
formatWithLocale(pattern* : String, locale : String, arguments : Object...) : String

Formats the objects in the arguments parameter using the format in the pattern parameter and returns the resulting string. The pattern uses the syntax defined in the java.util.Formatter class restricted to the formatting commands that apply to the Java data types used to represent the Expression Language data types. The arguments data type are transformed according to the following table:

Boolean -> java.lang.Boolean String -> java.lang.String Date -> java.util.Date Integer -> java.math.BigDecimal Decimal -> java.math.BigDecimal other data types -> java.lang.String using the function core::toString

The locale parameter determines the locale used for formatting numbers and dates. If it is null, the server locale is used.

 formatWithLocale("%tB", "en_US", now());
//returns "June"
formatWithLocale("%tB.", "it", now());
//returns giugno

Parameters:

  • pattern pattern to format
  • locale target locale
  • arguments arguments for the pattern

Throws:

  • NullParameterError if a mandatory parameter is not specified
  • FormatError if the specified format is incorrect
indexOf(string* : String, substring* : String) : Integer

Returns the index of the first occurrence of the specified substring within the string.

indexOf("abcabc", "b");//returns 1
indexOf("abcasbc", "ca") //returns 2

Parameters:

  • string string to search in
  • substring substring to search for

Throws:

  • NullParameterError if mandatory parameter is null
indexOf(string* : String, substring* : String, fromIndex* : Integer) : Integer

Returns the index of the first occurrence of the specified substring within the input string starting from the specified index.

indexOf("abcdefghabcdefgh", "ab", 2)
//returns 8

Parameters:

  • string input string
  • substring string to search for
  • fromIndex start search at this index

Throws:

  • NullParameterError if mandatory parameter is null
  • OutOfBoundsError if the index is out of range (index < 0 or index >= length(string))
isBlank(string : String) : Boolean

Returns true if the string is null, has zero length (contains no characters) or only contains only whitespaces.

"   ".isBlank() //returns true

Parameters:

  • string input string
isEmpty(string : String) : Boolean

Returns true if the string is either null or has zero length (contains no characters).

"   ".isEmpty(); //returns false
"".isEmpty() //returns true

Parameters:

  • string input string
lastIndexOf(string* : String, substring* : String) : Integer

Returns the index of the rightmost occurrence of the specified substring in the input string.

lastIndexOf("ababab", "a") //returns 4

Parameters:

  • string input string
  • substring substring to search for

Throws:

  • NullParameterError if mandatory parameter is null
lastIndexOf(string* : String, substring* : String, fromIndex* : Integer) : Integer

Returns the index of the last occurrence of the specified substring within the string searching backward starting at the specified index.

lastIndexOf("aabba", "a", 3) //returns 1

Parameters:

  • string input string
  • substring substring to search for
  • fromIndex start backward from this index

Throws:

  • NullParameterError if mandatory parameter is null
  • OutOfBoundsError if the index is out of range (index < 0 or index >= length(string))
length(string* : String) : Integer

Returns the length of the specified string.

"123 45".length() //returns 6

Parameters:

  • string input string

Throws:

  • NullParameterError if a mandatory parameter is not specified
localize(string* : String, language* : String) : String

Replaces all localizable substrings in the string parameter by the corresponding localized strings from the specified language.

localize($save_button() + ", " + $load_button(), "EN")
//returns "Save, Load"

Parameters:

  • string string to localize
  • language language code

Throws:

  • NullParameterError if a mandatory parameter is not specified
matches(string* : String, regexp* : String) : Boolean

Returns true if the specified string matches the regular expression given by the regexp parameter, otherwise returns false. The Java regular expression syntax as defined in the java.util.regex.Pattern class is used.

"abccccD".matches("\a[^h]c{3}.*")
//returns true

Parameters:

  • string input string
  • regexp regex pattern

Throws:

  • NullParameterError if a mandatory parameter is not specified
replaceAll(string* : String, regexp* : String, replacement* : String) : String

Replaces each occurence of the regexp<i> parameter substring in the specified <i>string with the replacement parameter. The Java regular expression syntax as defined in the java.util.regex.Pattern class is used.

replaceAll("replace replace me", "w++", "please ")
//returns "please please please"

Parameters:

  • string input string
  • regexp regex pattern
  • replacement replace matches with this string

Throws:

  • NullParameterError if a mandatory parameter is not specified
replaceFirst(string* : String, regexp* : String, replacement* : String) : String

Replaces the first occurrence of the regexp parameter in the string parameter with the string specified by the replacement parameter and returns the resulting string. The Java regular expression syntax as defined in the java.util.regex.Pattern class is used.

replaceFirst("replace replace me", "w++", "Please ")
//returns "Please replace me"

Parameters:

  • string input string
  • regexp regex pattern
  • replacement replace with this string

Throws:

  • NullParameterError if a mandatory parameter is not specified
split(string* : String, regexp* : String) : List<String>

Splits the string at the positions that match the regular expression. The Java regular expression syntax as defined in the java.util.regex.Pattern class is used.

split("one two three", "s")
//returns ["one", "two", "three"]

Parameters:

  • string input string
  • regexp regular expression

Throws:

  • NullParameterError if a mandatory parameter is not specified
substring(string* : String, fromIndex : Integer, toIndex : Integer) : String

Returns a substring of the input string starting at the fromIndex position (inclusive) and ending at the toIndex position (exclusive). If the fromIndex is null or is less than 0, it is considered 0. If the toIndex is null, equal, or greater than the length of the string, the substring ends at the end of the string (index given by length(string)-1).

substring("0123Hello World!", 4, 20 )
 //returns "Hello World!"

Parameters:

  • string input string
  • fromIndex substring's start index
  • toIndex substring's end index

Throws:

  • NullParameterError if a mandatory parameter is not specified
  • OutOfBoundsError if fromIndex > toIndex
toDecimal(string* : String) : Decimal

If possible, converts the specified string to a decimal. If not possible, the function throws a runtime exception.

toDecimal("4.2") //returns 4.2

Parameters:

  • string string with a decimal

Throws:

  • NullParameterError if a mandatory parameter is not specified
  • FormatError if the string does not represent a decimal value
toInteger(string* : String) : Integer

If possible, converts the specified string to an integer. If not possible, the function throws a runtime exception.

"123 45".toInteger();
//returns FormatError
"12345".toInteger() //returns 12345

Parameters:

  • string string with integer value

Throws:

  • NullParameterError if a mandatory parameter is not specified
  • FormatError if the string does not represents an integer value
toInteger(string* : String, radix* : Integer) : Integer

Converts the integer in the specified string to an integer using the specified radix. The radix must be between 2 and 36 (inclusive). If not possible, the function throws a runtime exception.

toInteger("15",36) //returns 41

Parameters:

  • string string with an integer
  • radix applied radix

Throws:

  • NullParameterError if a mandatory parameter is not specified
  • FormatError if the string does not represents an integer value
toLowerCase(string* : String) : String

Converts all characters of the specified string to lowercase.

toLowerCase("Hello World!");
toLowerCase("Hello World!");
"Hello World!".toLowerCase()

Parameters:

  • string input string

Throws:

  • NullParameterError if mandatory parameter is null
toString(object : Object) : String

Converts the specified object to a string.

toString(findById(Model, 1))

Parameters:

  • object object to convert to string
toUpperCase(string* : String) : String

Converts all characters of the specified string to uppercase.

toUpperCase("Hello World!") //returns "HELLO WORLD!"

Parameters:

  • string input string

Throws:

  • NullParameterError if mandatory parameter is null
trim(string* : String) : String

Eliminates leading and trailing spaces from the input string and returns the resulting string.

" hello world!   ".trim() //returns "hello world!"

Parameters:

  • string input string

Throws:

  • NullParameterError if a mandatory parameter is not specified

Xml

convertToXml(object* : Object) : String

Converts internal data structures passed to the object parameter to XML document. The object parameter must be an instance of a record type, otherwise an exception is thrown. The function returns a string which represents the output XML document.

convertToXml(new MyRecord(item -> "value"))

Parameters:

  • object record to convert to XML

Throws:

  • NullParameterError if a mandatory parameter is null
  • IncompatibleTypeError if the type of the object is not record
  • UnableToConvertToXmlError if an error occurred during conversion
parseXml(xml* : String, resultType* : Type<E>) : ESIDE EFFECT

Parses xml to resultType record and returns the result in the resultType record.

parseXml(
   "<?xml version=""1.0"" encoding=""UTF-8""?>
     <ns0:ParsedXml xmlns:ns0=""restCall"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"">
       <ns0:item>value</ns0:item>
      </ns0:ParsedXml>",
ParsedXml)

Parameters:

  • xml XML to parse to the record type
  • resultType record type

Throws:

  • NullParameterError if a mandatory parameter is null
  • IncompatibleTypeError if the resultType parameter is not record
  • UnableToParseXmlError if the specified xml cannot be parsed

Reflection

achieved() : StringDEPRECATED
Returns a string representing "Achieved" state. Deprecated. Replaced by constant ACHIEVED.
activate(goals : Collection<Goal>) : voidSIDE EFFECT

Activates inactive and finished goals. If a goal from the collection is active, the goal status remains unchanged.

Parameters:

  • goals goals to activate

Throws:

  • NullParameterError if a mandatory parameter is not specified
  • FinishedProcessInstanceError if the process instance of a goal is finished
active() : StringDEPRECATED
Returns a string representing "Active" state. Deprecated. Replaced by constant ACTIVE.
alive() : StringDEPRECATED
Returns a string representing "Alive" state. Deprecated. Replaced by constant ALIVE.
deactivate(goals : Collection<Goal>) : voidSIDE EFFECT

Deactivates not finished goals. If a goal from the collection is finished or its goal’s process is finished, the goal status remains unchanged.

Parameters:

  • goals goals to deactivate

Throws:

  • NullParameterError if a mandatory parameter is not specified
deactivated() : StringDEPRECATED
Returns a string representing "Deactivated" state. Deprecated. Replaced by constant DEACTIVATED.
failed() : StringDEPRECATED
Returns a string representing "Failed" state. Deprecated. Replaced by constant FAILED.
finished() : StringDEPRECATED
Returns a string representing "Finished" state. Deprecated. Replaced by constant FINISHED.
getAllSubGoals(goal* : Goal) : Set<AchieveGoal>

Returns the set of all sub-achieve goals into which the specified goal is directly or indirectly decomposed.

getAllSubGoals(TripArranged)

Parameters:

  • goal input achieve goal
getSubGoals(goal* : Goal) : Set<AchieveGoal>

Returns the set of all direct sub-achieve goals into which the specified goal is decomposed.

getSubGoals(TripArranged)

Parameters:

  • goal goal
inactive() : StringDEPRECATED
Returns a string representing "Inactive" state. Deprecated. Replaced by constant INACTIVE.
isInState(goalPlan* : GoalPlan, state : String) : Boolean

Returns true if the goal or the plan defined by the goalPlan parameter is in the specified state or a sub-state of the state. If the goalPlan parameter is specified correctly but the state parameter contains an incorrect string representation of a state or is null, the function returns false.

Goal2.isInState(READY)

Parameters:

  • goalPlan goal or plan to check the state of
  • state state

Throws:

  • NullParameterError if a mandatory parameter is not specified
notFinished() : StringDEPRECATED
Returns a string representing "Not finished" state. Deprecated. Replaced by constant NOT_FINISHED.
ready() : StringDEPRECATED
Returns a string representing "Ready" state. Deprecated. Replaced by constant READY.
running() : StringDEPRECATED
Returns a string representing "Running" state. Deprecated. Replaced by constant RUNNING.

Type

getIndexType(mapType* : Type<Map<K, V>>) : Type<K>DEPRECATED

Returns the key type of the given map type. Deprecated. Use getKeyType(Type<Map<K,V>>) instead.

Parameters:

  • mapType input map type

Throws:

  • NullParameterError if a mandatory parameter is null
getItemType(collectionType* : Type<Collection<E>>) : Type<E>

Returns the item type of the given collection type.

getItemType(getType([1,2,3])),2}]))
//returns Set<Integer>

Parameters:

  • collectionType collection type

Throws:

  • NullParameterError if a mandatory parameter is null
getItemType(mapType* : Type<Map<K, V>>) : Type<V>DEPRECATED

Returns the value type of the given map type. Deprecated. Use getValueType(Type<Map<K,V>>) instead.

Parameters:

  • mapType input map type

Throws:

  • NullParameterError if a mandatory parameter is null
getKeyType(mapType* : Type<Map<K, V>>) : Type<K>

Returns the key type of the given map type.

getKeyType(getType([now()-> 1, now() -> "a"]))
//returns Date

Parameters:

  • mapType input map type

Throws:

  • NullParameterError if a mandatory parameter is null
getReferencedType(referenceType* : Type<Reference<E>>) : Type<E>

Returns the referenced type of the given reference type.

def Integer i;
getReferencedType(typeOf(&i))
//returns Integer

Parameters:

  • referenceType

Throws:

  • NullParameterError if a mandatory parameter is null
getSupertype(recordType* : Type<Record>) : Type<Object>

Returns the supertype of the given record type.

Throws: -"NullParameterError" - Mandatory parameter is null.

Parameters:

  • recordType
getValueType(mapType* : Type<Map<K, V>>) : Type<V>

Returns the value type of the given map type.

getValueType(typeOf([1 -> "a"]))
//returns String

Parameters:

  • mapType input map type

Throws:

  • NullParameterError if a mandatory parameter is null
toType(string* : String) : Type<Object>

If possible, parses the specified string to a type. If the given string does not represent a valid type, the function throws an error. <pre>toType("{Integer:Integer}"); //returns {Integer:Integer}

Parameters:

  • string

Throws:

  • NullParameterError if a mandatory parameter is not specified.
  • InvalidTypeError if the string does not represent a valid type.

Number

abs(number* : Decimal) : Decimal

Returns the absolute value of the number.

abs(-3.1) //returns 3.1

Parameters:

  • number decimal number

Throws:

  • NullParameterError if a mandatory parameter is not specified
abs(number* : Integer) : Integer

Returns the absolute value of the number.

abs(-42) //returns 42

Parameters:

  • number integer

Throws:

  • NullParameterError if a mandatory parameter is not specified
max(numbers* : Decimal...) : Decimal

Returns the greatest number from the listed decimals.

max(1.0, -22.4, 188, 0, 2E+5) //returns 200000

Parameters:

  • numbers decimals

Throws:

  • NullParameterError if a mandatory parameter is not specified
max(numbers* : Integer...) : Integer

Returns the greatest number from the listed integers.

max(1, -22, 188, 0) //returns 188

Parameters:

  • numbers integers

Throws:

  • NullParameterError if a mandatory parameter is not specified
min(numbers* : Decimal...) : Decimal

Returns the smallest number from the listed decimals.

min(1.1, 2, -3.55) //returns -3.55

Parameters:

  • numbers list of decimals

Throws:

  • NullParameterError if a mandatory parameter is not specified
min(numbers* : Integer...) : Integer

Returns the smallest number from the listed integers.

min(1, 2, -3) //returns -3

Parameters:

  • numbers integers

Throws:

  • NullParameterError if a mandatory parameter is not specified
random() : Decimal
Returns a pseudorandom, uniformly distributed decimal value between 0.0 (inclusive) and 1.0 (exclusive).
random(upperBound* : Integer) : Integer

Returns a pseudorandom, uniformly distributed integer between 0 (inclusive) and the specified upperBound (exclusive).

random(10)

Parameters:

  • upperBound

Throws:

  • NullParameterError if a mandatory parameter is not specified
roundCeiling(number* : Decimal) : Integer

Returns rounding of the specified number towards positive infinity. If the number is positive, rounds up; if the number is negative, rounds down. It does not decrease the number value.

roundCeiling(5.5);//returns 6
roundCeiling(-5.5)//returns -5

Parameters:

  • number input decimal

Throws:

  • NullParameterError if a mandatory parameter is not specified
roundDown(number* : Decimal) : Integer

Returns rounding of the specified number towards zero. It never increases the magnitude of the number.

roundDown(5.5); //returns 5
roundDown(1.6); //returns 1
roundDown(-1.1) //returns -1

Parameters:

  • number input decimal

Throws:

  • NullParameterError if a mandatory parameter is not specified
roundFloor(number* : Decimal) : Integer

Returns rounding of the specified number towards negative infinity. If the number is positive, rounds down. If the number is negative, rounds up.

roundFloor(5.55);//returns 5
roundFloor(-5.55)//returns -6

Parameters:

  • number input decimal

Throws:

  • NullParameterError if a mandatory parameter is not specified
roundHalfDown(number* : Decimal) : Integer

Returns rounding of the specified number towards the "closest neighbor"; if both neighbors are equidistant, rounds down.

roundHalfDown(5.4); //returns 5
roundHalfDown(5.5); //returns 5
roundHalfDown(-5.6); //returns -6
roundHalfDown(-5.4); //returns -5
roundHalfDown(-5.5); //returns -5

Parameters:

  • number input decimal

Throws:

  • NullParameterError if a mandatory parameter is not specified
roundHalfEven(number* : Decimal) : Integer

Returns rounding of the specified number towards the "closest neighbor"; if both neighbors are equidistant, rounds towards the even neighbor.

roundHalfEven(4.5); //returns 4
roundHalfEven(5.5); //returns 6
roundHalfEven(-5.5); //returns -6
roundHalfEven(-6.5); //returns -6

Parameters:

  • number input decimal

Throws:

  • NullParameterError if a mandatory parameter is not specified
roundHalfUp(number* : Decimal) : Integer

Returns rounding of the number towards the "closest neighbor"; if both neighbors are equidistant, it rounds up.

roundHalfUp(5.4); //returns 5
roundHalfUp(5.5); //returns 6
roundHalfUp(-5.6); //returns -6
roundHalfUp(-5.4); //returns -5
roundHalfUp(-5.5) //returns -6

Parameters:

  • number input decimal

Throws:

  • NullParameterError if a mandatory parameter is not specified
roundUp(number* : Decimal) : Integer

Returns rounding of the specified number away from zero; it never decreases the magnitude of the number.

roundUp(2.5) ;//returns 3
roundUp(-1.1) //returns -2

Parameters:

  • number input decimal number

Throws:

  • NullParameterError if a mandatory parameter is not specified
scale(number* : Decimal) : Integer

Returns the scale, the number of decimal places, of the number.

scale(2.53)//returns 2

Parameters:

  • number input decimal

Throws:

  • NullParameterError if a mandatory parameter is not specified
setScale(number* : Decimal, scale* : Integer, roundingMode* : {Decimal : Integer}) : Decimal

Returns a decimal with the specified scale, and the unscaled value of which is determined by multiplying or dividing the unscaled value of the number by the appropriate power of ten to maintain its overall value. If the scale is reduced by the operation, the unscaled value must be divided and the specified roundingMode is applied to the division. Formally, it can be expressed as roundingMode(number * (10 ** scale)) / (10** scale).

Parameters:

  • number
  • scale
  • roundingMode

Throws:

  • NullParameterError if a mandatory parameter is not specified

Model

createModelInstance(synchronous* : Boolean, model* : Model, properties : Map<String, String>) : ModelInstanceSIDE EFFECT

Finds the specified model and starts a new instance of the specified model with the initialization properties, and returns the new model instance. If synchronous is set to true, the call waits until the new model instance becomes "started", that is, its first transaction is executed sucessfully. If this does not occur, the transaction is rolled back. If synchronous is false, the execution continues when the model instance becomes "created". Note that in the case of a roll-back, the data of the new model instance is deleted. It is recommended to set synchronous to true when calling from documents and to false when calling from processes.

createModelInstance(
 synchronous -> false,
 model -> getModel("registration","1.0"),
 properties-> ["Triggered by" -> thisModelInstance().id.toString()]
)

Parameters:

  • synchronous whether the containing expression waits for the created model instance
  • model model of the created model instance
  • properties properties of the created model instance

Throws:

  • NullParameterError if a mandatory parameter is null
  • ModelInstantiationError if the model instance did not start due to an internal initiation error
  • ModelInterpretationError if the model instance did not start due to an internal model interpretation (startup) error
createModelInstance(synchronous* : Boolean, model* : Model, processEntity* : Record, properties : Map<String, String>) : ModelInstanceSIDE EFFECT

Finds the specified model and starts a new instance of the specified model with the initialization properties and the process entity, and returns the new model instance. If synchronous is set to true, the call waits until the new model instance becomes "started", that is, its first transaction is executed sucessfully. If this does not occur, the transaction is rolled back. If synchronous is false, the execution continues when the model instance becomes "created". Note that in the case of a roll-back, the data of the new model instance is deleted. It is recommended to set synchronous to true when calling from documents and to false when calling from processes. The process entity must be a shared record: the string representation of its primary key is added to the initialization properties.

Parameters:

  • synchronous whether the containing expression waits for the model instance to be created
  • model model of the created model instance
  • processEntity shared record which is the process entity
  • properties properties of the created model instance

Throws:

  • NullParameterError if a mandatory parameter is null
  • ModelInstantiationError if the model instance could not be created due to an internal initiation error
  • ModelInterpretationError if the model instance could not be created due to an internal model interpretation (startup) error
  • IncompatibleTypeError if the processEntity is not a shared record
findModelInstances(model : String, version : String, isRunning : Boolean, properties : Map<String, String>) : Set<ModelInstance>

Returns the set of model instances satisfying all specified criteria. All String parameters, including the properties parameter, support the following wildcards: "*" matching none or several characters, and "?" matching exactly one character. Any other character in patterns matches itself. The value of the isRunning parameter must match exactly. null specified as the pattern value matches any value of the model instance field and is equivalent to the "*" pattern.

findModelInstances(
   model -> "registration*",
   version -> "2.?",
   isRunning -> true, 
   properties -> null
)

Parameters:

  • model underlying model
  • version version of the underlying model
  • isRunning whether to return only running instances
  • properties properties the model instances must have
findModels(name : String, version : String, latestOnly : Boolean) : Set<Model>

Returns a set of uploaded models satisfying the specified filtering criteria. All Strings parameters support the following wildcards: "*" matching none or several characters, and "?" matching exactly one character. Any other character in patterns matches itself. The value of the isRunning parameter must match exactly. null specified as the pattern value matches any value of the model and is equivalent to the "*" pattern. When the latestOnly parameter is true, only the most recently uploaded models with the given name and version are returned if multiple models with the same name and version are stored on the server. When set to false, the returned set can contain several models with the same name and version.

findModels("registration", "1.0", false)

Parameters:

  • name model name
  • version model version
  • latestOnly whether to return only the last uploaded model in the version
findProcessInstances(filter : {ProcessInstance : Boolean}) : Set<ProcessInstance>

Returns the set of process instances of the current model instance that satisfy the filter criteria. The filter criteria is specified as a Boolean closure with one ProcessInstance parameter. If the Boolean expression returns true for a process instance, the process instance is included in the resulting set. If filter is null, all process instances are returned.

findProcessInstances(filter -> {p:ProcessInstance -> p.process == "approval"})

Parameters:

  • filter filter closure

Throws:

  • NullParameterError if a mandatory parameter is not specified.
findProcessInstances(modelInstance : ModelInstance, filter : {ProcessInstance : Boolean}) : Set<ProcessInstance>

Returns the set of process instances generated by the model instance that satisfy the filter criteria. The filter criteria is specified as a Boolean closure with one ProcessInstance parameter. If the Boolean expression returns true for a process instance, the process instance is included in the resulting set. If filter is null, all process instances are returned.

WARNING: The execution of this function can be slow if accessing a model instance which is not loaded in memory.

findProcessInstances(
  modelInstance -> getModelInstance(8015), 
  filter -> {p:ProcessInstance -> p.process == "approval"}
)

Parameters:

  • modelInstance model instance
  • filter filter closure

Throws:

  • NullParameterError if mandatory parameters are not specified.
getModel(name* : String) : Model

Returns the model with the specified name. If multiple models with the same name and any version are uploaded on the server, the most recently uploaded model is returned. Unloaded models are ignored.

getModel("registration")

Parameters:

  • name string with model name

Throws:

  • NullParameterError if mandatory parameters are not specified.
  • ModelNotFoundError if there is no such a model.
getModel(name* : String, version* : String) : Model

Returns a model with the specified name and version. If multiple models with the same name and any version are uploaded on the server, the most recently uploaded model is returned.

getModel("registration", "2.3")

Parameters:

  • name string with model name
  • version string with version

Throws:

  • NullParameterError if mandatory parameters are not specified.
  • ModelNotFoundError if there is no such a model.
getModelInstance(id* : Decimal) : ModelInstance

Returns the model instance with the id.

getModelInstance(8013)

Parameters:

  • id id of the model instance

Throws:

  • NullParameterError if mandatory parameters are not specified.
  • ModelInstanceNotFoundError if there is no such a model instance.
getModelInstanceProperties(modelInstance* : ModelInstance) : Map<String, String>

Returns the map of initialization properties of the specified model instance.

getModelInstanceProperties(getModelInstance(8014))

Parameters:

  • modelInstance model instance

Throws:

  • NullParameterError if mandatory parameter is null.
getProcessEntity(type* : Type<T>) : T

Returns the process entity of the specified type of the model instance. Process entity information, a string representation of its primary key, is stored in the model instance properties. The expected type must be specified and must be the shared record type which was used to create the model instance. If the types do not match, the behavior is unspecified. See the createModelInstance(Boolean synchronous, Model model, Record processEntity, Map<String,String> properties).

getProcessEntity(RegistrationData)

Parameters:

  • type type of the process entity

Throws:

  • NullParameterError if a mandatory parameter is null
  • IncompatibleTypeError if type is not a shared record type
notifyModelInstance(modelInstanceId* : Decimal, reason : String, synchronously* : Boolean) : void

Invokes (wakes up) the model instance. The call is used, for example, when the data of the model instance were changed by an external service or by a direct change in the database. If synchronous, the notification call waits until the invocation of the model instance finishes.

Parameters:

  • modelInstanceId model instance to notify
  • reason log string
  • synchronously whether to execute synchronously

Throws:

  • ErrorException if fails, e.g. the model instance was not found, model instance state is invalid
sendSignal(synchronous* : Boolean, recipients* : Set<ModelInstance>, signal* : Object) : voidSIDE EFFECT

Sends the signal object to the specified recipients. If synchronous is set to true, the execution waits until the signal is received and processed by its recipients. If synchronous is set to false, the execution continues immediately.

sendSignal(true, {getModelInstance(8014)}, "Dispatch cancel")

Parameters:

  • synchronous whether the expression waits for signal processing to succeed
  • recipients target model instances
  • signal signal

Throws:

  • NullParameterError if a mandatory parameter is null
  • SendSignalError if sending or receiving of the signal was not successful
terminateModelInstance(modelInstance* : ModelInstance) : void

Terminates a running model instance which becomes finished.

//example task parameters:
modelInstance -> getModelInstance(25009)

Parameters:

  • modelInstance model instance

Throws:

  • NullParameterError if a mandatory parameter is not specified
thisModel() : Model
Returns the model of the context from which the function was executed.
thisModelInstance() : ModelInstance
Returns the model instance that executed the function. Returns null when executed from a document.
thisModelInstanceProperties() : Map<String, String>
Returns the map of the initialization properties of the model instance that executed the function. Returns null when executed from document. <pre>thisModelInstanceProperties() //returns ["InitiatorId"->"admin", "my key"->"my value"]
thisModelInstanceProperty(propertyName* : String) : String

Returns a value of the initialization property with the given name of the model instance that executed the function. Returns null if no property with the given name exists or if executed from a document.

thisModelInstanceProperty("InitiatorId")

Parameters:

  • propertyName property name

Throws:

  • NullParameterError if a mandatory parameter is not specified.
thisProcessInstance() : ProcessInstance
Returns the process instance that executed the function or null when the function is executed in the global context of a module or from a document.
throwEscalation(code* : String, payload : Object) : voidSIDE EFFECT

Throws an escalation signal with the specified code and payload. The escalation signal can be processed This function can be called only from an expression enclosed in a process that can handle the escalation. Otherwise, the calling of this function has no effect.

throwEscalation("Desk head", thisModelInstance())

Parameters:

  • code escalation code
  • payload escalation payload

Throws:

  • NullParameterError if a mandatory parameter is null

Date

*(duration : Duration, number : Decimal) : Duration

Multiplies each field of the duration by the specified number and rounds the value down, and returns the resulting duration.

(new Duration(minutes -> 2, seconds -> 1))*1.55
//returns core::Duration {hours=0, seconds=1, months=0, weeks=0, minutes=3, days=0, millis=0, years=0}

Parameters:

  • duration
  • number
*(number : Decimal, duration : Duration) : Duration

Multiplies each field of the duration by the specified number and rounds the value down, and returns the resulting duration.

1.7 * (new Duration(minutes -> 2, seconds -> 1))
 =//returns core::Duration {hours=0, seconds=1, months=0, weeks=0, minutes=3, days=0, millis=0, years=0}

Parameters:

  • number
  • duration
+(duration : Duration) : Duration

Unary minus operator which returns the duration.

+seconds(-2)
//returns core::Duration {hours=0, seconds=-2, months=0, weeks=0, minutes=0, days=0, millis=0, years=0}

Parameters:

  • duration duration
+(date : Date, duration : Duration) : Date

Adds the duration to the input date and returns the resulting date.

d'2018-06-07 00:00:00.000' + minutes(42)
//returns d'2018-06-07 00:42:00.000

Parameters:

  • date input date
  • duration duration to add to the date
+(date* : LocalDate, duration* : Duration) : LocalDate

Adds a duration to a given local date.

Parameters:

  • date
  • duration
+(duration : Duration, date : Date) : Date

Adds the date to the duration and returns the resulting date.

minutes(42)+d'2018-06-07 00:00:00.000'
// returns d'2018-06-07 00:42:00.000'

Parameters:

  • duration duration
  • date date
+(duration1 : Duration, duration2 : Duration) : Duration

Adds the values of the corresponding fields of duration1 and duration2, and returns the resulting duration.

seconds(100)+minutes(3)
//returns core::Duration {hours=0, seconds=100, months=0, weeks=0, minutes=3, days=0, millis=0, years=0}

Parameters:

  • duration1
  • duration2
-(duration : Duration) : Duration

Negates each field of the specified duration and returns the resulting duration.

-(seconds(10)+days(2))
 //returns core::Duration {hours=0, seconds=-10, months=0, weeks=0, minutes=0, days=-2, millis=0, years=0}

Parameters:

  • duration
-(date : Date, duration : Duration) : Date

Subtracts the duration from the date and returns the resulting date.

d'2018-06-07 00:00:42.000' - seconds(42)
//returns d'2018-06-07 00:00:00.000'

Parameters:

  • date
  • duration
-(date* : LocalDate, duration* : Duration) : LocalDate

Subtracts a duration from a given local date.

Parameters:

  • date
  • duration
-(date1 : Date, date2 : Date) : Duration

Subtracts date2 from date1 and returns the resulting duration. The duration abides by the maximum allowed values for individual fields; that is, 60 seconds are resolved as 1 minute. If date2 > date1, the resulting duration is negative, i.e., all its fields are negative.

d'2018-06-07 00:00:63.000' - d'2010-06-07 00:00:01.000'
 //result core::Duration {hours=0, seconds=2, months=0, weeks=0, minutes=1, days=0, millis=0, years=8}

Parameters:

  • date1
  • date2
-(date1* : LocalDate, date2* : LocalDate) : Duration

Returns a duration obtained by subtracting two dates.

Parameters:

  • date1
  • date2
-(duration1 : Duration, duration2 : Duration) : Duration

Subtracts each field of duration2 from the corresponding field of duration1 and returns thhe resutling duration.

(seconds(10)+minutes(1))-(minutes(2)+seconds(84))
 //returns core::Duration {hours=0, seconds=-74, months=0, weeks=0, minutes=-1, days=0, millis=0, years=0}

Parameters:

  • duration1
  • duration2
currentDate() : LocalDate
Returns the current local date in the time zone of the LSPS Server.
date(epochMillis* : Integer) : Date

Creates a date object and initializes it to represent the specified number of milliseconds since the standard base time known as "the epoch", which is January 1, 1970, 00:00:00 GMT.

date(42)
//returns d'1970-01-01 00:00:00.042'

Parameters:

  • epochMillis milliseconds to add to the epoch

Throws:

  • NullParameterError if a mandatory parameter is not specified
date(string* : String) : Date

Creates a date from the input string. The format of the input string is a subset of formats given by ISO 86011. It is possible to specify date with the format \<date\>, or time with the format T\<time\>, or to combine dates with times with the format \<date\>T\<time\>: The following formats of dates are allowed: yyyy, yyyy-MM, yyyy-MM-dd, yyyy-DDD, yyyy-Www, and yyyy-Www-e; where yyyy stands for the year, MM stands for the month (01-12), dd stands for the day in the month (01-31), DDD stands for the day in the year (001-365), ww stands for the week number and must be prefixed by the letter ‘W’ (W01-W53), and e stands for the day of the week (1-7). The following formats of time are allowed: HH, HH:mm, and HH:mm:ss; where HH stands for hour (00-23), mm stands for minutes (00-59), and ss stands for seconds (00-59). The following formats of time zones are allowed: \<time\>Z where ‘Z’ stands for UTC, \<time\>±HH, \<time\>±HH:mm, and \<time\>±HH:mm:ss. Decimal fractions, separated either by comma or by dot, may also be added to hours, minutes or seconds.

date("2100-12-18");
 //returns d'2100-12-18 00:00:00.000'
date("2100T13:10");
//returns d'2100-01-01 13:10:00.000'
date("2100T13:10Z");
//returns d'2100-01-01 13:10:00.000';
date("2100T13:10+02")
 //returns d'2100-01-01 11:10:00.000';
 date("2100T13:10.555+02")
//returns d'2100-01-01 11:10:33.300'

Parameters:

  • string input string with the date

Throws:

  • NullParameterError if mandatory parameters are not specified
  • FormatError if the string parameter does not conform to the specified format
  • OutOfBoundsError if the string parameter does not represent a correct date
date(string* : String, pattern* : String) : Date

Creates a date from the input string based on the format defined by the pattern parameter. The pattern defines the format as specified in the java.text.SimpleDateFormat Java class.

date("2100.07.04 AD at 12:08:56 PDT","yyyy.MM.dd G 'at' HH:mm:ss z");
//returns d'2100-07-04 19:08:56.000'
date("12:08 PM","h:mm a")
//returns d'1970-01-01 12:08:00.000'

Parameters:

  • string input string with date
  • pattern format used by the string date

Throws:

  • NullParameterError if mandatory parameter is not specified
  • FormatError if the pattern parameter does not conform to the specified format, or the string parameter does not conform to the pattern
  • OutOfBoundsError if the string parameter does not represent a correct date
date(string* : String, pattern* : String, locale : String) : Date

Creates a date from the specified string, which adheres to the format given by the pattern parameter. The pattern string uses the format defined in the java.text.SimpleDateFormat Java class. The function takes an optional locale parameter.

date("2100.07.04 AD at 12:08:56 PDT","yyyy.MM.dd G 'at' HH:mm:ss z", "en_US");
//returns d'2100-07-04 19:08:56.000'

Parameters:

  • string input string with the date
  • pattern format used by the string date
  • locale optional locale name, e.g. "de_AT"

Throws:

  • NullParameterError if mandatory parameter is not specified
  • FormatError if the pattern parameter does not conform to the specified format, or the string parameter does not conform to the pattern
  • OutOfBoundsError if the string parameter does not represent a correct date
date(year* : Integer, month* : Integer, dayOfMonth* : Integer) : Date

Creates a date from the values given by the parameters. The date is the sum of all parameter values; i.e., the number of years is added up with the number of months, and then with the number of days of a month. There are no limitations on parameter values: 0 refers to the item preceeding 1; for months, 1 designates January; hence 0 is the preceeding December.

date(year -> 1991, month -> 0, dayOfMonth -> 0 ); //returns d'1990-11-30 00:00:00.000' date(year -> 1991, month -> 155, dayOfMonth -> 42) //returns d'2003-12-12 00:00:00.000'

Parameters:

  • year year of the date
  • month month of the date
  • dayOfMonth day of the date month

Throws:

  • NullParameterError if a mandatory parameter is not specified
date(year* : Integer, month* : Integer, dayOfMonth* : Integer, hour* : Integer, minute* : Integer, second* : Integer, millis* : Integer) : Date

Creates a date from the values given by the parameters. The date is given as a sum of all parameter values; i.e., the number of years is added up with the number of months, then with the number of days of a month, then with the number of hours, etc. There are no limitations on parameter values, for example, 0 refers to the item preceeding 1; for months, 1 designates January; hence 0 is the preceeding December.

date(year -> 2030, month -> -2, dayOfMonth -> -13, hour -> 0, minute -> 0, second -> 0 , millis -> 42);
 //returns d'2029-09-16 23:00:00.042'
date(year -> 2030, month -> 12, dayOfMonth -> 13, hour -> 0, minute -> 0, second -> 0 , millis -> 42);
//returns d'2030-12-12 23:00:00.042'
date(year -> 2030, month -> 13, dayOfMonth -> 13, hour -> 0, minute -> 0, second -> 0 , millis -> 33333)
//returns d'2031-01-13 00:00:33.333'

Parameters:

  • year
  • month
  • dayOfMonth
  • hour
  • minute
  • second
  • millis

Throws:

  • NullParameterError if mandatory parameters are not specified.
days(number* : Integer) : Duration

Returns a duration with the specified number of days.

days(42)
//returns core::Duration {hours=0, seconds=0, months=0, weeks=0, minutes=0, days=42, millis=0, years=0}

Parameters:

  • number number of days

Throws:

  • NullParameterError if a mandatory parameter is not specified
format(date* : LocalDate, pattern* : String) : String

Returns a string created by formatting the date to the specified pattern. The pattern uses the syntax defined in the java.time.format.DateTimeFormatter class.

Parameters:

  • date
  • pattern

Throws:

  • NullParameterError if a mandatory parameter are not specified
  • FormatError if the specified format is incorrect
formatDate(date* : Date, pattern* : String, timeZone : String) : String

Formats the date as a String in the specified pattern. The formatted date can also be transformed to a time zone given by the timeZone parameter. The pattern and timeZone parameters use the syntax defined by org.joda.time.format.DateTimeFormat.

formatDate(d'2030-12-12 23:00:00.042', "EEE MMM dd HH:mm:ss 'time zone offset: 'Z yyyy", "GMT");
 //returns "Thu Dec 12 23:00:00 time zone offset: +0000 2030"
formatDate(d'330-12-12 15:10:00.042', "EEE MMM dd G h:mm a Z", null)
//retuns "Sat Dec 13 AD 3:19 PM +0009"

Parameters:

  • date input date
  • pattern target pattern of the output string
  • timeZone time zone of the input date

Throws:

  • NullParameterError if a mandatory parameter are not specified
  • FormatError if the specified format or timeZone is incorrect
formatDate(date* : Date, pattern* : String, timeZone : String, locale : String) : String

Formats the date as a String in the specified pattern. The formatted date can also be transformed to a time zone given by the timeZone parameter. The pattern and timeZone parameters use the syntax defined by org.joda.time.format.DateTimeFormat. Additionaly, you can set the locale code in the locale parameter. If undefined or invalid, the default locale is used.

formatDate(d'2020-12-12 15:10:00.042', "EEE MMM dd G h:mm a Z", null, "fr_FR")
//returns "sam. déc. 12 ap. J.-C. 4:10 PM +0100"

Parameters:

  • date input date
  • pattern target pattern of the output string
  • timeZone time zone of the input date
  • locale optional locale name, e.g. "de_AT"

Throws:

  • NullParameterError if a mandatory parameter are not specified
  • FormatError if the specified format or timeZone is incorrect
getDayOfMonth(date* : Date) : Integer

Returns the day of the month of the input date.

getDayOfMonth(d'2012-30-12 09:48:00.042')
 //returns 12

Parameters:

  • date input date

Throws:

  • NullParameterError if a mandatory parameter is not specified
getDayOfMonth(date* : LocalDate) : Integer

Returns the day of the month of the specified local date.

Parameters:

  • date

Throws:

  • NullParameterError if a mandatory parameter is not specified
getDayOfWeek(date* : Date) : Integer

Returns the day of the week of the input date as an Integer where 1 is Monday and 7 is Sunday.

getDayOfMonth(d'2012-30-12 09:48:00.042')
 //returns 12

Parameters:

  • date input date

Throws:

  • NullParameterError if a mandatory parameter is not specified
getDayOfWeek(date* : LocalDate) : Integer

Returns the day of the week of the specified local date.

Parameters:

  • date

Throws:

  • NullParameterError if a mandatory parameter is not specified
getDayOfYear(date* : Date) : Integer

Returns the day of the year of the input date.

getDayOfYear(d'2020-1-1 09:48:00.042');
 //returns 1
 getDayOfYear(d'2013-12-31 09:48:00.042')
 //returns 365 

Parameters:

  • date input date

Throws:

  • NullParameterError if a mandatory parameter is not specified
getDayOfYear(date* : LocalDate) : Integer

Returns the day of the year of the specified local date.

Parameters:

  • date

Throws:

  • NullParameterError if a mandatory parameter is not specified
getEpochDay(date* : LocalDate) : Integer

Returns the epoch day of the specified local date.

Parameters:

  • date

Throws:

  • NullParameterError if a mandatory parameter is not specified
getEpochMillis(date* : Date) : Integer

Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by the input date.

getEpochMillis(d'2013-12-31 09:48:00.042')
//returns 1388483280042

Parameters:

  • date input date

Throws:

  • NullParameterError if a mandatory parameter is not specified
getHour(date* : Date) : Integer

Returns the hour of the day of the input date.

getHour(d'2013-12-31 09:06:00.042')
 //returns 10

Parameters:

  • date input date

Throws:

  • NullParameterError if a mandatory parameter is not specified
getMillis(date* : Date) : Integer

Returns the millisecond of the second of the input date.

getMillis(d'2013-12-31 09:48:00.042')
 //returns 42

Parameters:

  • date input date

Throws:

  • NullParameterError if a mandatory parameter is not specified
getMinute(date* : Date) : Integer

Returns the minute of the hour of the input date.

getMinute(d'2029-09-16 23:02:53.7000');
//returns 3
getMinute(d'2029-09-16 23:02:52.7000');
//returns 2
getMinute(d'2029-09-16 23:02:544.7000');
 //returns 11

Parameters:

  • date input date

Throws:

  • NullParameterError if mandatory parameters are not specified
getMonth(date* : Date) : Integer

Returns the month of the year of the specified date. <pre>getMonth(d'2029-09-16 23:00:56.7000') //returns 9<pre>

Parameters:

  • date input date

Throws:

  • NullParameterError if mandatory parameters are not specified
getMonth(date* : LocalDate) : Integer

Returns the month of the year of the specified local date.

Parameters:

  • date

Throws:

  • NullParameterError if mandatory parameters are not specified
getSecond(date* : Date) : Integer

Returns the second of the current minute of the input date.

getSecond(d'2029-09-16 23:00:56.700')
//returns 56

Parameters:

  • date input date

Throws:

  • NullParameterError if a mandatory parameter is not specified
getWeek(date* : Date) : Integer

Returns the week of the current year of the input date.

getWeek(date("2025-03-14"))
 //returns 11

Parameters:

  • date input date

Throws:

  • NullParameterError if a mandatory parameter is not specified
getYear(date* : Date) : Integer

Returns the year of the input date.

getYear(date(0))
 //returns 1970

Parameters:

  • date input date

Throws:

  • NullParameterError if a mandatory parameter is not specified
getYear(date* : LocalDate) : Integer

Returns the year of the specified local date.

Parameters:

  • date

Throws:

  • NullParameterError if a mandatory parameter is not specified
hours(number* : Integer) : Duration

Returns a duration with the specified number of hours.

hours(25)
//returns core::Duration {hours=25, seconds=0, months=0, weeks=0, minutes=0, days=0, millis=0, years=0}

Parameters:

  • number number of hours

Throws:

  • NullParameterError if a mandatory parameter is not specified
intervalInDays(date1* : Date, date2* : Date) : Integer

Returns the number of days between the date. If date1 > date2, the resulting number is negative.

intervalInDays(date("2030-3-2"), date("2032-3-1"))
//returns 730

Parameters:

  • date1 start date for the day interval
  • date2 end date of the day interval

Throws:

  • NullParameterError if a mandatory parameter is not specified
intervalInHours(date1* : Date, date2* : Date) : Integer

Returns the number of hours between the dates. If date1 > date2, the resulting number is negative.

intervalInHours(date("2030-3-2"), date("2032-3-1"))
 //returns 17520

Parameters:

  • date1 start date for the hour interval
  • date2 end date of the hour interval

Throws:

  • NullParameterError if a mandatory parameter is not specified
intervalInMillis(date1* : Date, date2* : Date) : Integer

Returns the number of milliseconds between the dates. If date1 > date2, the resulting number is negative.

intervalInMillis(date("2030-3-2"), date("2030-3-3"))
 //returns 86400000

Parameters:

  • date1 start date for the millisecond interval
  • date2 end date of the millisecond interval

Throws:

  • NullParameterError if a mandatory parameter is not specified
intervalInMinutes(date1* : Date, date2* : Date) : Integer

Returns the number of minutes between the dates. If date1 > date2, the resulting number is negative.

intervalInMinutes(date("2030-3-2"), date("2032-3-1"))
//returns 1051200

Parameters:

  • date1 start date for the minute interval
  • date2 end date of the minute interval

Throws:

  • NullParameterError if a mandatory parameter is not specified
intervalInMonths(date1* : Date, date2* : Date) : Integer

Returns the number of months between the dates. If date1 > date2, the resulting number is negative.

intervalInMonths(date("2030-3-2"), date("2032-3-1"))
//returns 23

Parameters:

  • date1 start date for the months interval
  • date2 end date of the months interval

Throws:

  • NullParameterError if a mandatory parameter is not specified
intervalInSeconds(date1* : Date, date2* : Date) : Integer

Returns the number of seconds between the dates. If date1 > date2, the resulting number is negative.

intervalInSeconds(date("2030-3-2"), date("2032-3-1"))
//returns 63072000

Parameters:

  • date1 start date for the seconds interval
  • date2 end date of the seconds interval

Throws:

  • NullParameterError if a mandatory parameter is not specified
intervalInWeeks(date1* : Date, date2* : Date) : Integer

Returns the number of weeks between the dates. If date1 > date2, the resulting number is negative.

intervalInWeeks(date("2030-3-2"), date("2032-3-2"))
 //returns 104

Parameters:

  • date1 start date for the week interval
  • date2 end date of the week interval

Throws:

  • NullParameterError if a mandatory parameter is not specified
intervalInYears(date1* : Date, date2* : Date) : Integer

Returns the number of years between the dates. If date1 > date2, the resulting number is negative.

intervalInYears(date("2030-3-2"), date("2032-3-1"))
 //returns  1

Parameters:

  • date1 start date for the year interval
  • date2 end date of the year interval

Throws:

  • NullParameterError if a mandatory parameter is not specified
localDate(epochDay* : Integer) : LocalDate

Creates a local date from the specified epochDay. The epoch day is a simple incrementing count of days where day 0 is 1970-01-01. Negative numbers represent earlier days.

Parameters:

  • epochDay

Throws:

  • NullParameterError if mandatory parameters are not specified
  • OutOfBoundsError if the value of epochDay is out of range
localDate(string* : String) : LocalDate

Creates a local date from the specified string. The format of the input string is yyyy-MM-dd (ISO 8601).

Parameters:

  • string

Throws:

  • NullParameterError if mandatory parameters are not specified
  • FormatError if the string parameter does not conform to the specified format
localDate(year* : Integer, month* : Integer, dayOfMonth* : Integer) : LocalDate

Creates a local date from the values given by the following parameters: year, month (month of year), and dayOfMonth. year must be between -999,999,999 and +999,999,999, month must be between 1 and 12, day must be between 1 and 31 (depends on the month).

Parameters:

  • year
  • month
  • dayOfMonth

Throws:

  • NullParameterError if a mandatory parameter is not specified
  • OutOfBoundsError if the value of any field is out of range
max(dates* : Date...) : Date

Returns the latest date from the input dates.

max(date("2100-12-18"), now(), date("1990-12-18"))
//returns d'2100-12-17 23:00:00.000'

Parameters:

  • dates input dates

Throws:

  • NullParameterError if a mandatory parameter is not specified
max(dates* : LocalDate...) : LocalDate

Returns the maximal date from a list of local dates.

Parameters:

  • dates

Throws:

  • NullParameterError if a mandatory parameter is not specified
millis(number* : Integer) : Duration

Returns a duration with the specified number of milliseconds.

millis(120)
//returns core::Duration {hours=0, seconds=0, months=0, weeks=0, minutes=0, days=0, millis=120, years=0}

Parameters:

  • number number of miliseconds

Throws:

  • NullParameterError if a mandatory parameter is not specified
min(dates* : Date...) : Date

Returns the soonest date from the input dates.

min(date("2100-12-18"), now(), date("1990-12-18"))
//returns d'1990-12-17 23:00:00.000'

Parameters:

  • dates input dates

Throws:

  • NullParameterError if a mandatory parameter is not specified
min(dates* : LocalDate...) : LocalDate

Returns the minimal date from a list of local dates.

Parameters:

  • dates

Throws:

  • NullParameterError if a mandatory parameter is not specified
minutes(number* : Integer) : Duration

Returns a duration with the specified number of minutes.

minutes(64)
 //returns core::Duration {hours=0, seconds=0, months=0, weeks=0, minutes=64, days=0, millis=0, years=0}

Parameters:

  • number number of minutes

Throws:

  • NullParameterError if a mandatory parameter is not specified
months(number* : Integer) : Duration

Returns a duration with the specified number of months.

months(15)
//returns core::Duration {hours=0, seconds=0, months=15, weeks=0, minutes=0, days=0, millis=0, years=0}

Parameters:

  • number number of months

Throws:

  • NullParameterError if a mandatory parameter is not specified
now() : Date

Returns the current date and time.

now()
//returns d'2018-06-08 09:36:14.015'

seconds(number* : Integer) : Duration

Returns a duration with the specified number of seconds.

seconds(64)
//returns core::Duration {hours=0, seconds=64, months=0, weeks=0, minutes=0, days=0, millis=0, years=0}

Parameters:

  • number number of seconds

Throws:

  • NullParameterError if a mandatory parameter is not specified
setDate(date* : Date, year* : Integer, month* : Integer, dayOfMonth* : Integer) : Date

Changes the fields of the input date according to the values of the Integer parameters and returns the resulting date. The value must fall into valid ranges. The dayOfMonth must be in the correct range, that is from 1 to the last day of the given month in the year.

setDate(date("2030-1-1"), 2040, 2, 28)
 //results d'2040-02-28 00:00:00.000'

Parameters:

  • date input day
  • year required year value
  • month required month value
  • dayOfMonth required day of month value

Throws:

  • NullParameterError if a mandatory parameter is not specified
  • OutOfBoundsError if any of the parameters is out of range
setDayOfMonth(date* : Date, dayOfMonth* : Integer) : Date

Changes the day field to point to the day of month defined by the dayOfMonth parameter value and returns the resulting date. The dayOfMonth must be in the correct range, that is from 1 to the last day of the given month in the year.

setDayOfMonth(date -> date(0), dayOfMonth -> 13)
//returns d'1970-01-13 00:00:00.000'
//date(0) resolves to d'1970-01-01 00:00:00.000'

Parameters:

  • date input date
  • dayOfMonth required date of month

Throws:

  • NullParameterError if a mandatory parameter is not specified
  • OutOfBoundsError if the specified dayOfMonth is out of range
setDayOfWeek(date* : Date, dayOfWeek* : Integer) : Date

Changes the day and month fields to point to the closes day of week defined by the dayOfWeek parameter value and returns the resulting date.

setDayOfWeek(date -> date(0), dayOfWeek -> 2);
//results in the closes Tuesday: d'1969-12-30 00:00:00.000'

Parameters:

  • date input date
  • dayOfWeek required day of week

Throws:

  • NullParameterError if a mandatory parameter is not specified
  • OutOfBoundsError if the specified dayOfWeek is out of range (dayOfWeek < 1 or dayOfWeek > 7)
setDayOfYear(date* : Date, dayOfYear* : Integer) : Date

Changes the day and month fields of the input date to correspond to the dayOfYear parameter value and returns the resulting date.

setDayOfYear(date -> date(0), dayOfYear -> 33)
 //returns d'1970-02-02 00:00:00.000'

Parameters:

  • date input date
  • dayOfYear new day of year value

Throws:

  • NullParameterError if a mandatory parameter is not specified
  • OutOfBoundsError if the specified dayOfYear is out of range (dayOfYear < 1 or dayOfYear > 365 or 366, depending on the year)
setHour(date* : Date, hour* : Integer) : Date

Changes the hour field of the input date to the hour parameter value and returns the resulting date.

setHour(date -> date(0), hour -> 10)
 = d'1970-01-01 10:00:00.000'

Parameters:

  • date input date
  • hour new hour field value

Throws:

  • NullParameterError if a mandatory parameter is not specified
  • OutOfBoundsError if the specified hour is out of range (hour < 0 or hour > 23)
setMillis(date* : Date, millis* : Integer) : Date

Changes the milliseconds field of the input date to the millis parameter value and returns the resulting date.

setMillis(date-> d'2100-11-01 10:10:10.111', millis -> 42)
//returns d'2100-11-01 10:10:10.042'

Parameters:

  • date input date
  • millis new millis field value

Throws:

  • NullParameterError if a mandatory parameter is not specified
  • OutOfBoundsError if the specified smillis is out of range (millis < 0 or millis > 999)
setMinute(date* : Date, minute* : Integer) : Date

Changes the minute field of the input date to the minute parameter value and returns the resulting date.

setMinute(date-> d'2100-11-01 12:12:13.000', minute -> 42)
 //returns d'2100-11-01 12:42:13.000'

Parameters:

  • date input date
  • minute new minute field value

Throws:

  • NullParameterError if a mandatory parameter is not specified
  • OutOfBoundsError if the specified minute is out of range (minute < 0 or minute > 59)
setMonth(date* : Date, month* : Integer) : Date

Changes the month field of the input date to the month parameter value and returns the resulting date.

setMonth(date-> d'2100-11-01 12:10:13.000', month -> 2)
 //returns d'2100-02-01 12:10:13.000'

Parameters:

  • date input date
  • month new month field value

Throws:

  • NullParameterError if a mandatory parameter is not specified
  • OutOfBoundsError if the specified month is out of range (month < 1 or month > 12)
setSecond(date* : Date, second* : Integer) : Date

Changes the second field of the input date to the second parameter value and returns the resulting date.

setSecond(date-> d'2100-01-01 12:10:13.000', second -> 42)
 //returns d'2100-01-01 12:10:42.000'

Parameters:

  • date input date
  • second new second field value

Throws:

  • NullParameterError if a mandatory parameter is not specified
  • OutOfBoundsError if the specified second is out of range (second < 0 or second > 59)
setTime(date* : Date, hour* : Integer, minute* : Integer, second* : Integer, millis* : Integer) : Date

Changes the time fields of the input date to the values of the parameters and returns the resulting date. Parameters defining the time must not exceed their ranges: 0 =< hour < 23; 0 =< minute < 0 or minute > 59 or second < 0 or second > 59 or millis < 0 or millis > 999)

setTime(date -> d'2100-01-01 12:10:00.000', hour -> 20, minute -> 33, second -> 12, millis -> 200)
 //returns d'2100-01-01 19:33:12.200'

Parameters:

  • date input date
  • hour new hour field value
  • minute new minute field value
  • second new second field value
  • millis new millisecond field value

Throws:

  • NullParameterError if a mandatory parameter is not specified
  • OutOfBoundsError if any of the parameters is out of range
setWeek(date* : Date, week* : Integer) : Date

Changes the week field of the year of the input date to the week parameter value and returns the resulting date.

setWeek(date("2035-1-15"), 12)
//returns d'2035-03-19 00:00:00.000'

Parameters:

  • date input date
  • week new week field value

Throws:

  • NullParameterError if a mandatory parameter is not specified
  • OutOfBoundsError if the specified week is out of range (week < 1 or week > 52)
setYear(date* : Date, year* : Integer) : Date

Changes the year field of the input date to the year parameter value and returns the resulting date.

setYear(date->now(), year-> 2100)
 //returns d'2100-06-08 12:54:46.141'

Parameters:

  • date input date
  • year new year field value

Throws:

  • NullParameterError if a mandatory parameter is not specified
toDate(localDate* : LocalDate) : Date

Returns the date of this local date at start of day. The system default time-zone is used for the conversion.

Parameters:

  • localDate

Throws:

  • NullParameterError if a mandatory parameter is not specified
toLocalDate(date* : Date) : LocalDate

Returns the local date of this date. The system default time-zone is used for the conversion.

Parameters:

  • date

Throws:

  • NullParameterError if a mandatory parameter is not specified
today() : Date

Returns the current date with the time set to midnight in the time zone of the LSPS Server (by default UTC).

today()
//returns d'2018-06-07 22:00:00.000'

weeks(number* : Integer) : Duration

Returns a duration with the specified number of weeks.

weeks(12)
 //returns core::Duration {hours=0, seconds=0, months=0, weeks=12, minutes=0, days=0, millis=0, years=0}

Parameters:

  • number number of weeks

Throws:

  • NullParameterError if a mandatory parameter is not specified
years(number* : Integer) : Duration

Returns a duration with the specified number of years.

years(35)
 //returns core::Duration {hours=0, seconds=0, months=0, weeks=0, minutes=0, days=0, millis=0, years=35}

Parameters:

  • number number of years

Throws:

  • NullParameterError if a mandatory parameter is not specified

Restart

clearApplicationRestartData() : void
Clears the information about previous application restart.
explicitFinishing() : void
Specifies that the current model instance starting is finished explicitly, by calling the modelInstanceStartSucceeded() function.
getStartStatus(modelInstance : ModelInstance) : ModelInstanceStartStatus

Returns the starting status of the given model instance. If the modelInstance parameter is is null, the current model instance is used.

Parameters:

  • modelInstance model instance
getStartStatuses(modelInstances* : Set<ModelInstance>) : Map<ModelInstance, ModelInstanceStartStatus>

Returns map of starting statuses for given model instances. If the modelInstances parameter is is null, statuses for all currently monitored instances are returned.

Parameters:

  • modelInstances list of model instances
modelInstanceStartSucceeded() : void
Tells that the model instance starting succeded.
setCountOfModelInstancesToStart(count* : Integer) : void

Sets the number of model instances to be restarted. It can be set in advance of the actual model instance restarting.

Parameters:

  • count count of model instances to start
watchStarting(modelInstance : ModelInstance) : void

Adds the model instance to a list of started model instances. If the modelInstance parameter is is null, the current model instance is used.

Parameters:

  • modelInstance model instance to watch

Record

createInstance(recordType : Type<T>, properties : Map<String, Object>) : T

Creates and returns a new instance of the specified record type. If the properties are specified, the instance is initialized with the specified values of properties.

createInstance(RegistrationData, [ "approved" -> false ])

Parameters:

  • recordType record type
  • properties map with properties

Throws:

  • NullParameterError if a mandatory parameter is not specified
  • IncompatibleTypeError if the specified properties do not belong to the specified record type
deleteRecords(records* : Record...) : voidSIDE EFFECT

Deletes the specified records and their related data links navigable from the records. Works for shared and for non-shared records. Values of the deleted records in all slots (variables, function or task call parameters, etc.) referring to the records become null.

deleteRecords(persona1, persona2, order1)

Parameters:

  • records records to delete

Throws:

  • NullParameterError if mandatory parameter is null
  • RecordNotFoundError if the records parameter contains a shared record with an incorrect reference to a database record
deleteRecords(records* : Collection<Record>) : voidSIDE EFFECT

Deletes the specified records and their related data links navigable from the records. Works for shared and for non-shared records. Values of the deleted records in all slots (variables, function or task call parameters, etc.) referring to the records become null. If the record is referred to from a collection or a key in a map, it is removed.

deleteRecords([persona1, persona2, order1])

Parameters:

  • records records to delete

Throws:

  • NullParameterError if mandatory parameter is null
  • RecordNotFoundError if the records parameter contains a shared record with an incorrect reference to a database record
flushAndRefresh(records : Record...) : void

Executes flush on all relevant sessions and refreshes (re-reads) from the database on the records. It is useful in the cases when the records might have been modified by custom objects or third-party systems.

Parameters:

  • records

Property

getProperties(type* : Type<Record>) : List<Property>

Returns all properties of the given record type.

Parameters:

  • type

Throws:

  • NullParameterError if a mandatory parameter is null
getProperty(type* : Type<Record>, name* : String) : Property

Returns the property of the given record type with the specified name, or null if the type has no such property.

Parameters:

  • type record with the property
  • name property name

Throws:

  • NullParameterError if a mandatory parameter is null
getPropertyMetadata(property* : Property) : Map<String, String>

Returns the property metadata.

Parameters:

  • property

Throws:

  • NullParameterError if a mandatory parameter is null
getPropertyName(property* : Property) : String

Returns the property name as a string.

Parameters:

  • property

Throws:

  • NullParameterError if a mandatory parameter is null
getPropertyNames(propertyPath* : PropertyPath) : List<String>

Returns the property names.

Parameters:

  • propertyPath

Throws:

  • NullParameterError if a mandatory parameter is null
getPropertyPathRecordType(propertyPath* : PropertyPath) : Type<Record>

Returns the property path record type. It is the record type where the given property path starts.

Parameters:

  • propertyPath

Throws:

  • NullParameterError if a mandatory parameter is null
getPropertyPathType(propertyPath* : PropertyPath) : Type<Object>

Returns the property path type (the type of the last property).

Parameters:

  • propertyPath

Throws:

  • NullParameterError if a mandatory parameter is null
getPropertyPathValue(record* : Record, propertyPath* : PropertyPath) : Object

Returns the value of the given property path of the given record object.

Parameters:

  • record
  • propertyPath

Throws:

  • NullParameterError if a mandatory parameter is null
  • IncompatibleTypeError if the record the the given property are not compatible
getPropertyRecordType(property* : Property) : Type<Record>

Returns the record type where the specified property is declared.

getPropertyRecordType(SubRecord.fieldInSuperRecord)
//returns SuperRecord

Parameters:

  • property

Throws:

  • NullParameterError if a mandatory parameter is null
getPropertyReference(reference* : Reference<Object>, properties* : Property...) : Reference<Object>

Returns the reference to the object defined by the last property parameter. The path to the object is resolved as a chain of associations starting in the reference parameter through the property parameters in specified order.

Parameters:

  • reference
  • properties

Throws:

  • NullParameterError if a mandatory parameter is null
  • IncompatibleTypeError if the given record and property are not compatible
getPropertyType(property* : Property) : Type<Object>

Returns the property type.

getPropertyType(Person.name) //returns String

Parameters:

  • property record property

Throws:

  • NullParameterError if a mandatory parameter is null
getPropertyValue(record* : Record, property* : Property) : Object

Returns the value of the given property of the given record object.

Parameters:

  • record
  • property

Throws:

  • NullParameterError if a mandatory parameter is null
  • IncompatibleTypeError if the record the the given property are not compatible
isAutogenerated(property* : Property) : Boolean

Returns true if the given property is autogenerated (usually a primary key from a sequence).

Throws: -"NullParameterError" if mandatory parameter is null.

Parameters:

  • property
isPrimaryKey(property* : Property) : Boolean

Returns true if the given property is a primary key of a shared record (or a part of composite primary key).

Throws: -"NullParameterError" if mandatory parameter is null.

Parameters:

  • property
isReadOnly(propertyPath* : PropertyPath) : Boolean

Returns true if the given property path is read only.

Throws: -"NullParameterError" if mandatory parameter is null.

Parameters:

  • propertyPath
isVersion(property* : Property) : Boolean

Returns true if the given property is a version field.

Throws: -"NullParameterError" if mandatory parameter is null.

Parameters:

  • property
setPropertyPathValue(record* : Record, propertyPath* : PropertyPath, value : Object) : voidSIDE EFFECT

Sets the value of the given property path of the given record object.

Parameters:

  • record
  • propertyPath
  • value

Throws:

  • NullParameterError if a mandatory parameter is null
  • IncompatibleTypeError if the record and the given property are not compatible
setPropertyValue(record* : Record, property* : Property, value : Object) : voidSIDE EFFECT

Sets the value of the given property of the given record object. Returns null.

Parameters:

  • record
  • property
  • value

Throws:

  • NullParameterError if a mandatory parameter is null
  • IncompatibleTypeError if the record and the given property are not compatible

Generic

cast(object : Object, objectType* : Type<E>) : E

If the type of the input object is compatible with the specified objectType, the function casts the object to the objectType.

cast(-1, Decimal);
 //returns -1
(-1.1).cast(Integer)
 //returns  IncompatibleTypeError

Parameters:

  • object input object
  • objectType target type

Throws:

  • NullParameterError if a mandatory parameter is not specified
  • IncompatibleTypeError if the type of the object is not compatible with the input objectTyp
clone(object : T) : TSIDE EFFECT

Creates and returns a shallow copy of a collection or a user-defined record (related records remain the same), or returns the object itself if it is of another type.

clone([[1,2,3],3, "a", date(0)]);
 //returns [[1,2,3],3,"a",d'1970-01-01 00:00:00.000']
 def Applicant john := new Applicant(name -> "John", surname -> "Doe", tutor -> new Tutor(name -> "Jane"));
clone(john);
//returns a new applicant with the same tutor:
// Applicant(id->7, name->"John", surname->"Doe", tutor->Tutor);
clone(Applicant)
//retuns myModule::Applicant

Parameters:

  • object
error(code* : String) : voidSIDE EFFECT

Throws an error with the specified code.

error("code red")
//returns null, error code: code red

Parameters:

  • code

Throws:

  • NullParameterError if a mandatory parameter is not specified
error(code* : String, message : String) : voidSIDE EFFECT

Throws an error with the code and a message.

error("code red", "This is really serious.")
//returns This is really serious., error code: code red

Parameters:

  • code error code
  • message error message

Throws:

  • NullParameterError if a mandatory parameter is not specified
getType(object : E) : Type<E>

Returns the type of the input object. Note that, unlike typeOf(), getType() is an extension method.

now.getType();
//returns { : Date}
now().getType()
//returns Date

Parameters:

  • object input object
isInstance(object : Object, objectType* : Type<Object>) : Boolean

Returns true if the input object is assignment-compatible with the objectType.

isInstance(1, Decimal);
 //returns true
(1.1).isInstance(Integer)
//returns false
isInstance(null, String);
//returns true

Parameters:

  • object input object
  • objectType check type

Throws:

  • NullParameterError if a mandatory parameter is not specified
isSubtype(subtype* : Type<Object>, supertype* : Type<Object>) : Boolean

Returns true if subtype is a subtype of supertype.

isSubtype(Decimal, Integer);
//returns false
isSubtype(Integer, Decimal);
//returns true
isSubtype(Null, Object)
//returns true

Parameters:

  • subtype subtype
  • supertype supertype

Throws:

  • NullParameterError if a mandatory parameter is not specified
isSubtypeOf(subtype* : Type<Object>, supertype* : Type<Object>) : Boolean

Returns true if subtype is a subtype of supertype. Note that, unlike isSubtype(), isSubtypeOf() is an extension method.

String.isSubtypeOf(Object)
//returns true

Parameters:

  • subtype
  • supertype

Throws:

  • NullParameterError if a mandatory parameter is not specified
typeOf(object : E) : Type<E>

Returns the type of the input object.

typeOf(now());
 //returns Date
typeOf(1.0);
//returns Integer
typeOf({ e-> String} );
 //returns {Object : Type<String>}
typeOf(now)
 //returns { : Date}

Parameters:

  • object input object

Json

convertToJson(object* : Object) : String

Converts the object to JSON. The object can be an instance of a Record, List, Set or Map with their data structure consisting of the types String, Boolean, Binary, Decimal, Integer, Date, Set, List, Map, Record, or Enumeration.

convertToJson(
//record with a related record:
  new Applicant(
    name -> "John", 
    surname -> "Doe", 
    tutor -> new Tutor( 
       name -> "Jane",
       hireDate -> date("2018-1-1")
       )
     )
 ) 
 /*returns 
{
  "id" : 2,
 "name" : "John",
  "surname" : "Doe",
  "tutor" : {
    "id" : 1,
    "name" : "Jane",
    "hireDate" : 1514761200000
  }
}*/

Parameters:

  • object instance of a Record, List, Set or Map to convert to JSON

Throws:

  • NullParameterError a mandatory parameter is null
  • IncompatibleTypeError the object is not a Record, List, Set, Map or contains an unsupported type
  • JsonProcessingError an error occurred during conversion to JSON
convertToJson(useExternalRef* : Boolean, object* : Object) : String

Converts internal data structures passed as the object parameter to JSON representation. The object parameter must be an instance of a Record, List, Set or Map type otherwise an exception is thrown. Furthermore, the data structure represented by the object parameter can consist only of the following types: String, Boolean, Binary, Decimal, Integer, Date, Set, List, Map, Record, Enumeration. The function returns a string which represents the data in JSON format. The parameter useExternalRef defines how shared records are converted to JSON. In case the useExternalRef is true the shared record is stored as type and primary key string. In other case all fields of the shared record are stored.

Parameters:

  • useExternalRef
  • object

Throws:

  • NullParameterError if a mandatory parameter is null
  • IncompatibleTypeError if the object is not a Record, List, Set, Map or the data structure represented by the object parameter contains an unsupported type
  • JsonProcessingError if an error occurred during conversion to JSON
jsonSchema(useExternalRef : Boolean, type : Type<Object>) : String
jsonToMap(json* : String) : Map<String, Object>

Parses JSON string to a map. The json parameter represents the JSON string to parse.

jsonToMap("
  {
    ""name"" : ""John"",
    ""surname"" : ""Doe"",
    ""tutor"" : {
        ""id"" : 1,
        ""name"" : ""Jane"",
        ""hireDate"" : 2012-04-23T18:25:43.511Z
    }
}")

Parameters:

  • json

Throws:

  • NullParameterError a mandatory parameter is null
  • JsonProcessingError the specified json cannot be parsed
jsonToMap(json* : String, doInsert* : Boolean, doUpdate* : Boolean) : Map<String, Object>

Parses JSON string to a map. he json parameter represents the JSON string to parse and the resultType parameter determines the type of the returned data. The referred type must be a Record, List, Set or Map type, otherwise an exception is thrown. Furthermore the data structure represented by the resultType can consist only from these supported types: String, Boolean, Binary, Decimal, Integer, Date, Set, List, Map, Record, Enumeration. If there exist a shared record with the same primary key as specified in JSON the record is used by import. Here, it does not matter whether the shared record is specified by external reference or by value in JSON. If the record specified by reference in JSON does not exist in database it is ignored and null is used as its imported value or empty collection for collection of records. No exception is thrown in this case. If the parameter doInsert is true and the database does not contain a shared record specified by value in JSON or the JSON does not specify primary key, the record from JSON is inserted to database. For auto-generated primary keys, a new key value is created, for not auto-generated primary keys, the value of the key from JSON is used. If doInsert is false, a record from JSON which does not exist in the DB is ignored and null is used for its value in the imported data instead; for collections of non-existing records, empty collections are created by import. If the parameter doUpdate is true and the database contains a shared record with the same primary key as a record specified by value in JSON, values of this record fields are updated from JSON. If false, values of fields do not change.

jsonToMap("
  {
    ""name"" : ""John"",
    ""surname"" : ""Doe"",
    ""tutor"" : {
        ""id"" : 1,
        ""name"" : ""Jane"",
        ""hireDate"" : 2012-04-23T18:25:43.511Z
    }
}")

Parameters:

  • json
  • doInsert
  • doUpdate

Throws:

  • NullParameterError if a mandatory parameter is null
  • JsonProcessingError if the specified json cannot be parsed
mapToJson(map* : Map<String, Object>) : String

Converts the map to JSON. The string keys of the map represent the keys of the JSON object. The values of the map must be instances of String, Boolean, Binary, Decimal, Integer, Date, Record, Enumeration, Null, Set and List of the previously mentioned types, or Map<String, Object>. Otherwise an exception is thrown. Nested JSON objects are represented either by values of the type Map<String, Object> or record. The function returns a string which represents the data in JSON format.

mapToJson(
  [
    "name" -> "John", 
    "address" -> ["City"->"Amsterdam"]
  ]
)

Parameters:

  • map

Throws:

  • NullParameterError a mandatory parameter is null
  • IncompatibleTypeError the map value contains an unsupported type
  • JsonProcessingError an error occurred during conversion to JSON
parseJson(json* : String, resultType* : Type<E>) : EDEPRECATED

Deprecated: use parseJson(String json, Type resultType, Boolean doInsert, Boolean doUpdate).

Parses the json string to internal data structures. The json parameter represents the JSON string to parse and the resultType parameter determines the type of the returned data. The type must be a Record, List, Set or Map type, otherwise an exception is thrown. Also the data structure represented by the resultType can consist only from these supported types: String, Boolean, Binary, Decimal, Integer, Date, Set, List, Map, Record, Enumeration.

Note that when parsing JSON to shared Records if json defines the primary-key value: if the primary key is autogeneratedit, the primary key in the json is ignored: A new shared record is created. If the primary key is not autogenerated and a record with the defined primary key already exists, the call fails with a runtime exception.

parseJson("
{
  ""id"" : 1,
  ""approved"" : false,
  ""firstName"" : ""Jane"",
  ""lastName"" : ""Doe""
}
", RegistrationData)

Parameters:

  • json string with JSON
  • resultType type to which to parse the JSON string

Throws:

  • NullParameterError mandatory parameter is null
  • IncompatibleTypeError resultType parameter is not a a Record, List, Set or Map type or the data structure represented by the resultType parameter contains an unsupported type
  • JsonProcessingError json cannot be parsed
parseJson(json* : String, resultType* : Type<E>, doInsert* : Boolean, doUpdate* : Boolean) : E

Parses JSON string to internal data structures. The json parameter is the JSON string and the resultType parameter is the type to switch it should be parsed. The referred type must be a Record, List, Set or Map type. The data structure of the resultType can consist only of the types String, Boolean, Binary, Decimal, Integer, Date, Set, List, Map, Record, or Enumeration.

If a shared record with the primary key equal to the primary key specified in JSON, the record is used by import. Here, it does not matter whether the shared record is specified by external reference or by value in JSON. If the record specified by reference in JSON does not exist in the database, it is ignored and null is used as its imported value or empty collection for collection of records. No exception is thrown in this case. If the parameter doInsert is true and the database does not contain a shared record specified by value in JSON or the JSON does not specify a primary key, the record from JSON is inserted into the database. For auto-generated primary keys, a new key value is created, for non-auto-generated primary keys, the value of the key from JSON is used. If doInsert is false, a record from JSON which does not exist in the DB is ignored and null is used for its value in the imported data instead; for collections of non-existing records, empty collections are created by import. If the parameter doUpdate is true and the database contains a shared record with the same primary key as a record specified by value in JSON, values of this record fields are updated from JSON. If false, such records remain unchanged.

parseJson("
{
  ""id"" : 1,
  ""approved"" : false,
  ""firstName"" : ""Jane"",
  ""lastName"" : ""Doe""
}
", RegistrationData, true, true)

Parameters:

  • json string with JSON
  • resultType type to which to parse the JSON string
  • doInsert whether to allow insert of new shared records
  • doUpdate whether to allow update of shared records

Throws:

  • NullParameterError if a mandatory parameter is null
  • IncompatibleTypeError if the resultType parameter is not a a Record, List, Set or Map type or if the data structure represented by the resultType parameter contains an unsupported type
  • JsonProcessingError if the json cannot be parsed
  • NullParameterError if a mandatory parameter is null
  • IncompatibleTypeError if the resultType parameter is not a a Record, List, Set or Map type or if the data structure represented by the resultType parameter contains an unsupported type
  • JsonProcessingError if the json cannot be parsed

Ws

callHttp(sslConfig : SslConfig, endpointAddress* : String, httpMethod* : String, requestContentType* : String, input : String, login : String, password : String, readTimeout : Decimal, requestHeaders : Map<String, String>, responseHeaders : Reference<Map<String, String>>, resposeCode : Reference<Integer>, logMessages : Boolean) : String

Synchronous http call.

callHttp(
   sslConfig -> null,
   endpointAddress-> "http://localhost:9200/myindex/section/_search",
   httpMethod -> "GET",
   requestContentType -> "application/json",
   input -> "{""query"":{""match"":{""title"":""Controlling Flow""}}}",
   login -> null,
   password -> null,
   readTimeout -> null,
   requestHeaders -> null,
   responseHeaders -> &responseHeaders,
   resposeCode -> &responseCode,
   logMessages -> true
)

Parameters:

  • sslConfig ssl configuration if secure communication is required
  • endpointAddress url
  • httpMethod GET|PUT|POST|DETETE
  • requestContentType should be set if there is an input (payload)
  • input a payload for PUT|POST
  • login login name
  • password password
  • readTimeout timeout in milliseconds
  • requestHeaders request headers
  • responseHeaders reference to where response headers are set
  • resposeCode reference to where to store the response code
  • error reference to where the error object is set
  • logMessages if true request and response messages are logged to console
callWebservice(soapMetadata* : Map<String, String>, sslConfig : SslConfig, endpointAddress : String, login : String, password : String, input* : Record, requestSoapHeaders : List<Object>, requestHeaders : Map<String, String>, readTimeout : Decimal, outputType* : Type<T>, responseSoapHeaders : List<Object>, responseHeaders : Reference<Map<String, String>>, error : Reference<Object>, logMessages : Boolean) : T

Synchronous call of a webservice. It provides the same functionality as the generated webservice task but can be used in expressions. It uses the same data objects that are generated for the webservice task and the same metadata.

Parameters:

  • soapMetadata the same metadata as for the webservice task
  • sslConfig the ssl configuration if secure communication is required
  • endpointAddress webservice url. If not specified, the endpoint from metadata is used.
  • login login name
  • password password
  • input webservice input represented by a record
  • requestSoapHeaders map of soap request headers
  • requestHeaders map of request headers
  • readTimeout timeout in milliseconds
  • outputType lsps type of the return value
  • responseSoapHeaders reference to where response soap headers are set
  • responseHeaders reference to where response headers are set
  • error reference to where the error object is set
  • logMessages if true request and response messages are logged to console

Auditing

findByRevision(record* : Record, revision* : Integer) : E

Returns the audited record in the revision.

findByRevision(getBookByTitle("Death in Venice"), 7)

Parameters:

  • record audited shared record
  • revision required revision of the record

Throws:

  • NullParameterError if a mandatory parameter is null
  • IncompatibleTypeError if the record is not a shared record
getCurrentRevision(revisionEntityType* : Type<T>, persist* : Boolean) : T

Returns the current custom revision entity. If the persist parameter is set to true, a new revision entity is created even if no audited record is changed in the transaction.

getCurrentRevision(auditing::MyRevisionEntity, true)

Parameters:

  • revisionEntityType revision entity type
  • persist if true, a new revision entity is created even if no audited record was changed in the transaction

Throws:

  • NullParameterError if a mandatory parameter is null
  • IncompatibleTypeError if the revisionEntity type is not a custom revision entity record type
getRevisions(record* : Record, from : Date, to : Date) : List<Integer>

Returns the list of revision identifiers in which the audited shared record was modified during the period defined by the from and to parameters. If either of the parameters is null, the period is unbounded from start or end respectively.

Parameters:

  • record shared record changed in the revisions
  • from start of the period when the revisions were created
  • to end of the period when the revision were created

Throws:

  • NullParameterError if a mandatory parameter is null
  • IncompatibleTypeError if the record is not a shared record

Query

countAll(type* : Type<Record>) : Integer

Returns the count of all shared records of the given type.

Parameters:

  • type shared record type

Throws:

  • NullParameterError if a mandatory parameter is null
  • IncompatibleTypeError if the type parameter is not a shared record type
findAll(type* : Type<E>) : List<E>

Returns all shared records of the given type.

findAll(Model)

Parameters:

  • type record type

Throws:

  • NullParameterError if a mandatory parameter is null
  • IncompatibleTypeError if the type parameter is not a shared record type
findById(id* : Object, type* : Type<E>) : EDEPRECATED

Returns a shared record of the specified type and identified by the given primary key. Composed primary key is represented as a map of type Map<String, Object> or of type Map<Property, Object>. The keys of the map identify the properties of the primary key and values represent the value of the properties. If the key is of the type string then it contains the simple property name. If there is no record with the given id, the function returns null.

findById(ModelInstance, 8000);
findById(RecWithComplexPK, ["id1" -> 1, "id2" -> 2])

Parameters:

  • id primary key
  • type shared record type

Throws:

  • NullParameterError if a mandatory parameter is null
  • IncompatibleTypeError if the type parameter is not a shared record type
findById(type* : Type<E>, id* : Object) : E

Returns a shared record of the specified type and identified by the given primary key. Composed primary key is represented as a map of type Map<String, Object> or of type Map<Property, Object>. The keys of the map identify the properties of the primary key and values represent the value of the properties. If the key is of the type string then it contains the simple property name. If there is no record with the given id, the function returns null.

ModelInstance.findById(8000);
RecWithComplexPK.findById(["id1" -> 1, "id2" -> 2])

Parameters:

  • type shared record type
  • id primary key

Throws:

  • NullParameterError if a mandatory parameter is null
  • IncompatibleTypeError if the type parameter is not a shared record type

Utilities

debugLevel() : IntegerDEPRECATED
Returns an integer (100) representing the "Debug" log level. Deprecated. Replaced by constant DEBUG_LEVEL.
debugLog(message* : { : String}) : StringSIDE EFFECT

Logs a message to the console at the debug logging level and returns the logged string or null if no message was logged. If logging is not enabled for the debug level on the server, the message closure is not evaluated.

debugLog({ -> "debug message" })

Parameters:

  • message message to log

Throws:

  • NullParameterError if a mandatory parameter is null
debugLog(message* : { : String}, level* : Integer) : StringSIDE EFFECT

Logs a message to the console at the debug logging level and returns the logged string or null if no message was logged. If logging is not enabled for the debug level on the server, the message closure is not evaluated.

debugLog({ -> "debug message" }, INFO_LEVEL )

Parameters:

  • message message to log
  • level log level of the message

Throws:

  • NullParameterError if a mandatory parameter is null
errorLevel() : IntegerDEPRECATED
Returns an integer (400) representing the "Error" log level. Deprecated. Replaced by constant ERROR_LEVEL.
executeSqlFile(binaryInput* : Binary) : voidSIDE EFFECT

Execute the SQL in the binary. Empty lines and lines starting with -- or ; are ignored.

def File file := getResource(module -> "localization", path -> "sqlinsert.txt");
//the file contains SQL statements separated with semicolons
executeSqlFile(file.content);

Parameters:

  • binaryInput binary with SQL
getApplicationData(key* : String) : Object

Returns an application data object with the key "locale" string or "user": locale returns the locale and user the login name of the logged-in user in the LSPS Process Application.

getApplicationData("locale")

Parameters:

  • key name of the application data

Throws:

  • NullParameterError if a mandatory parameter is null
getCurrentDatabaseName() : String
Returns the DBMS name of the current LSPS_DS datasource, such as MYSQL, ORACLE, etc.
getErrorCode() : String
If used in the catch section of the try/catch command, the function returns the code of caught error. If used elsewhere, it returns null.
getErrorMessage() : String
If used in the catch section of the try/catch command, the function returns the message of caught error. If used elsewhere, it returns null.
infoLevel() : IntegerDEPRECATED
Returns an integer (200) representing the "Info" log level. Deprecated. Replaced by constant INFO_LEVEL.
log(message* : String, level : Integer) : voidSIDE EFFECT

Logs the specified message to the application log at the specified log level. If the level is not specified, the level value is set to the "Info" level (value 200).

Parameters:

  • message message to log
  • level log level of the message

Throws:

  • NullParameterError if a mandatory parameter is null
splitPathname(name* : String) : List<String>

Splits a fully qualified element name to the names of its components as separated by the namespace separator (::).

splitPathname("module::'role 1'")
//returns ["module", "role 1"]

Parameters:

  • name input fully qualified name

Throws:

  • NullParameterError if a mandatory parameter is null
  • IncorrectPathnameError if syntax of the specified name is incorrect
uuid() : String

Returns a universally unique identifier (UUID).

uuid()
//returns "3021c2bf-b146-492b-9849-9ebd4abd56e8"

warningLevel() : IntegerDEPRECATED
Returns an integer (300) representing the "Warning" log level. Deprecated. Replaced by constant WARNING_LEVEL.