Utils Reference


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

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

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

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

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

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

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

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

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

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

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

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

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

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