Utils Reference
- 1 @calc
- 1.1 sum(list)
- 1.1.1 Returns
- 1.1.2 Parameters
- 1.1.3 Example
- 1.2 avg(list)
- 1.2.1 Returns
- 1.2.2 Parameters
- 1.2.3 Example
- 1.3 round(value,scale,mode)
- 1.3.1 Returns
- 1.3.2 Parameters
- 1.3.3 Example
- 1.4 roundUp(value,scale)
- 1.4.1 Returns
- 1.4.2 Parameters
- 1.4.3 Example
- 1.5 roundDown(value,scale)
- 1.5.1 Returns
- 1.5.2 Parameters
- 1.5.3 Example
- 1.1 sum(list)
- 2 @content
- 2.1 newCollection(uris)
- 2.1.1 Returns
- 2.1.2 Parameters
- 2.1.3 Example
- 2.2 newCollection()
- 2.3 newContent(uri)
- 2.3.1 Returns
- 2.3.2 Parameters
- 2.3.3 Example
- 2.4 fromBase64(base64String)
- 2.4.1 Returns
- 2.4.2 Parameters
- 2.4.3 Example
- 2.5 fromBase64(base64String,name)
- 2.5.1 Returns
- 2.5.2 Parameters
- 2.5.3 Example
- 2.6 fromBase64(base64String,name,contentType)
- 2.6.1 Returns
- 2.6.2 Parameters
- 2.6.3 Example
- 2.7 from(object,contentType,contentEncoding,name)
- 2.7.1 Returns
- 2.7.2 Parameters
- 2.7.3 Example
- 2.8 from(object,name)
- 2.8.1 Returns
- 2.8.2 Parameters
- 2.8.3 Example
- 2.9 from(object)
- 2.9.1 Returns
- 2.9.2 Parameters
- 2.9.3 Example
- 2.1 newCollection(uris)
- 3 @convert
- 3.1 toBase64(value)
- 3.1.1 Returns
- 3.1.2 Parameters
- 3.1.3 Example
- 3.2 fromBase64(base64String)
- 3.2.1 Returns
- 3.2.2 Parameters
- 3.2.3 Example
- 3.3 fromBase64ToBytes(base64String)
- 3.3.1 Returns
- 3.3.2 Parameters
- 3.3.3 Example
- 3.4 toJson(object)
- 3.4.1 Returns
- 3.4.2 Parameters
- 3.4.3 Example
- 3.5 toXMLString(object)
- 3.5.1 Returns
- 3.5.2 Parameters
- 3.5.3 Example
- 3.6 toDOM(object)
- 3.6.1 Returns
- 3.6.2 Parameters
- 3.6.3 Example
- 3.7 toMap(object)
- 3.7.1 Returns
- 3.7.2 Parameters
- 3.7.3 Example
- 3.8 toMapOrList(o)
- 3.8.1 Returns
- 3.8.2 Parameters
- 3.8.3 Example
- 3.9 lazy(uri)
- 3.9.1 Returns
- 3.9.2 Parameters
- 3.9.3 Example
- 3.10 toLong(value)
- 3.10.1 Returns
- 3.10.2 Parameters
- 3.10.3 Example
- 3.11 toInteger(value)
- 3.11.1 Returns
- 3.11.2 Parameters
- 3.11.3 Example
- 3.12 toBoolean(value)
- 3.12.1 Returns
- 3.12.2 Parameters
- 3.12.3 Example
- 3.13 toDecimal(value)
- 3.13.1 Returns
- 3.13.2 Parameters
- 3.13.3 Example
- 3.14 toDecimal(value,decimalSymbol)
- 3.14.1 Returns
- 3.14.2 Parameters
- 3.14.3 Example
- 3.15 toDecimal(value,pattern,decimalSymbol)
- 3.15.1 Returns
- 3.15.2 Parameters
- 3.15.3 Example
- 3.16 toDecimalString(value,pattern,decimalSymbol)
- 3.16.1 Returns
- 3.16.2 Parameters
- 3.16.3 Example
- 3.17 toDecimalString(value,decimalSymbol)
- 3.17.1 Returns
- 3.17.2 Parameters
- 3.17.3 Example
- 3.18 toByteArray(object)
- 3.18.1 Returns
- 3.18.2 Parameters
- 3.18.3 Example
- 3.1 toBase64(value)
- 4 @data
- 4.1 set(data,path,value)
- 4.1.1 Returns
- 4.1.2 Parameters
- 4.1.3 Example
- 4.2 put(map,key,value)
- 4.2.1 Returns
- 4.2.2 Parameters
- 4.2.3 Example
- 4.3 select(input,selections)
- 4.3.1 Returns
- 4.3.2 Parameters
- 4.3.3 Example
- 4.4 integerList(startInt,endInt)
- 4.4.1 Returns
- 4.4.2 Parameters
- 4.4.3 Example
- 4.5 size(value)
- 4.5.1 Returns
- 4.5.2 Parameters
- 4.5.3 Example
- 4.6 isEmpty(data)
- 4.6.1 Returns
- 4.6.2 Parameters
- 4.6.3 Example
- 4.7 has(data,attribute)
- 4.7.1 Returns
- 4.7.2 Parameters
- 4.7.3 Example
- 4.8 get(data,attribute)
- 4.8.1 Returns
- 4.8.2 Parameters
- 4.8.3 Example
- 4.9 emptyObject()
- 4.10 emptyList()
- 4.11 keys(data)
- 4.11.1 Returns
- 4.11.2 Parameters
- 4.11.3 Example
- 4.12 type(data)
- 4.12.1 Returns
- 4.12.2 Parameters
- 4.12.3 Example
- 4.13 isType(data,type)
- 4.13.1 Returns
- 4.13.2 Parameters
- 4.13.3 Example
- 4.14 isArray(data)
- 4.14.1 Returns
- 4.14.2 Parameters
- 4.14.3 Example
- 4.15 isBoolean(data)
- 4.15.1 Returns
- 4.15.2 Parameters
- 4.15.3 Example
- 4.16 isNumber(data)
- 4.16.1 Returns
- 4.16.2 Parameters
- 4.16.3 Example
- 4.17 isObject(data)
- 4.17.1 Returns
- 4.17.2 Parameters
- 4.17.3 Example
- 4.18 isString(data)
- 4.18.1 Returns
- 4.18.2 Parameters
- 4.18.3 Example
- 4.19 isNull(data)
- 4.19.1 Returns
- 4.19.2 Parameters
- 4.19.3 Example
- 4.1 set(data,path,value)
- 5 @date
- 5.1 now()
- 5.2 nowIso8601()
- 5.3 now(format)
- 5.3.1 Returns
- 5.3.2 Parameters
- 5.3.3 Example
- 5.4 now(zoneId,locale)
- 5.4.1 Returns
- 5.4.2 Parameters
- 5.4.3 Example
- 5.5 guessAndFormat(dateTimeString,outputFormat)
- 5.5.1 Returns
- 5.5.2 Parameters
- 5.5.3 Example
- 5.6 format(inputDate,inputFormat,outputFormat)
- 5.6.1 Returns
- 5.6.2 Parameters
- 5.6.3 Example
- 5.7 format(iso8601Date,format)
- 5.7.1 Returns
- 5.7.2 Parameters
- 5.7.3 Example
- 5.8 format(timestamp,format)
- 5.8.1 Returns
- 5.8.2 Parameters
- 5.8.3 Example
- 5.9 year(dateString)
- 5.9.1 Returns
- 5.9.2 Parameters
- 5.9.3 Example
- 5.10 timestamp()
- 5.11 isExpired(iso8601Start,iso8601End,expiredInPercents)
- 5.11.1 Returns
- 5.11.2 Parameters
- 5.11.3 Example
- 5.12 isExpired(iso8601Start,iso8601End,expiredInPercents,currentDate)
- 5.12.1 Returns
- 5.12.2 Parameters
- 5.12.3 Example
- 5.13 isOverdue(dueDate,currentDate)
- 5.13.1 Returns
- 5.13.2 Parameters
- 5.13.3 Example
- 5.14 isOverdue(dueDate)
- 5.14.1 Returns
- 5.14.2 Parameters
- 5.14.3 Example
- 5.15 parseToInstant(dateTime)
- 5.15.1 Returns
- 5.15.2 Parameters
- 5.15.3 Example
- 5.16 beginOfYear(yearOffset)
- 5.16.1 Returns
- 5.16.2 Parameters
- 5.16.3 Example
- 5.17 beginOfYear(timestamp,yearOffset)
- 5.17.1 Returns
- 5.17.2 Parameters
- 5.17.3 Example
- 5.18 beginOfMonth(monthOffset)
- 5.18.1 Returns
- 5.18.2 Parameters
- 5.18.3 Example
- 5.19 beginOfMonth(timestamp,monthOffset)
- 5.19.1 Returns
- 5.19.2 Parameters
- 5.19.3 Example
- 5.20 beginOfWeek(weekStartDay,weekOffset)
- 5.20.1 Returns
- 5.20.2 Parameters
- 5.20.3 Example
- 5.21 beginOfWeek(timestamp,weekStartDay,weekOffset)
- 5.21.1 Returns
- 5.21.2 Parameters
- 5.21.3 Example
- 5.22 beginOfDay(dayOffset)
- 5.22.1 Returns
- 5.22.2 Parameters
- 5.22.3 Example
- 5.23 beginOfDay(timestamp,dayOffset)
- 5.23.1 Returns
- 5.23.2 Parameters
- 5.23.3 Example
- 6 @function
- 6.1 run(name,args)
- 6.1.1 Returns
- 6.1.2 Parameters
- 6.1.3 Example
- 6.1 run(name,args)
- 7 @hash
- 7.1 sha256(input)
- 7.1.1 Returns
- 7.1.2 Parameters
- 7.1.3 Example
- 7.2 sha256Concat(separator,text)
- 7.2.1 Returns
- 7.2.2 Parameters
- 7.2.3 Example
- 7.3 sha256Concat(separator,text)
- 7.3.1 Returns
- 7.3.2 Parameters
- 7.3.3 Example
- 7.4 md5(input)
- 7.4.1 Returns
- 7.4.2 Parameters
- 7.4.3 Example
- 7.5 md5Concat(separator,text)
- 7.5.1 Returns
- 7.5.2 Parameters
- 7.5.3 Example
- 7.6 md5Concat(separator,text)
- 7.6.1 Returns
- 7.6.2 Parameters
- 7.6.3 Example
- 7.7 sha512(input)
- 7.7.1 Returns
- 7.7.2 Parameters
- 7.7.3 Example
- 7.8 sha512Concat(separator,text)
- 7.8.1 Returns
- 7.8.2 Parameters
- 7.8.3 Example
- 7.9 sha512Concat(separator,text)
- 7.9.1 Returns
- 7.9.2 Parameters
- 7.9.3 Example
- 7.1 sha256(input)
- 8 @iam
- 8.1 userByUuid(userUuid)
- 8.1.1 Returns
- 8.1.2 Parameters
- 8.1.3 Example
- 8.2 userByUsername(username)
- 8.2.1 Returns
- 8.2.2 Parameters
- 8.2.3 Example
- 8.3 userByEmail(email)
- 8.3.1 Returns
- 8.3.2 Parameters
- 8.3.3 Example
- 8.1 userByUuid(userUuid)
- 9 @instance
- 9.1 env(name)
- 9.1.1 Returns
- 9.1.2 Parameters
- 9.1.3 Example
- 9.2 domain()
- 9.3 namespace()
- 9.4 url(serviceName)
- 9.4.1 Returns
- 9.4.2 Parameters
- 9.4.3 Example
- 9.5 url()
- 9.6 profiles()
- 9.7 hasProfile(profiles)
- 9.7.1 Returns
- 9.7.2 Parameters
- 9.7.3 Example
- 9.8 stage()
- 9.9 version()
- 9.10 build()
- 9.11 edition()
- 9.12 storage()
- 9.13 tag()
- 9.14 uptime()
- 9.15 defaultImageRepo(image)
- 9.15.1 Returns
- 9.15.2 Parameters
- 9.15.3 Example
- 9.1 env(name)
- 10 @json
- 10.1 load(source)
- 10.1.1 Returns
- 10.1.2 Parameters
- 10.1.3 Example
- 10.2 path(json,query)
- 10.2.1 Returns
- 10.2.2 Parameters
- 10.2.3 Example
- 10.3 stringify(json)
- 10.3.1 Returns
- 10.3.2 Parameters
- 10.3.3 Example
- 10.4 object()
- 10.5 array()
- 10.1 load(source)
- 11 @list
- 11.1 first(value)
- 11.1.1 Returns
- 11.1.2 Parameters
- 11.1.3 Example
- 11.2 last(value)
- 11.2.1 Returns
- 11.2.2 Parameters
- 11.2.3 Example
- 11.3 size(list)
- 11.3.1 Returns
- 11.3.2 Parameters
- 11.3.3 Example
- 11.4 empty(list)
- 11.4.1 Returns
- 11.4.2 Parameters
- 11.4.3 Example
- 11.5 sublist(value,expression)
- 11.5.1 Returns
- 11.5.2 Parameters
- 11.5.3 Example
- 11.6 add(list,element)
- 11.6.1 Returns
- 11.6.2 Parameters
- 11.6.3 Example
- 11.7 add(list,element,ignoreNulls)
- 11.7.1 Returns
- 11.7.2 Parameters
- 11.7.3 Example
- 11.8 contains(list,needles)
- 11.8.1 Returns
- 11.8.2 Parameters
- 11.8.3 Example
- 11.9 create()
- 11.10 copy(list)
- 11.10.1 Returns
- 11.10.2 Parameters
- 11.10.3 Example
- 11.1 first(value)
- 12 @path
- 12.1 join(pathItems)
- 12.1.1 Returns
- 12.1.2 Parameters
- 12.1.3 Example
- 12.2 extension(path)
- 12.2.1 Returns
- 12.2.2 Parameters
- 12.2.3 Example
- 12.3 basename(path)
- 12.3.1 Returns
- 12.3.2 Parameters
- 12.3.3 Example
- 12.1 join(pathItems)
- 13 @property
- 13.1 value(key)
- 13.1.1 Returns
- 13.1.2 Parameters
- 13.1.3 Example
- 13.2 values(pattern)
- 13.2.1 Returns
- 13.2.2 Parameters
- 13.2.3 Example
- 13.3 updateValue(key,value)
- 13.3.1 Returns
- 13.3.2 Parameters
- 13.3.3 Example
- 13.4 get(key)
- 13.4.1 Returns
- 13.4.2 Parameters
- 13.4.3 Example
- 13.5 lazy(key)
- 13.5.1 Returns
- 13.5.2 Parameters
- 13.5.3 Example
- 13.1 value(key)
- 14 @resolve
- 14.1 uri(uri)
- 14.1.1 Returns
- 14.1.2 Parameters
- 14.1.3 Example
- 14.1 uri(uri)
- 15 @script
- 15.1 groovy(script,args)
- 15.1.1 Returns
- 15.1.2 Parameters
- 15.1.3 Example
- 15.2 groovy(script)
- 15.2.1 Returns
- 15.2.2 Parameters
- 15.2.3 Example
- 15.1 groovy(script,args)
- 16 @text
- 16.1 upperCase(text)
- 16.1.1 Returns
- 16.1.2 Parameters
- 16.1.3 Example
- 16.2 lastIndexOf(text,needle)
- 16.2.1 Returns
- 16.2.2 Parameters
- 16.2.3 Example
- 16.3 lastIndexOf(text,needle,offset)
- 16.3.1 Returns
- 16.3.2 Parameters
- 16.3.3 Example
- 16.4 indexOf(text,needle)
- 16.4.1 Returns
- 16.4.2 Parameters
- 16.4.3 Example
- 16.5 indexOf(text,needle,offset)
- 16.5.1 Returns
- 16.5.2 Parameters
- 16.5.3 Example
- 16.6 prefix(text,stop)
- 16.6.1 Returns
- 16.6.2 Parameters
- 16.6.3 Example
- 16.7 suffix(text,stop)
- 16.7.1 Returns
- 16.7.2 Parameters
- 16.7.3 Example
- 16.8 lowerCase(text)
- 16.8.1 Returns
- 16.8.2 Parameters
- 16.8.3 Example
- 16.9 isEmpty(text)
- 16.9.1 Returns
- 16.9.2 Parameters
- 16.9.3 Example
- 16.10 shorten(text,length)
- 16.10.1 Returns
- 16.10.2 Parameters
- 16.10.3 Example
- 16.11 length(text)
- 16.11.1 Returns
- 16.11.2 Parameters
- 16.11.3 Example
- 16.12 contains(text,needles)
- 16.12.1 Returns
- 16.12.2 Parameters
- 16.12.3 Example
- 16.13 lang(text)
- 16.13.1 Returns
- 16.13.2 Parameters
- 16.13.3 Example
- 16.14 random(size)
- 16.14.1 Returns
- 16.14.2 Parameters
- 16.14.3 Example
- 16.15 uuid()
- 16.16 toHtml(text)
- 16.16.1 Returns
- 16.16.2 Parameters
- 16.16.3 Example
- 16.17 append(basetext,text)
- 16.17.1 Returns
- 16.17.2 Parameters
- 16.17.3 Example
- 16.18 concat(separator,collection)
- 16.18.1 Returns
- 16.18.2 Parameters
- 16.18.3 Example
- 16.19 concat(separator,items)
- 16.19.1 Returns
- 16.19.2 Parameters
- 16.19.3 Example
- 16.20 commajoin(collection)
- 16.20.1 Returns
- 16.20.2 Parameters
- 16.20.3 Example
- 16.21 format(pattern,args)
- 16.21.1 Returns
- 16.21.2 Parameters
- 16.21.3 Example
- 16.22 leftPad(text,size)
- 16.22.1 Returns
- 16.22.2 Parameters
- 16.22.3 Example
- 16.23 leftPad(text,size,padChar)
- 16.23.1 Returns
- 16.23.2 Parameters
- 16.23.3 Example
- 16.24 rightPad(text,size)
- 16.24.1 Returns
- 16.24.2 Parameters
- 16.24.3 Example
- 16.25 rightPad(text,size,padChar)
- 16.25.1 Returns
- 16.25.2 Parameters
- 16.25.3 Example
- 16.26 concatAndFormat(separator,collection,pel)
- 16.26.1 Returns
- 16.26.2 Parameters
- 16.26.3 Example
- 16.27 startsWith(text,prefix)
- 16.27.1 Returns
- 16.27.2 Parameters
- 16.27.3 Example
- 16.28 replaceAll(text,needle,replacement)
- 16.28.1 Returns
- 16.28.2 Parameters
- 16.28.3 Example
- 16.29 substring(text,beginIndex)
- 16.29.1 Returns
- 16.29.2 Parameters
- 16.29.3 Example
- 16.30 substring(text,beginIndex,endIndex)
- 16.30.1 Returns
- 16.30.2 Parameters
- 16.30.3 Example
- 16.31 trim(text)
- 16.31.1 Returns
- 16.31.2 Parameters
- 16.31.3 Example
- 16.32 isAllEmpty(text)
- 16.32.1 Returns
- 16.32.2 Parameters
- 16.32.3 Example
- 16.33 toAlphaNumeric(text)
- 16.33.1 Returns
- 16.33.2 Parameters
- 16.33.3 Example
- 16.34 firstCharUpper(text)
- 16.34.1 Returns
- 16.34.2 Parameters
- 16.34.3 Example
- 16.35 firstCharLower(text)
- 16.35.1 Returns
- 16.35.2 Parameters
- 16.35.3 Example
- 16.36 split(text,token)
- 16.36.1 Returns
- 16.36.2 Parameters
- 16.36.3 Example
- 16.37 replaceCharAt(text,pos,c)
- 16.37.1 Returns
- 16.37.2 Parameters
- 16.37.3 Example
- 16.38 matches(text,regexp)
- 16.38.1 Returns
- 16.38.2 Parameters
- 16.38.3 Example
- 16.39 escapeCsvValue(value)
- 16.39.1 Returns
- 16.39.2 Parameters
- 16.39.3 Example
- 16.1 upperCase(text)
- 17 @uri
- 17.1 resolve(uri)
- 17.1.1 Returns
- 17.1.2 Parameters
- 17.1.3 Example
- 17.1 resolve(uri)
- 18 @user
- 18.1 username()
- 18.2 uuid()
- 18.3 hasPermission(permissionKeys)
- 18.3.1 Returns
- 18.3.2 Parameters
- 18.3.3 Example
- 18.4 displayName()
- 18.5 emailAndDisplayName(object)
- 18.5.1 Returns
- 18.5.2 Parameters
- 18.5.3 Example
- 18.6 emailAndDisplayName()
- 18.7 displayName(object)
- 18.7.1 Returns
- 18.7.2 Parameters
- 18.7.3 Example
- 18.8 email()
- 18.9 email(object)
- 18.9.1 Returns
- 18.9.2 Parameters
- 18.9.3 Example
- 18.10 locale()
- 18.11 firstName()
- 18.12 lastName()
- 18.13 loggedIn()
- 18.14 zone()
- 19 @xml
- 19.1 xpath(document,xpath)
- 19.1.1 Returns
- 19.1.2 Parameters
- 19.1.3 Example
- 19.2 xpathAsText(document,xpath)
- 19.2.1 Returns
- 19.2.2 Parameters
- 19.2.3 Example
- 19.1 xpath(document,xpath)
- 20 Report an Issue
Example usage of the @date
util inside a PEL expression :
pipeline:
- log:
message: "The current date is: #{@date.now()}"
@calc
Provides utility functions inside a pipeline expression for simple calculations of lists.
You can access the functions declared here in the PEL using <code>@calc</code>
Note: This is a public interface. Methods exposed here can be accessed by external developers in the pipelines!
sum(list)
Does a "nice" sum the values of the given list with high precision.
If an item in the given list is a string, it will be tried
to convert it to a number. If the value is null or cannot be converted it will be excluded from
the summary but no exception is thrown -> be nice.
Returns
bigdecimal
- The sum of the given list.
Parameters
Name | Type | Description |
---|---|---|
ist | | `object`` | | he list of numbers to sum-up. |
Example
@calc.sum(list)
avg(list)
Calculates the average on the value of given list with a precision of two decimal points.
Returns
bigdecimal
- The calculated AVG.
Parameters
Name | Type | Description |
---|---|---|
ist | | `object`` | | he list of numbers. |
Example
@calc.avg(list)
round(value,scale,mode)
Rounds input to scale number of digits. Multiple rounding strategies can be applied.
Returns
bigdecimal
- The rounded value as BigDecimal.
Parameters
Name | Type | Description |
---|---|---|
alue | | `object`` | | he value to round. BigDecimal, double, float, integer and long are supported. |
cale | | `integer`` | | he scale to round to. Positive value scales in fraction part, negative in integer. |
ode | | `string`` | | ne of UP, DOWN, CEILING, FLOOR, HALF_UP, HALF_DOWN, HALF_EVEN, UNNECESSARY can be used. For details see https://docs.oracle.com/javase/7/docs/api/java/math/RoundingMode.html |
Example
roundUp(value,scale)
Rounds input to scale number of digits up.
See also {@link CalcPelUtil#round(Object, Integer, String)} for more options.
Returns
bigdecimal
- The rounded value as BigDecimal.
Parameters
Name | Type | Description |
---|---|---|
alue | | `object`` | | he value to round. BigDecimal, double, float, integer and long are supported. |
cale | | `integer`` | | he scale to round to. Positive value scales in fraction part, negative in integer. |
Example
roundDown(value,scale)
Rounds input to scale number of digits down.
See also {@link CalcPelUtil#round(Object, Integer, String)} for more options.
Returns
bigdecimal
- The rounded value as BigDecimal.
Parameters
Name | Type | Description |
---|---|---|
alue | | `object`` | | he value to round. BigDecimal, double, float, integer and long are supported. |
cale | | `integer`` | | he scale to round to. Positive value scales in fraction part, negative in integer. |
Example
@content
Provides utility functions inside a pipeline expression for creation and managing of content objects.
You can access the functions declared here in the PEL using <code>@content</code>
newCollection(uris)
Creates a new content collection and initializes it with given uris.
Returns
contentcollection
- A content collection with given uris.
Parameters
Name | Type | Description |
---|---|---|
ris | | `string`` | | he list of content uris to add to the new collection. |
Example
newCollection()
Creates a new, empty content collection at given location.
Returns
contentcollection
- The new, empty content collection.
Example
newContent(uri)
Creates a new uri content object and returns it.
Returns
icontent
- The new content object.
Parameters
Name | Type | Description |
---|---|---|
ri | | `string`` | | he uri to be used for the content object |
Example
fromBase64(base64String)
Wraps the given base64 string into a content object
Returns
icontent
- The content object.
Parameters
Name | Type | Description |
---|---|---|
ase64String | | `string`` | | he base64 string. |
Example
fromBase64(base64String,name)
Wraps the given base64 string into a content object
Returns
icontent
- The content object.
Parameters
Name | Type | Description |
---|---|---|
ase64String | | `string`` | | he base64 string. |
ame | | `string`` | | he name of the content object (= file name) |
Example
fromBase64(base64String,name,contentType)
Wraps the given base64 string into a content object
Returns
icontent
- The content object.
Parameters
Name | Type | Description |
---|---|---|
ase64String | | `string`` | | he base64 string. |
ame | | `string`` | | he name of the content object (= file name) |
ontentType | | `string`` | | he content type of the base64 encoded string (when converted back). |
Example
from(object,contentType,contentEncoding,name)
Tries to convert the given object to a content object which can be used
to persist the data.
Returns
icontent
- The content object.
Parameters
Name | Type | Description |
---|---|---|
bject | | `object`` | | he object to convert. |
ontentType | | `string`` | | he content type to be set on the content object. |
ontentEncoding | | `string`` | | he encoding to be set on the content object. |
ame | | `string`` | | he name to be set on the content object. |
Example
from(object,name)
Tries to convert the given object to a content object which can be used
to persist the data.
Returns
icontent
- The content object.
Parameters
Name | Type | Description |
---|---|---|
bject | | `object`` | | he object to convert. |
ame | | `string`` | | he name to be set on the content object. |
Example
from(object)
Tries to convert the given object to a content object which can be used
to persist the data.
Returns
icontent
- The content object.
Parameters
Name | Type | Description |
---|---|---|
bject | | `object`` | | he object to convert. |
Example
@convert
Provides utility functions inside a pipeline expression for simple conversion and encoding tasks.
You can access the functions declared here in the PEL using <code>@convert</code>
toBase64(value)
Encodes the given value to base64. If value is not a text, it will be converted to a text before conversion.
Returns
string
- The encoded string.
Parameters
Name | Type | Description |
---|---|---|
alue | | `object`` | | he value to encode. |
Example
fromBase64(base64String)
Decodes the given base64 encoded string.
Returns
string
- The decoded string.
Parameters
Name | Type | Description |
---|---|---|
ase64String | | `string`` | | he base64 encoded string. |
Example
fromBase64ToBytes(base64String)
Decodes the given base64 encoded string.
Returns
byte[]
- The decoded string as byte array.
Parameters
Name | Type | Description |
---|---|---|
ase64String | | `string`` | | he base64 encoded string. |
Example
toJson(object)
Converts a given object structure to JSON.
Returns
jsonnode
- The resulting JSON.
Parameters
Name | Type | Description |
---|---|---|
bject | | `object`` | | he object to convert. |
Example
toXMLString(object)
Converts a given object to an XML string.
Returns
string
- The resulting XML string.
Parameters
Name | Type | Description |
---|---|---|
bject | | `object`` | | he object to convert. |
Example
toDOM(object)
Converts a given object to an XML DOM representation.
Returns
document
- The resulting DOM tree.
Parameters
Name | Type | Description |
---|---|---|
bject | | `object`` | | he object to convert. |
Example
toMap(object)
Converts the given object to a map structure.
Returns
map
- The converted map structure or null in case input was null.
Parameters
Name | Type | Description |
---|---|---|
bject | | `object`` | | he object to convert to a map structure. |
Example
toMapOrList(o)
Converts the given object to a map or list structure depending on which is more appropriate.
Returns
object
- The converted map or list structure or null in case input was null.
Parameters
Name | Type | Description |
---|---|---|
| | `object`` | | he object to convert to a map or list structure. |
Example
lazy(uri)
Converts all supported uri variants to LazyUriMap
Returns
object
- The lazy uri map.
Parameters
Name | Type | Description |
---|---|---|
ri | | `string`` | | he uri to load from. |
Example
toLong(value)
Converts the given value to a long value.
If input value is the boolean true or false, 1 or 0 as long is returned.
If input is the string "true" or "false, 1 or 0 as long is returned.
If input is empty string "", 0 is returned.
Returns
long
- The converted long value or null in case the input was null.
Parameters
Name | Type | Description |
---|---|---|
alue | | `object`` | | he value object to convert to long. |
Example
toInteger(value)
Converts the given value to a long value.
If input value is the boolean true or false, 1 or 0 as int is returned.
If input is the string "true" or "false, 1 or 0 as int is returned.
If input is empty string "", 0 is returned.
Returns
integer
- The converted integer value or null in case the input was null.
Parameters
Name | Type | Description |
---|---|---|
alue | | `object`` | | he value object to convert to integer. |
Example
toBoolean(value)
Converts the given value to a boolean value.
If input is the string "true" or "false, true or false as boolean is returned.
If input is empty string "", false is returned.
If input is null, false is returned.
Any numeric value > 0, true is returned.
Any numeric value <= 0, false is returned.
Returns
boolean
- The converted boolean value.
Parameters
Name | Type | Description |
---|---|---|
alue | | `object`` | | he value object to convert to boolean. |
Example
toDecimal(value)
Converts the given value into a big decimal with given precision.
Returns
double
- The decimal number as double.
Parameters
Name | Type | Description |
---|---|---|
alue | | `object`` | | he value to convert. |
Example
toDecimal(value,decimalSymbol)
Converts the given value to a decimal number.
Returns
bigdecimal
- The value as decimal number ready for calculations.
Parameters
Name | Type | Description |
---|---|---|
alue | | `object`` | | he value to convert to decimal. |
ecimalSymbol | | `string`` | | he decimal symbol to be used. Can be a comma , a dot . or a locale tag like de, en, fr for example. If null or empty, the locale tag of the currently logged-in user is used. If this is null, locale tag de is used as default. |
Example
toDecimal(value,pattern,decimalSymbol)
Converts the given value to a decimal number by applying the given pattern and locale.
Returns
bigdecimal
- The value as decimal number ready for calculations.
Parameters
Name | Type | Description |
---|---|---|
alue | | `object`` | | he value to convert to decimal. |
attern | | `string`` | | he decimal pattern to apply. For example: #.### |
ecimalSymbol | | `string`` | | he decimal symbol to be used. Can be a comma , a dot . or a locale tag like de, en, fr for example. If null or empty, the locale tag of the currently logged-in user is used. If this is null, locale tag de is used as default. |
Example
toDecimalString(value,pattern,decimalSymbol)
Formats a given number to a decimal string using the given decimal pattern and
locale tag like de, en, fr aso.
Returns
string
- The decimal string.
Parameters
Name | Type | Description |
---|---|---|
alue | | `object`` | | he decimal number to format to a string. |
attern | | `string`` | | he decimal pattern like #.## for example. |
ecimalSymbol | | `string`` | | he decimal symbol to be used. Can be a comma , a dot . or a locale tag like de, en, fr for example. If null or empty, the locale tag of the currently logged-in user is used. If this is null, locale tag de is used as default. |
Example
toDecimalString(value,decimalSymbol)
Formats a given number to a decimal string using the given locale tag like de, en, fr aso.
Returns
string
- The decimal string.
Parameters
Name | Type | Description |
---|---|---|
alue | | `object`` | | he decimal number to format to a string. |
ecimalSymbol | | `string`` | | he decimal symbol to be used. Can be a comma , a dot . or a locale tag like de, en, fr for example. If null or empty, the locale tag of the currently logged-in user is used. If this is null, locale tag de is used as default. |
Example
toByteArray(object)
Converts the given object to a byte array.
Returns
byte[]
- The byte array.
Parameters
Name | Type | Description |
---|---|---|
bject | | `object`` | | he object to convert. |
Example
@data
Provides utility functions inside a pipeline expression for simple CRUD and transformation data operations.
You can access the functions declared here in the PEL using <code>@data</code>
set(data,path,value)
Sets the given value on the given data object at the given element path where every item is separated by a dot.
If an item at the given path doesnt exist, it will be created automatically (is supported by given object).
For example to create a new entry person.name inside a given map, you could use:
<code>set(someMap, "person.name", "Some Name")</code>. This will create the nested map person with an entry of
type name in it.
Returns
object
- The data object with value set at the specific path.
Parameters
Name | Type | Description |
---|---|---|
ata | | `object`` | | he data object. |
ath | | `string`` | | he path inside the data object to set the value. |
alue | | `object`` | | he value to set. |
Example
put(map,key,value)
Expects the given data to be map-like structure and puts the given value under given key to it.
Overwrites any existing entry under this key.
Returns
object
- The map like data structure with the new entry added.
Parameters
Name | Type | Description |
---|---|---|
ap | | `object`` | | he map-like data structure. |
ey | | `object`` | | he key to add the value under. |
alue | | `object`` | | he value to add. |
Example
select(input,selections)
Applies the given selection string on the given input object in order to extract
data from the input object. If there is more than one selection string, puts the
result of each string into a new map entry whereas the key is the selection string
or the name from the "AS NAME" suffix (note the upper case AS). Examples of selection strings:
<ul>
<li>'person.firstName' = Extracts the firstName from the input object and returns the result as a
entry in the mapping using the key 'person.firstName'. If it is the only selection string, returns the
value directly.</li>
<li>'person.firstName AS name' = Extracts the firstName from the input object and returns the result as a
entry in the mapping using the key 'name'</li>
<li>'person.hobbies.size()' = Extracts the number of hobbies from the input object and returns the result as a
entry in the mapping using the key 'person.hobbies.size()'. If it is the only selection string, returns the
value directly.</li>
<li>'person.hobbies.size() AS numOfHobbies' = Extracts the number of hobbies from the input object and returns
the result as an entry in the mapping using the key 'numOfHobbies'</li>
</ul>
Returns
object
- The extracted data.
Parameters
Name | Type | Description |
---|---|---|
nput | | `object`` | | he input to apply the selection strings on. May not be null. |
elections | | `string`` | | ne or more selection strings. If null or empty, returns an empty map. |
Example
integerList(startInt,endInt)
Creates a new list and fills it with integers from startIndex up to endIndex.
For example a call of createListWithIntegers(2, 5) would return a list with these entries:
[2,3,4,5].
Returns
list<integer>
- A list of given size filled-up with digits.
Parameters
Name | Type | Description |
---|---|---|
tartInt | | `int`` | | he start index to fill the list. |
ndInt | | `int`` | | he end index to fill the list up to. |
Example
size(value)
Calculates the size of the given value regardless of the type it is.
Returns
long
- The size of the value. Returns a size of 0 in case the input value is null or cannot be counted.
Parameters
Name | Type | Description |
---|---|---|
alue | | `object`` | | he value to count for size. |
Example
isEmpty(data)
Checks if given data structure is null or empty.
For example:
<ul>
<li>If it is a list, returns true in case the list contains no entry or is null.</li>
<li>If it is a map, returns true in case the map contains no entry or is null.</li>
<li>If it is a node, returns true in case the node contains no entry or is null.</li>
<li>If it is a string, returns true in case the string contains no chars or is null.</li>
</ul>
Returns
boolean
- true in case the given list is null or empty.
Parameters
Name | Type | Description |
---|---|---|
ata | | `object`` | | he data structure to check. |
Example
has(data,attribute)
Checks whether given data object has an attribute, member or getter with given name.
Also supports property path syntax for recursive search on given data object.
Whereas each property name must be separated by a dot.
For example: person.firstName
Returns
boolean
- true in case the data object has given attribute.
Parameters
Name | Type | Description |
---|---|---|
ata | | `object`` | | he data object to scan for attribute. |
ttribute | | `string`` | | he attribute name to search for. |
Example
get(data,attribute)
Returns the value of the given data attribute or null in case it doesn't exist.
This way an additional attribute non-existent check can be avoided.
Returns
object
- The value from given data with given attribute name.
Parameters
Name | Type | Description |
---|---|---|
ata | | `object`` | | he data to read the value from. |
ttribute | | `string`` | | he attribute name to read from the data. |
Example
emptyObject()
Returns a new empty object (map).
Returns
map
- A new, empty object (map).
Example
emptyList()
Returns a new empty list.
Returns
list
- A new, empty list.
Example
keys(data)
Returns the keys of the given object at root level. Which could be a JSON object for example.
If the object doesn't have a key, returns empty list. Never null.
Returns
list<string>
- The list of key of this object.
Parameters
Name | Type | Description |
---|---|---|
ata | | `object`` | | key value structure. |
Example
type(data)
Returns the type of the given data object. Can be one of:
<ul>
<li>OBJECT = A (JSON) object.</li>
<li>ARRAY = A (JSON) array.</li>
<li>STRING = A (JSON) string.</li>
<li>NUMBER = A (JSON) number.</li>
<li>BOOLEAN = A (JSON) boolean.</li>
<li>NULL = A (JSON) null.</li>
</ul>
Returns
string
- The type of the data. Never null.
Parameters
Name | Type | Description |
---|---|---|
ata | | `object`` | | he data to check the type for. |
Example
isType(data,type)
Checks whether the given data is of given type. Valid type keys are:
<ul>
<li>OBJECT = A (JSON) object.</li>
<li>ARRAY = A (JSON) array.</li>
<li>STRING = A (JSON) string.</li>
<li>NUMBER = A (JSON) number.</li>
<li>BOOLEAN = A (JSON) boolean.</li>
<li>NULL = A (JSON) null.</li>
</ul>
Returns
boolean
- True in case the given data is of given type.
Parameters
Name | Type | Description |
---|---|---|
ata | | `object`` | | he data to check for the type. |
ype | | `string`` | | he type string to check for. |
Example
isArray(data)
Checks if given data is an array.
Returns
boolean
- true, if data is an array.
Parameters
Name | Type | Description |
---|---|---|
ata | | `object`` | | he data to check for. |
Example
isBoolean(data)
Checks if given data is a boolean.
Returns
boolean
- true, if data is a boolean.
Parameters
Name | Type | Description |
---|---|---|
ata | | `object`` | | he data to check for. |
Example
isNumber(data)
Checks if given data is a number.
Returns
boolean
- true, if data is a number.
Parameters
Name | Type | Description |
---|---|---|
ata | | `object`` | | he data to check for. |
Example
isObject(data)
Checks if given data is an object.
Returns
boolean
- true, if data is an object.
Parameters
Name | Type | Description |
---|---|---|
ata | | `object`` | | he data to check for. |
Example
isString(data)
Checks if given data is a string.
Returns
boolean
- true, if data is a string.
Parameters
Name | Type | Description |
---|---|---|
ata | | `object`` | | he data to check for. |
Example
isNull(data)
Checks if given data is null.
Returns
boolean
- true, if data is null.
Parameters
Name | Type | Description |
---|---|---|
ata | | `object`` | | he data to check for. |
Example
@date
Provides utility functions inside a pipeline expression for simple date and time handling.
You can access the functions declared here in the PEL using <code>@date</code>
now()
Returns the current time at server side formatted using the preferred zone and locale of the currently logged-in user.
Returns
string
- A formatted date time string.
Example
nowIso8601()
Returns the current time at server side formatted using the ISO8601 time format.
Returns
string
- Current date and time formatted as ISO8601. For example: <code>2021-05-30T17:30:00+02:00</code>
Example
now(format)
Returns the current time at server side formatted using the preferred zone and locale of the currently logged-in user.
Returns
string
- A formatted date time string.
Parameters
Name | Type | Description |
---|---|---|
ormat | | `string`` | | he format pattern like dd.MM.YY HH:mm:ss for example. |
Example
now(zoneId,locale)
Returns the current time for the given zone and formats it using the default format of the given locale.
Returns
string
- The formatted date time string.
Parameters
Name | Type | Description |
---|---|---|
oneId | | `string`` | | he zoneId to be used. See http://www.iana.org/time-zones for official reference of these names. |
ocale | | `string`` | | he locale to be used. |
Example
guessAndFormat(dateTimeString,outputFormat)
Tries to guess the given date time string format, converts it internally to a date-time object
and formats it finally to a string output using the given output format pattern.
Returns
string
- The formatted date time string.
Parameters
Name | Type | Description |
---|---|---|
ateTimeString | | `string`` | | he date-time string as input. |
utputFormat | | `string`` | | he output format pattern. Must comply with https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html. |
Example
format(inputDate,inputFormat,outputFormat)
Converts a given date string using the given inputFormat and converts it to the given outputFormat.
Returns
string
- The formatted date time string.
Parameters
Name | Type | Description |
---|---|---|
nputDate | | `string`` | | he input date string. |
nputFormat | | `string`` | | he input format pattern. Must comply with https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html. |
utputFormat | | `string`` | | he output format pattern. Must comply with https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html. |
Example
format(iso8601Date,format)
Converts a given ISO-8061 date string to a different format and returns it.
For example: An input date of "2030-01-10T20:00:00Z" with format of "dd.MM.yyyy" would result in "01.10.2030".
Returns
string
- The formatted date time string.
Parameters
Name | Type | Description |
---|---|---|
so8601Date | | `string`` | | he ISO-8061 formatted date to convert. |
ormat | | `string`` | | he format pattern. Must comply with https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html. |
Example
format(timestamp,format)
Converts a given unix timestamp to a formatted date time string and returns it.
Returns
string
- The formatted date time string.
Parameters
Name | Type | Description |
---|---|---|
imestamp | | `long`` | | he unix timestamp in millis to format. |
ormat | | `string`` | | he format pattern. Must comply with https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html. |
Example
year(dateString)
Tries to guess and extract the year of the given date string. This is not always working 100% since
the date formats can vary a lot.
Returns
string
- The guessed year from the given string like 2012 for example.
Parameters
Name | Type | Description |
---|---|---|
ateString | | `string`` | | date string like 31.02.2012, 31.02.12, 2012/01/31, 31-01-12, 31-01-2012, 2012-01-31 23:59:59, or 2001-07-04T12:08:56.235-0700. |
Example
timestamp()
Returns the current unix timestamp in millis.
Returns
long
- The current timestamp in millis.
Example
isExpired(iso8601Start,iso8601End,expiredInPercents)
Returns true, if the given amount of time is already expired.
Lets see this example: Given is a starttime of 1st January, 2020 an endttime of
11th January, 2020 and an expiredInPercents of 0,7 (70%). In this case the method would return
true on 9th of January, 2020 but false on 3rd of January, 2020.
Also see {@link DateTimeUtil#isExpired(Instant, Instant, float)}.
Returns
boolean
- true, if the given amount of time is already expired.
Parameters
Name | Type | Description |
---|---|---|
so8601Start | | `object`` | | he start time for the time range in ISO-8601 format. |
so8601End | | `object`` | | he endtime for the time range in ISO-8601 format. |
xpiredInPercents | | `float`` | | he percentage as float (e.g. 0,9 = 90%), the range is already expired. |
Example
isExpired(iso8601Start,iso8601End,expiredInPercents,currentDate)
Returns true, if the given amount of time is already expired.
Lets see this example: Given is a starttime of 1st January, 2020 an endttime of
11th January, 2020 and an expiredInPercents of 0,7 (70%). In this case the method would return
true on 9th of January, 2020 but false on 3rd of January, 2020.
Also see {@link DateTimeUtil#isExpired(Instant, Instant, float)}.
Returns
boolean
- true, if the given amount of time is already expired.
Parameters
Name | Type | Description |
---|---|---|
so8601Start | | `object`` | | he start time for the time range in ISO-8601 format. |
so8601End | | `object`` | | he endtime for the time range in ISO-8601 format. |
xpiredInPercents | | `float`` | | he percentage as float (e.g. 0,9 = 90%), the range is already expired. |
urrentDate | | `object`` | | he current date, the calculation must use. |
Example
isOverdue(dueDate,currentDate)
Returns true in case if dueDate > currentDate.
Returns
boolean
- true in case the give current date is overdue.
Parameters
Name | Type | Description |
---|---|---|
ueDate | | `object`` | | he due after overdue is true. |
urrentDate | | `object`` | | he current date. |
Example
isOverdue(dueDate)
Returns true in case if dueDate > currentDate.
For currentDate the current date and time from the system is used.
Returns
boolean
- true in case the give current date is overdue.
Parameters
Name | Type | Description |
---|---|---|
ueDate | | `object`` | | he due after overdue is true. |
Example
parseToInstant(dateTime)
Parses the given date time object to an instant date time object.
Returns
instant
- The instant parsed from the given date time object.
Parameters
Name | Type | Description |
---|---|---|
ateTime | | `object`` | | he date time object to be parsed. |
Example
beginOfYear(yearOffset)
Returns the epoch timestamp in millis of the beginning of the year relative to current year
with respect of the user's preference for time zone.
For example to get the timestamp of the beginning of the current year,
you would set yearOffset=0. To get the beginning timestamp of
last year, you would set yearOffset=-1. To get the beginning timestamp of
next year, you would set yearOffset=1.
Returns
long
- The beginning of the year relative to current year as epoch millis,
with hours, minutes, seconds and millis reset to 0.
Parameters
Name | Type | Description |
---|---|---|
earOffset | | `int`` | | he years to be added (positive value) or subtracted (negative value) from current year. |
Example
beginOfYear(timestamp,yearOffset)
Returns the epoch timestamp in millis of the beginning of the year relative to given timestamp
with respect of the user's preference for time zone.
For example to get the timestamp of the beginning of the current year,
you would set timestamp=null, yearOffset=0. To get the beginning timestamp of
last year, you would set timestamp=null, yearOffset=-1. To get the beginning timestamp of
next year, you would set timestamp=null, yearOffset=1.
Returns
long
- The beginning of the year relative to given timestamp as epoch millis,
with hours, minutes, seconds and millis reset to 0.
Parameters
Name | Type | Description |
---|---|---|
imestamp | | `long`` | | he epoch millis to calculate the beginning of the year from. If null, the current timestamp will be used. |
earOffset | | `int`` | | he years to be added (positive value) or subtracted (negative value) from given year. |
Example
beginOfMonth(monthOffset)
Returns the epoch timestamp in millis of the beginning of the month relative to current month
with respect of the user's preference for time zone.
For example to get the timestamp of the beginning of the current month,
you would set monthOffset=0. To get the beginning timestamp of
last month, you would set monthOffset=-1. To get the beginning timestamp of
next month, you would set monthOffset=1.
Returns
long
- The beginning of the month relative to current month as epoch millis,
with hours, minutes, seconds and millis reset to 0.
Parameters
Name | Type | Description |
---|---|---|
onthOffset | | `int`` | | he months to be added (positive value) or subtracted (negative value) from current month. |
Example
beginOfMonth(timestamp,monthOffset)
Returns the epoch timestamp in millis of the beginning of the month relative to given timestamp
with respect of the user's preference for time zone.
For example to get the timestamp of the beginning of the current month,
you would set timestamp=null, monthOffset=0. To get the beginning timestamp of
last month, you would set timestamp=null, monthOffset=-1. To get the beginning timestamp of
next month, you would set timestamp=null, monthOffset=1.
Returns
long
- The beginning of the month relative to given timestamp as epoch millis,
with hours, minutes, seconds and millis reset to 0.
Parameters
Name | Type | Description |
---|---|---|
imestamp | | `long`` | | he epoch millis to calculate the beginning of the month from. If null, the current timestamp will be used. |
onthOffset | | `int`` | | he months to be added (positive value) or subtracted (negative value) from given month. |
Example
beginOfWeek(weekStartDay,weekOffset)
Returns the epoch timestamp in millis of the beginning of the week relative to current week
with respect of the user's preference for time zone.
For example to get the timestamp of the beginning of the current week with Monday as start day,
you would set weekStartDay=1, weekOffset=0. To get the beginning timestamp of
last week, you would set weekStartDay=1, weekOffset=-1. To get the beginning timestamp of
next week, you would set weekStartDay=1, weekOffset=1.
Returns
long
- The beginning of the week relative to current week as epoch millis,
with hours, seconds and millis reset to 0.
Parameters
Name | Type | Description |
---|---|---|
eekStartDay | | `integer`` | | he start day of the week as int from Monday(1) to Sunday(7). If null or negative, Monday(1) is used. |
eekOffset | | `int`` | | he weeks to be added (positive value) or subtracted (negative value) from current week. |
Example
beginOfWeek(timestamp,weekStartDay,weekOffset)
Returns the epoch timestamp in millis of the beginning of the week relative to given timestamp
with respect of the user's preference for time zone.
For example to get the timestamp of the beginning of the current week with Monday as start day,
you would set timestamp=null, weekStartDay=null, weekOffset=0. To get the beginning timestamp of
last week, you would set timestamp=null, weekStartDay=null, weekOffset=-1. To get the beginning timestamp of
next week, you would set timestamp=null, weekStartDay=null, weekOffset=1.
Returns
long
- The beginning of the week relative to given timestamp as epoch millis, with hours, seconds
and millis reset to 0.
Parameters
Name | Type | Description |
---|---|---|
imestamp | | `long`` | | he epoch millis to calculate the beginning of the week from. If null, the current timestamp will be used. |
eekStartDay | | `integer`` | | he start day of the week as int from Monday(1) to Sunday(7). If null or negative, Monday(1) is used. |
eekOffset | | `int`` | | he weeks to be added (positive value) or subtracted (negative value) from given week. If you would like to know the start date of the week before for example, you would set this to -1. And for two weeks before you would set it to -2, aso. And to detect the beginning of the week of the given timestamp, you would set it to 0. |
Example
beginOfDay(dayOffset)
Returns the epoch timestamp in millis of the beginning of the day relative to current day
with respect of the user's preference for time zone.
For example to get the timestamp of the beginning of the current day,
you would set dayOffset=0. To get the beginning timestamp of
yesterday, you would set dayOffset=-1. To get the beginning timestamp of
tomorrow, you would set dayOffset=1.
Returns
long
- The beginning of the day relative to given current day as epoch millis,
with hours, seconds and millis reset to 0.
Parameters
Name | Type | Description |
---|---|---|
ayOffset | | `int`` | | he days to be added (positive value) or subtracted (negative value) from current day. |
Example
beginOfDay(timestamp,dayOffset)
Returns the epoch timestamp in millis of the beginning of the day relative to given timestamp
with respect of the user's preference for time zone.
For example to get the timestamp of the beginning of the current day,
you would set timestamp=null, dayOffset=0. To get the beginning timestamp of
yesterday, you would set timestamp=null, dayOffset=-1. To get the beginning timestamp of
tomorrow, you would set timestamp=null, dayOffset=1.
Returns
long
- The beginning of the day relative to given timestamp as epoch millis,
with hours, seconds and millis reset to 0.
Parameters
Name | Type | Description |
---|---|---|
imestamp | | `long`` | | he epoch millis to calculate the beginning of the day from. If null, the current timestamp will be used. |
ayOffset | | `int`` | | he days to be added (positive value) or subtracted (negative value) from given day. |
Example
@function
Provides utility functions inside a pipeline expression in order to access functions.
You can access the methods declared here in the PEL using <code>@function</code>
run(name,args)
Executes the FaaS function with given name and passes the given args to it.
Returns
jsonnode
- The result of the function in PIPEFORCE result format.
Parameters
Name | Type | Description |
---|---|---|
ame | | `string`` | | he name of the function to run. |
rgs | | `object`` | | he optional args to be passed to the function or null. |
Example
@hash
Provides utility functions inside a pipeline expression for simple hash handling.
You can access the functions declared here in the PEL using <code>@hash</code>
sha256(input)
Creates the SHA-256 hash from given input and returns it as hex string.
Returns
string
- The hash as hex string
Parameters
Name | Type | Description |
---|---|---|
nput | | `object`` | | he input data to create a hash from. Can be a string, a byte array or a collection of strings. |
Example
sha256Concat(separator,text)
Concatenates the given list of strings using the given separator and then calculates
the hash SHA-256 of the concatenated string.
Returns
string
- The hash as hex string
Parameters
Name | Type | Description |
---|---|---|
eparator | | `string`` | | he separator to be used to concat the string. If null, empty string will be used. |
ext | | `string`` | | he text (list) to concat into a string. |
Example
sha256Concat(separator,text)
Concatenates the given list of strings using the given separator and then calculates
the hash SHA-256 of the concatenated string.
Returns
string
- The hash as hex string
Parameters
Name | Type | Description |
---|---|---|
eparator | | `string`` | | he separator to be used to concat the string. If null, empty string will be used. |
ext | | `collection`` | | he text (list) to concat into a string. |
Example
md5(input)
Creates the MD5 hash from given input and returns it as hex string.
Returns
string
- The hash as hex string
Parameters
Name | Type | Description |
---|---|---|
nput | | `object`` | | he input data to create a hash from. Can be a string, a byte array or a collection of strings. |
Example
md5Concat(separator,text)
Concatenates the given list of strings using the given separator and then calculates
the hash MD5 of the concatenated string.
Returns
string
- The hash as hex string
Parameters
Name | Type | Description |
---|---|---|
eparator | | `string`` | | he separator to be used to concat the string. If null, empty string will be used. |
ext | | `string`` | | he text (list) to concat into a string. |
Example
md5Concat(separator,text)
Concatenates the given list of strings using the given separator and then calculates
the hash MD5 of the concatenated string.
Returns
string
- The hash as hex string
Parameters
Name | Type | Description |
---|---|---|
eparator | | `string`` | | he separator to be used to concat the string. If null, empty string will be used. |
ext | | `collection`` | | he text (list) to concat into a string. |
Example
sha512(input)
Creates the SHA-512 hash from given input and returns it as hex string.
Returns
string
- The hash as hex string
Parameters
Name | Type | Description |
---|---|---|
nput | | `object`` | | he input data to create a hash from. Can be a string, a byte array or a collection of strings. |
Example
sha512Concat(separator,text)
Concatenates the given list of strings using the given separator and then calculates
the hash SHA-512 of the concatenated string.
Returns
string
- The hash as hex string
Parameters
Name | Type | Description |
---|---|---|
eparator | | `string`` | | he separator to be used to concat the string. If null, empty string will be used. |
ext | | `string`` | | he text (list) to concat into a string. |
Example
sha512Concat(separator,text)
Concatenates the given list of strings using the given separator and then calculates
the hash SHA-512 of the concatenated string.
Returns
string
- The hash as hex string
Parameters
Name | Type | Description |
---|---|---|
eparator | | `string`` | | he separator to be used to concat the string. If null, empty string will be used. |
ext | | `collection`` | | he text (list) to concat into a string. |
Example
@iam
Provides utility functions inside a pipeline expression for accessing IAM information.
You can access the functions declared here in the PEL using <code>@iam</code>
userByUuid(userUuid)
Returns the user by given uuid or null in case no such user exists.
Returns
user
- The user with given uuid or null.
Parameters
Name | Type | Description |
---|---|---|
serUuid | | `string`` | | he uuid of the user. |
Example
userByUsername(username)
Returns the user by given username or null in case no such user exists.
Returns
user
- The user with given username or null.
Parameters
Name | Type | Description |
---|---|---|
sername | | `string`` | | he username of the user. |
Example
userByEmail(email)
Returns the user by given email or null in case no such user exists.
Returns
user
- The user with given email or null.
Parameters
Name | Type | Description |
---|---|---|
mail | | `string`` | | he email of the user. |
Example
@instance
Provides utility functions inside a pipeline expression to return information about the current instance.
You can access the functions declared here in the PEL using <code>@instance</code>
env(name)
Returns the value of the environment variable with given name.
Note that access to environment variables containing one of these substrings (case-insensitive) in the name
will be accessibly only by systemuser:
<ul>
<li>AUTH</li>
<li>BEARER</li>
<li>CREDENTIAL</li>
<li>PASS</li>
<li>SECRET</li>
<li>SECURE</li>
<li>SEED</li>
<li>TOKEN</li>
</ul>
Returns
string
- The value of the environment variable or null in case it doesn't exist or is not allowed to be accessed.
Parameters
Name | Type | Description |
---|---|---|
ame | | `string`` | | he name of the environment variable. |
Example
domain()
Returns the domain, this hub instance is currently running in. For example: pipeforce.net
Returns
string
- The domain name of this instance.
Example
namespace()
Returns the namespace, this hub instance is currently running in. For example: latest
Returns
string
- The namespace of this instance.
Example
url(serviceName)
Returns the full url for a given service in the current namespace. For example:
a call with 'workflow' could return 'http://workflow-myamespace.pipeforce.net' depending
on the namespace and domain configured for this instance.
Returns
string
- The full url of the service.
Parameters
Name | Type | Description |
---|---|---|
erviceName | | `string`` | | he PIPEFORCE service name. |
Example
url()
Returns the base url of the instance. For example: https://acme.pipeforce.net.
Returns
string
- The base url of this instance.
Example
profiles()
The active profiles this instance is tagged with to run as.
Returns
list<string>
- The active profiles as a list or empty list. Never null.
Example
hasProfile(profiles)
Checks if this instance contains at least one profile from the given list.
Returns
boolean
- true, in case at least one profile name from given list matches with a profile of the instance.
Parameters
Name | Type | Description |
---|---|---|
rofiles | | `object`` | | n array or comma separated list of profiles to check. |
Example
stage()
Returns the stage the instance is running in.
Returns
string
- The stage. Usually this is one of local, dev, qa, prod.
Example
version()
Returns the version number of this instance.
Returns
string
- The version number.
Example
build()
Returns the build ID of this instance.
Returns
string
- The build ID.
Example
edition()
Returns edition of this instance.
Returns
string
- The edition name.
Example
storage()
Returns the storage info reserved for this instance (hub service).
Returns
string
- The storage for the hub service.
Example
tag()
Returns the full build tag of this instance.
Returns
string
- The full build tag.
Example
uptime()
Returns the uptime of this instance. Note: Since PIPEFORCE is a clustered environment,
update of a single hub service and the cluster could differ.
Returns
long
- The timestamp, when this instance was started (hub service).
Example
defaultImageRepo(image)
Prefixes the given image by the path of the default container image repository.
When running inside GKE this is typically: gcr.io/pipeforce/[image]
Returns
string
- The given image name prefixed with the default repo.
Or the default repo prefix alone in case no image arg was given.
Parameters
Name | Type | Description |
---|---|---|
mage | | `string`` | | he image name to be prefixed by the repo. |
Example
@json
Provides functions inside a pipeline expression in order to read and change JSON documents.
You can access the functions declared here in the PEL using <code>@json</code>
load(source)
Loads the given source and converts it into a JSONful data object.
Returns
jsonnode
- The content data behind the source, converted to a JSONful data object.
Parameters
Name | Type | Description |
---|---|---|
ource | | `object`` | | he JSON source to load. |
Example
path(json,query)
Applies a given JsonPath query to the given json object and returns the result.
Learn more about the JsonPath syntax: https://goessner.net/articles/JsonPath/
Returns
object
- The result from the JsonPath query.
Parameters
Name | Type | Description |
---|---|---|
son | | `object`` | | he JSON object to apply the query to. |
uery | | `string`` | | he query to be applied. |
Example
stringify(json)
Converts the given JSON or map object into a JSON string.
Returns
string
- The JSON string.
Parameters
Name | Type | Description |
---|---|---|
son | | `object`` | | he JSON object to be converted to a string. |
Example
object()
Creates a new, empty JSON object (as map) and returns it.
Returns
map
- A new JSON node (as map)
Example
array()
Creates a new, empty JSON array (as list) and returns it.
Returns
list
- A new JSON array (as list)
Example
@list
Provides utility functions inside a pipeline expression for simple lists handling.
You can access the functions declared here in the PEL using <code>@list</code>
first(value)
Returns the first element in list.
Returns
object
- The first element from list or null in case list is null or empty.
Parameters
Name | Type | Description |
---|---|---|
alue | | `object`` | | ny supported list object. |
Example
last(value)
Returns the last element in list.
Returns
object
- The last element from list or null in case list is null or empty.
Parameters
Name | Type | Description |
---|---|---|
alue | | `object`` | | ny supported list object. |
Example
size(list)
Returns the size of the given list.
DEPRECATED. Use @data.size(...)
instead.
Returns
int
- The size of the list. 0 in case list is null or unknown type.
Parameters
Name | Type | Description |
---|---|---|
ist | | `object`` | | he list. |
Example
empty(list)
Checks if given list is null or empty.
DEPRECATED. Use @data.isEmpty(...)
instead.
Returns
boolean
- true in case the given list is null or empty.
Parameters
Name | Type | Description |
---|---|---|
ist | | `object`` | | he list to check. |
Example
sublist(value,expression)
Utility to get a subset from a list using a list expression. Examples:
<ul>
<li>last - Returns the last element in the list.</li>
<li>first - Returns the first element in the list.</li>
<li><code>START:END</code> - Returns all elements as a sublist from START (inclusive) up to the
given END (inclusive).</li>
<li><code>INDEX:</code> - Returns all elements as a sublist from INDEX (inclusive) up to the
end of the list.</li>
<li><code>:INDEX</code> - Returns all elements as a sublist from 0 up to INDEX (inclusive).</li>
</ul>
Returns
object
- The sublist.
Parameters
Name | Type | Description |
---|---|---|
alue | | `object`` | | ny list object. |
xpression | | `string`` | | he list expression. |
Example
add(list,element)
Appends the given element to the end of the given list.
This method is useful in case the list implementation is not clear since
this method can detect it (for example whether it is a collection or a JSON array).
By default doesn't add null items.
Returns
collection
- The input list with new element or a new list in case the input list was unmodifiable.
Parameters
Name | Type | Description |
---|---|---|
ist | | `object`` | | he list to append to. |
lement | | `object`` | | he element to append. |
Example
add(list,element,ignoreNulls)
Appends the given element to the end of the given list.
This method is useful in case the list implementation is not clear since
this method can detect it (for example whether it is a collection or a JSON array).
Returns
collection
- The input list with new element or a new list in case the input list was unmodifiable.
Parameters
Name | Type | Description |
---|---|---|
ist | | `object`` | | he list to append to. |
lement | | `object`` | | he element to append. |
gnoreNulls | | `boolean`` | | f true, null items will not be added. |
Example
contains(list,needles)
Searches the given list for the given needle.
Returns
boolean
- True if list contains at least one of needle items.
Parameters
Name | Type | Description |
---|---|---|
ist | | `object`` | | he list to search in. |
eedles | | `object`` | | he items to search for. Can also be a list of items. |
Example
create()
Creates a new empty list.
Returns
list
- A new, empty, modifiable list.
Example
copy(list)
Creates a flat copy of given list and returns it as new list.
Returns
list
- A new, modifiable list with items copied over from given list.
Parameters
Name | Type | Description |
---|---|---|
ist | | `collection`` | | he list to create a flat copy from. |
Example
@path
Provides utility functions inside a pipeline expression for simple path calculations.
You can access the functions declared here in the PEL using <code>@path</code>
join(pathItems)
Concats all given items to a single path. Also see {@link PathUtil#path(Object...)}.
Returns
string
- The joined path items as a path string.
Parameters
Name | Type | Description |
---|---|---|
athItems | | `object`` | | he path items to join as list. |
Example
extension(path)
Returns the extension of a given filename (path).
Returns
string
- The extension of the path without period (for example: txt)
Parameters
Name | Type | Description |
---|---|---|
ath | | `string`` | | he path string. |
Example
basename(path)
Returns the base name of a file without the extension. Also strips-off any
ID form the filename.
For example: "/folder/invoice.pdf" would return "invoice" and
"/folder/invoice_ID-3fgh343.pdf" would return "invoice"
Returns
string
- The base name of the path.
Parameters
Name | Type | Description |
---|---|---|
ath | | `string`` | | he path string. |
Example
@property
Provides functions inside a pipeline expression in order to read properties from the property store.
You can access the functions declared here in the PEL using <code>@property</code>
value(key)
Returns the property value by given key from the property store.
Returns
object
- The value of the property with given key or null in case property doesnt exist or has null value.
Parameters
Name | Type | Description |
---|---|---|
ey | | `string`` | | he property key |
Example
values(pattern)
Returns the values of all properties matching the given key pattern.
Returns
list<object>
- A list of values of all properties matching the given key pattern.
Parameters
Name | Type | Description |
---|---|---|
attern | | `string`` | | he property key pattern to match. |
Example
updateValue(key,value)
Updates the value of a property under given key.
Returns
void
Parameters
Name | Type | Description |
---|---|---|
ey | | `string`` | | he key of the property to update. |
alue | | `object`` | | he value of the property to update. |
Example
get(key)
Returns the property with given key as object.
Returns
property
- The property with given key or null in case no such property has been found.
Parameters
Name | Type | Description |
---|---|---|
ey | | `string`` | | he property key. |
Example
lazy(key)
Returns the value of the property as a {@link LazyUriMap} map in case the result
is a JSON document or its fragment. If uri fragment references leaf, primitive value is returned.
In all other cases an exception is thrown.
Fragment part of uri is evaluated as a SPEL against property value.
Returns
object
- The lazy map.
Parameters
Name | Type | Description |
---|---|---|
ey | | `string`` | | he property key with optional fragment reference in form 'global/pathsegment1/pathsegment...#fragment' |
Example
@resolve
Provides utility functions inside a pipeline expression for simple uri resolving.
You can access the functions declared here in the PEL using <code>@uri</code>
uri(uri)
Resolves the given uri to its object representation. Supported uri schemes:
<ul>
<li><code>uri:user:</code>Resolves to an user object.</li>
<li><code>uri:pipeline:</code>Resolves the given path, pointing to a persisted pipeline, executes it
and returns the body result.</li>
<li><code>uri:property:</code> Resolves the given property key path and returns it from the storage.</li>
</ul>
Returns
object
- The object representation of the uri.
Parameters
Name | Type | Description |
---|---|---|
ri | | `string`` | | he uri to be resolved. |
Example
@script
Provides utility functions inside a pipeline expression execute inline scripts.
You can access the functions declared here in the PEL using <code>@script</code>
groovy(script,args)
Evaluates the given groovy script.
Returns
object
- The evaluation result.
Parameters
Name | Type | Description |
---|---|---|
cript | | `string`` | | he script to execute |
rgs | | `object`` | | he variables to be passed to the script as args (read-only!) |
Example
groovy(script)
Evaluates the given groovy script.
Returns
object
- The evaluation result.
Parameters
Name | Type | Description |
---|---|---|
cript | | `string`` | | he script to execute |
Example
@text
Provides utility functions inside a pipeline expression for simple calculations of lists.
You can access the functions declared here in the PEL using <code>@calc</code>
upperCase(text)
Converts the given text value to upper case.
Returns
string
- The upper case text.
Parameters
Name | Type | Description |
---|---|---|
ext | | `object`` | | he text to convert. |
Example
lastIndexOf(text,needle)
Returns the index of last occurrence of needle in the given text.
Returns
int
- The index of needle inside text or -1 in case it was not found or input was null.
Parameters
Name | Type | Description |
---|---|---|
ext | | `object`` | | he text to search for occurrence. |
eedle | | `object`` | | he text to search for. |
Example
lastIndexOf(text,needle,offset)
Returns the index of last occurrence of needle in the given text.
Returns
int
- The index of needle inside text or -1 in case it was not found or input was null.
Parameters
Name | Type | Description |
---|---|---|
ext | | `object`` | | he text to search for occurrence. |
eedle | | `object`` | | he text to search for. |
ffset | | `int`` | | he index to start search from. |
Example
indexOf(text,needle)
Returns the index of the first occurrence of needle in the given text.
Returns
int
- The index of first occurrence of needle inside text or -1 in case it was not found or input was null.
Parameters
Name | Type | Description |
---|---|---|
ext | | `object`` | | he text to search for occurrence. |
eedle | | `object`` | | he text to search for. |
Example
indexOf(text,needle,offset)
Returns the index of the first occurrence of needle in the given text.
Returns
int
- The index of first occurrence of needle inside text or -1 in case it was not found or input was null.
Parameters
Name | Type | Description |
---|---|---|
ext | | `object`` | | he text to search for occurrence. |
eedle | | `object`` | | he text to search for. |
ffset | | `int`` | | he index to start search from. |
Example
prefix(text,stop)
Returns the part from the beginning of the given text up to the stop word.
For example "Foo Bar" with stop word of " " would return "Foo" as prefix.
Returns
string
- The part of text up to the first occurrence of the stop word.
Parameters
Name | Type | Description |
---|---|---|
ext | | `object`` | | he text. |
top | | `object`` | | he stop word. |
Example
suffix(text,stop)
Returns the part from the stop word of the given text up to the end of the word.
For example "Foo Bar" with stop word of " " would return "Bar" as suffix.
Returns
string
- The part of text from stop word up to end of the text.
Parameters
Name | Type | Description |
---|---|---|
ext | | `object`` | | he text. |
top | | `object`` | | he stop word. |
Example
lowerCase(text)
Converts the given text value to lower case.
Returns
string
- The lower case text.
Parameters
Name | Type | Description |
---|---|---|
ext | | `object`` | | he text. |
Example
isEmpty(text)
Returns true if given text is empty or null.
Returns
boolean
- true, in case the given text is an empty string or null.
Parameters
Name | Type | Description |
---|---|---|
ext | | `object`` | | he text. |
Example
shorten(text,length)
Shorts the given string and adds ... at the end.
Returns
string
- The shortened text.
Parameters
Name | Type | Description |
---|---|---|
ext | | `object`` | | he text to shorten. |
ength | | `int`` | | he length. |
Example
length(text)
Returns the len of the given text. In case the text is null, 0 is returned.
Returns
int
- The length of the text.
Parameters
Name | Type | Description |
---|---|---|
ext | | `object`` | | he text. |
Example
contains(text,needles)
Checks whether given text contains at least one of given needle texts, ignoring case.
Also value and text can be null.
Returns
boolean
- true in case text contains needle.
Parameters
Name | Type | Description |
---|---|---|
ext | | `object`` | | he text to search in. |
eedles | | `string`` | | comma separated list of needles to search inside text. |
Example
lang(text)
Tries to detect the language of given text.
Returns
string
- The detected language, one of: GERMAN, ENGLISH, FRENCH, UNKNOWN.
Parameters
Name | Type | Description |
---|---|---|
ext | | `object`` | | he text to detect the language for. |
Example
random(size)
Creates a random alphanumeric string of given size. Characters will be used from
a set of Latin alphabetic characters (a-z, A-Z) and the digits 0-9. No special chars.
Returns
string
- The random string.
Parameters
Name | Type | Description |
---|---|---|
ize | | `int`` | | he length of the random string. |
Example
uuid()
Creates a new uuid with 32 digits and returns it as hexadecimal string.
For example: 66a637cc-19fc-4145-98c5-1a1b0bf010be
See RFC for specification: RFC 4122: A Universally Unique IDentifier (UUID) URN Namespace
Returns
string
- The new random uuid.
Example
toHtml(text)
Converts the given text to an HTML fragment. Replaces &, gt and lt signs, keeps line breaks
and converts links to href elements.
Returns
string
- The HTML result.
Parameters
Name | Type | Description |
---|---|---|
ext | | `object`` | | he text to convert to HTML. |
Example
append(basetext,text)
Appends the given text to the given base text.
If one of the parts is null or empty, returns the other part only, without "null" concatenation.
Returns
string
- basetext + text
Parameters
Name | Type | Description |
---|---|---|
asetext | | `object`` | | he base text to append to. |
ext | | `object`` | | he text to append. |
Example
concat(separator,collection)
Concatenates the given list of objects using the given separator.
Ignores null items.
Returns
string
- The concatenated items as a string.
Parameters
Name | Type | Description |
---|---|---|
eparator | | `string`` | | he separator. |
ollection | | `object`` | | he collection of items to concat. |
Example
concat(separator,items)
Treats the given items as a list of texts and concats these items using the given separator.
Ignores null items.
Returns
string
- The concatenated items as a string.
Parameters
Name | Type | Description |
---|---|---|
eparator | | `string`` | | he separator between the items. |
tems | | `object`` | | he collection of items. |
Example
commajoin(collection)
Same as #concat(separator, items) but with comma as default separator.
Returns
string
- The comma separated string of concatenated items.
Parameters
Name | Type | Description |
---|---|---|
ollection | | `object`` | | he collection of items to concatenate. |
Example
format(pattern,args)
Formats the given text using the given pattern and input args.
Returns
string
- The formatted string.
Parameters
Name | Type | Description |
---|---|---|
attern | | `string`` | | he format pattern to apply. Must be of the Formatter Syntax of Java. See: https://docs.oracle.com/javase/8/docs/api/java/util/Formatter.html |
rgs | | `object`` | | he args to be passed to the format pattern. |
Example
leftPad(text,size)
Left pad a text with spaces (' ').
The text is padded to the size of size.
StringUtils.leftPad(null, *) = null
StringUtils.leftPad("", 3) = " "
StringUtils.leftPad("bat", 3) = "bat"
StringUtils.leftPad("bat", 5) = " bat"
StringUtils.leftPad("bat", 1) = "bat"
StringUtils.leftPad("bat", -1) = "bat"
Returns
string
- The padded string.
Parameters
Name | Type | Description |
---|---|---|
ext | | `string`` | | he text to add the padding. |
ize | | `int`` | | he size to pad the text to. |
Example
leftPad(text,size,padChar)
Left pad a text with a specified character.
Pad to a size of size.
StringUtils.leftPad(null, *, *) = null
StringUtils.leftPad("", 3, 'z') = "zzz"
StringUtils.leftPad("bat", 3, 'z') = "bat"
StringUtils.leftPad("bat", 5, 'z') = "zzbat"
StringUtils.leftPad("bat", 1, 'z') = "bat"
StringUtils.leftPad("bat", -1, 'z') = "bat"
Returns
string
- The padded string.
Parameters
Name | Type | Description |
---|---|---|
ext | | `string`` | | he text to add the padding. |
ize | | `int`` | | he size to pad the text to. |
adChar | | `char`` | | he char to be used for padding. |
Example
rightPad(text,size)
Right pad a text with spaces (' ').
The test is padded to the size of size.
StringUtils.rightPad(null, *) = null
StringUtils.rightPad("", 3) = " "
StringUtils.rightPad("bat", 3) = "bat"
StringUtils.rightPad("bat", 5) = "bat "
StringUtils.rightPad("bat", 1) = "bat"
StringUtils.rightPad("bat", -1) = "bat"
Returns
string
- The padded string.
Parameters
Name | Type | Description |
---|---|---|
ext | | `string`` | | he text to add the padding. |
ize | | `int`` | | he size to pad the text to. |
Example
rightPad(text,size,padChar)
Right pad a text with a specified character.
The text is padded to the size of size.
StringUtils.rightPad(null, *, *) = null
StringUtils.rightPad("", 3, 'z') = "zzz"
StringUtils.rightPad("bat", 3, 'z') = "bat"
StringUtils.rightPad("bat", 5, 'z') = "batzz"
StringUtils.rightPad("bat", 1, 'z') = "bat"
StringUtils.rightPad("bat", -1, 'z') = "bat"
Returns
string
- The padded string.
Parameters
Name | Type | Description |
---|---|---|
ext | | `string`` | | he text to add the padding. |
ize | | `int`` | | he size to pad the text to. |
adChar | | `char`` | | he char to be used for padding. |
Example
concatAndFormat(separator,collection,pel)
Similar to #concat(text1, Object...) but additionally applies the given PEL expression on
each list entry before it gets concatenated. This is useful for example to convert each entry in
the list before adding it to the resulting string. For example to remove whitespaces on each entry.
Returns
string
- The concatenated string.
Parameters
Name | Type | Description |
---|---|---|
eparator | | `string`` | | he separator. |
ollection | | `object`` | | he collection of items to concatenate. |
el | | `string`` | | he pipeline expression without wrapping #{ and } |
Example
startsWith(text,prefix)
Tests the given text whether it starts with given prefix.
Returns
boolean
- true if given text starts with the second parameter provided
Parameters
Name | Type | Description |
---|---|---|
ext | | `string`` | | he text |
refix | | `string`` | | he prefix to test |
Example
replaceAll(text,needle,replacement)
Replace all occurrences of a needle text with replacement text.
Returns
string
- The text with replacements applied.
Parameters
Name | Type | Description |
---|---|---|
ext | | `object`` | | he text to apply replacements. |
eedle | | `string`` | | he needle text matching all replacement sources. |
eplacement | | `string`` | | he string to be substituted for each match. |
Example
substring(text,beginIndex)
Returns a substring from the given text,
starting at beginIndex up to the end of the text.
Returns
string
- The substring from given text, null in case text is null or empty string in
case text contains no such substring range.
Parameters
Name | Type | Description |
---|---|---|
ext | | `object`` | | he text to return substring from. |
eginIndex | | `int`` | | he 0-based index to start the substring (inclusive). |
Example
substring(text,beginIndex,endIndex)
Returns a substring from the given text,
starting at beginIndex up to endIndex.
Returns
string
- The substring from given text or empty string in case text contains no such substring range.
Parameters
Name | Type | Description |
---|---|---|
ext | | `object`` | | he text to return substring from. |
eginIndex | | `int`` | | he 0-based index to start the substring (inclusive). |
ndIndex | | `int`` | | he 0-based index to end the substring (exclusive). |
Example
trim(text)
Removes any leading and ending whitespaces.
Returns
string
- The text with leading and ending whitespaces removed.
If input text was null, null is returned here.
Parameters
Name | Type | Description |
---|---|---|
ext | | `object`` | | he text to remove any whitespaces from. |
Example
isAllEmpty(text)
Returns true, if all of the given string values is empty: Is null, contains no characters or whitespaces only.
If at least one of it is not empty, returns false.
Returns
boolean
- True, if all are empty.
Parameters
Name | Type | Description |
---|---|---|
ext | | `object`` | | he list of text items to check. |
Example
toAlphaNumeric(text)
Converts the given text string into a string which contains only the
chars 0-9,a-z,A-Z and _. The conversion rule is:
Umlauts will become their non-umlaut representation. For example ä
becomes ae.
Any other special characters become underscore. For example ? becomes
_.
Returns
string
- The converted text or null in case input was null.
Parameters
Name | Type | Description |
---|---|---|
ext | | `object`` | | he text to convert. |
Example
firstCharUpper(text)
Makes the first char of the given text to upper case.
Returns
string
- The text with first char to upper case or null in case input was null.
Parameters
Name | Type | Description |
---|---|---|
ext | | `object`` | | he text to change. |
Example
firstCharLower(text)
Makes the first char of the given text to lower case.
Returns
string
- The text with first char to lower case or null in case input was null.
Parameters
Name | Type | Description |
---|---|---|
ext | | `object`` | | he text to change. |
Example
split(text,token)
Splits the given text into a list of items by given split token.
Returns
list<string>
- A list of split items or empty list in case input text or input token is null or empty.
Parameters
Name | Type | Description |
---|---|---|
ext | | `object`` | | he text to split to tokens. |
oken | | `object`` | | he token to split the text with. |
Example
replaceCharAt(text,pos,c)
Replaces the character at given position in the text and returns the new text.
Returns
string
- The new text with replaced char.
Parameters
Name | Type | Description |
---|---|---|
ext | | `string`` | | he text to replace the char on. |
os | | `int`` | | he position in the text to replace the char. If negative or >= text length, the original text is returned without any replacement. |
| | `char`` | | he new character. |
Example
matches(text,regexp)
Searches text for first regexp match.
Returns
list<string>
- On success, list with at least one item is returned. At index 0 the whole matched string is placed, and
then from index 1, all regexp capturing groups are listed.
An empty list is returned when no match.
Parameters
Name | Type | Description |
---|---|---|
ext | | `string`` | | o search for matches |
egexp | | `string`` | | egular expression to use |
Example
escapeCsvValue(value)
Returns a String value for a CSV column enclosed in double quotes, if required.
If the value contains a comma, newline or double quote, then the String value is returned enclosed in double quotes.
Any double quote characters in the value are escaped with another double quote.
If the value does not contain a comma, newline or double quote, then the String value is returned unchanged.
Returns
string
- value embeddable into csv column
Parameters
Name | Type | Description |
---|---|---|
alue | | `string`` | | nput text to escape |
Example
@uri
Provides utility functions inside a pipeline expression for simple uri resolving.
You can access the functions declared here in the PEL using <code>@uri</code>.
Note: This function library is deprecated. Use <code>@resolve</code> instead!
resolve(uri)
Note: This function is deprecated. Use @resolve.uri
instead.
Returns
object
- The object representation of the uri.
Parameters
Name | Type | Description |
---|---|---|
ri | | `string`` | | he uri to be resolved. |
Example
@user
Provides utility functions inside a pipeline expression for simple handling of the currently logged-in user.
You can access the functions declared here in the PEL using <code>@user</code>
username()
Returns the username of the currently logged-in user.
Returns
string
- The username of the user.
Example
uuid()
Returns the uuid of the logged-in user.
Returns
string
- The uuid of the user.
Example
hasPermission(permissionKeys)
Returns true in case the logged-in user has at least one of the listed permission.
Returns
boolean
- true in case the currently logged-in user has the permisson.
Parameters
Name | Type | Description |
---|---|---|
ermissionKeys | | `string`` | | list of permission keys (roles) to check for. |
Example
displayName()
Returns the default display name of the logged-in user which is the first non-empty value of:
firstName lastName, email, uuid. Note: Doesn't return the username for security reasons.
Returns
string
- The display name.
Example
emailAndDisplayName(object)
Returns the email and default display name of the given user object or empty string if
no such value exists.
Returns
string
- The email and display name in the format email@domain.tld (FirstName LastName).
Parameters
Name | Type | Description |
---|---|---|
bject | | `object`` | | he user object to extract email and displayName from. |
Example
emailAndDisplayName()
Returns the email and default display name of the currently logged-in user object or empty string if
no such value exists.
Returns
string
- The email and display name in the format email@domain.tld (FirstName LastName).
Example
displayName(object)
Tries to dynamically create a meaningful display name out of the given user object.
This user object can be of different format. The method tries to
automatically detect it and creates the displayName from it. If this
was not possible for some reason, an empty string is returned.
Returns
string
- The display name.
Parameters
Name | Type | Description |
---|---|---|
bject | | `object`` | | he user object. |
Example
email()
Returns the primary email address of the currently logged-in user.
Returns
string
- The email address as string.
Example
email(object)
Tries to detect the email from the given object.
Returns
string
- The email address as string.
Parameters
Name | Type | Description |
---|---|---|
bject | | `object`` | | n object like a user or a JSON containing an email property. |
Example
locale()
Returns the locale of the logged in user or null in case not set or could not be determined.
Returns
string
- The lower case locale (for example: de, en, fr, ...)
Example
firstName()
Returns the first name of the logged in user.
Returns
string
- The first name.
Example
lastName()
Returns the last name of the logged in user
Returns
string
- The last name.
Example
loggedIn()
Returns true in case the current user is authenticated (logged-in).
Returns
boolean
- true, in case authenticated.
Example
zone()
Returns the preferred zoneId of the currently logged-in user or null in case none was set.
The preferred zone is usually set in the users profile or by the client in use (e.g. the browser).
See {@link ZoneId#getAvailableZoneIds()} and here: http://www.iana.org/time-zones
Returns
string
- The zone as string.
Example
@xml
Provides functions inside a pipeline expression in order to read and change XML documents.
You can access the functions declared here in the PEL using <code>@xml</code>
xpath(document,xpath)
Evaluates given XPath expression of given document and returns the result as a list of DOM nodes.
Returns
list
- The result of the applied expression as a list of DOM nodes.
Parameters
Name | Type | Description |
---|---|---|
ocument | | `object`` | | he document to be applied. Can be a DOM or an XML string. |
path | | `string`` | | he expression to be applied. |
Example
xpathAsText(document,xpath)
Evaluates given XPath expression of given document and returns the result as a text value.
Returns
string
- The result of the applied expression as text.
Parameters
Name | Type | Description |
---|---|---|
ocument | | `object`` | | he document to be applied. Can be a DOM or an XML string. |
path | | `string`` | | he expression to be applied. |
Example
Report an Issue
:::tip Your help is needed!
In case you're missing something on this page, you found an error or you have an idea for improvement, please click here to create a new issue. Another way to contribute is, to click Edit this page below and directly add your changes in GitHub. Many thanks for your contribution in order to improve PIPEFORCE!
:::