utils (provided FTL library)
utils
This ftl library contains generic utility functions.
indent (MACRO)
Indents the content with wanted level
Parameters:
level REQUIRED - the multiplier of indentations of size 4 whitespace
content OPTIONAL - the information to be presented (defaults to "")
ending OPTIONAL - the wanted line ending after the provided information (defaults to "")
Returns:
indentSize*level + content + ending
note: if content contains linefeed, the next lines will be indented also
adePrefixHandler (MACRO)
ADE prefix handler
Parameters:
prefix REQUIRED - the wanted prefix
Returns:
if prefix exists, will print: "prefix." otherwise doesn't print anything
filterItems (FUNCTION)
Item filter. Returns filtered items or an empty list.
Parameters:
items REQUIRED - the list of items to be filtered
filterKey REQUIRED - the filtering key on listed items
values REQUIRED - a list of values those are to be accepted
Returns:
the filtered items or an empty list.
If values - list contains "null" as searchable item, returns the items having no content on the search field
filterItemsOrAll (FUNCTION)
Item filter. Returns filtered items or all items if no values were given
Parameters:
items REQUIRED - the list of items to be filtered
filterKey REQUIRED - the filtering key on listed items
values REQUIRED - a list of values those are to be accepted
Returns:
the filtered or empty list if values-list has data, otherwise the original list
outputResult (MACRO)
Output formatter. Option to print result on single or multiple lines
Parameters:
inline REQUIRED - boolean whether to print the statement in one line or not
statement REQUIRED - the statement to be printed
Returns:
if inline is true every linefeed will be replaced with single space
otherwise the statement will be printed as is
encapsulateValue (FUNCTION)
Encapsulates value
Parameters:
value REQUIRED - the data to be processed
encapsulate OPTIONAL - boolean whether the value is to be encapsulated (defaults to true)
Returns:
the given value as trimmed and if encapsulate is true it is surrounded with square brackets, e.g. [value]
printableDataLineArrayItem (FUNCTION)
Provides singular list item, items are of form "data AS field"
Parameters:
isFirst REQUIRED - boolean whether the data is first in the array
data REQUIRED - the data to be printed
field REQUIRED - the field name of the array
showTargetField OPTIONAL - whether the output contains "AS field" - part at the end (defaults to true)
encapsulate OPTIONAL - whether the field needs to be encapsulated or not (defaults to false)
Returns:
if isFirst is not true, begin with comma, continue with "data AS field" and return this as singular list item
printableSetDataLineArrayItem (FUNCTION)
Provides singular list item, items are of form "field = data"
Parameters:
isFirst REQUIRED - boolean whether the data is first in the array
data REQUIRED - the data to be printed
field REQUIRED - the field name of the array
encapsulate OPTIONAL - whether the field needs to be encapsulated or not (defaults to false)
Returns:
if isFirst is not true, begin with comma, continue with "field = data" and return this as singular list item