I am trying to simplify an expression that naively executes the same expression multiple times by leveraging the set
directive, however the simplified expression fails to parse and I can’t figure out why.
Can anyone spot my issue between the first (failing) and second (working) examples below.
#set($managerParts = $managerDistinguishedName.split(",DC=", 2))
#set($employeeParts = $employeeDistinguishedName.split(",DC=", 2))
#set($managerDomain = $managerParts.size() > 1 ? $managerParts[1] : "")
#set($employeeDomain = $employeeParts.size() > 1 ? $employeeParts[1] : "")
#if($managerDomain.equals($employeeDomain))
$managerDistinguishedName
#{else}
#end
#if($managerDistinguishedName.split(",DC=",2).size() > 1 && $employeeDistinguishedName.split(",DC=",2).size() > 1 && $managerDistinguishedName.split(",DC=",2)[1].equals($employeeDistinguishedName.split(",DC=",2)[1]))
$managerDistinguishedName
#{else}
#end
The $managerDistinguishedName
and $employeeDistinguishedName
are populated with the related data using existing transforms in the static transform.
I have escaped the double quotes and merged the expressions into a single line, and also replaced the escaped double quotes with single quotes with no luck.