sql (provided FTL library)
sql
This ftl library contains utility macros to generate SQL snippets.
generateWhereClause (MACRO)
Generates WHERE clause from given WHERE clause conditions
Parameters:
conditions REQUIRED - list of conditions
indentation OPTIONAL - the wanted indentation level (defaults to zero)
Returns:
if conditions is empty, returns nothing
otherwise prints:
WHERE with initial indentation and each entry of conditions list with
initial indentation + 1 on separate line and
from second item onwards will begin with AND
generateJoinClause (MACRO)
Generates JOIN clause from given JOIN clause conditions
Parameters:
conditions REQUIRED - list of conditions
indentation OPTIONAL - the wanted indentation level (defaults to zero)
Returns:
if conditions is empty, returns nothing
otherwise prints:
each entry of conditions list with initial indentation on separate line and
from second item onwards will begin with AND
generateOrderByClause (MACRO)
Generates ORDER BY clause from given ORDER BY clause conditions
Parameters:
conditions REQUIRED - list of conditions
indentation OPTIONAL - the wanted indentation level (defaults to zero)
Returns:
if conditions is empty, returns nothing
otherwise prints:
ORDER BY with initial indentation and each entry of conditions list with
initial indentation + 1 on separate line and
from second item onwards will begin with ,
generateEntityAttributeList (MACRO)
Generates list of attribute names
Parameters:
attributes REQUIRED - the attributes involved
attributeType OPTIONAL - attribute type only to be printed (defaults to "")
showDeletedStatusList OPTIONAL - whether to show the deleted or non-deleted attributes
prefix OPTIONAL - prefix to be used infront of the attribute name (defaults to "")
encapsulate OPTIONAL - whether the attributes are to be encapsulated or not (defaults to false)
indentation OPTIONAL - amount of indentation used (defaults to 1)
Returns:
lists all the attributenames, separated with comma
generateTargetAttributeSetByNameList (MACRO)
Generates list of attribute names in set attribute format
Parameters:
attributes REQUIRED - the target attributes
trgPrefix OPTIONAL - the target prefix (defaults to "")
srcPrefix OPTIONAL - the source prefix (defaults to "src")
encapsulate OPTIONAL - whether the attributes are to be encapsulated or not (defaults to false)
indentation OPTIONAL - amount of indentation used (defaults to 0)
Returns:
lists all the attribute names in set attribute format, eg trg_prefix.attribute = src_prefix.attribute
generateTargetAttributesTransformList (MACRO)
This macro is to collect the transformations for wanted attributes
Parameters:
attributes REQUIRED - the target entity attributes involved
prefix OPTIONAL - prefix to be used with source attributes (defaults to "")
overridePrefixTransformationMap OPTIONAL - overriding transformation type for attributes with specific prefix (defaults to {})
overrideAttributeTypeTransformationMap OPTIONAL - overriding transformation type for attributes with specific attribute type (defaults to {})
showTargetName OPTIONAL - whether target attribute name should be shown after the the transformation formula (defaults to true)
indentation OPTIONAL - the amount of indentation to be used (defaults to 0)
Returns:
comma separated list of target attribute specific transformations
generateSetTargetAttributeByTargetTransformationList (MACRO)
This macro is to collect the set list of target attribute and its transformation
Parameters:
attributes REQUIRED - the target entity attributes involved
prefix OPTIONAL - prefix to be used with source attributes (defaults to "")
overridePrefixTransformationMap OPTIONAL - overriding transformation type for attributes with specific prefix (defaults to {})
overrideAttributeTypeTransformationMap OPTIONAL - overriding transformation type for attributes with specific attribute type (defaults to {})
encapsulate OPTIONAL - whether target attribute should be encapsulated (default to false)
indentation OPTIONAL - the amount of indentation to be used (defaults to 0)
Returns:
comma separated list of target attribute specific transformations in format <field> = <formula>,<field> = <formula>