Gaffer
Gaffer copied to clipboard
Allow variables to be used in Operation Chains
For example:
{
"class": "GetElements",
"input": "${input}",
"view": {
"edge1": {
"preAggregationFilterFunctions": [{
"selection": "count",
"predicate": {
"class": "IsMoreThan",
"value": "${threshold}"
}
}]
}
}
}
This is tricky as it cannot deserialise into Java until the variable has been resolved. We may need to use a similar mechanism to how we do it in NamedOperations, where we store the OperationChain in json and resolve the variables before deserialising the operation.
Depends on #1860.
This is currently at a stage where parameters need to be reviewed/reworked for this to work. It will work now in certain cases but not all can be guaranteed. The issue with deserialising unresolved parameters still stands. We have the option of leaving this as is and giving users the ability to use variables within a json opChain, or waiting for a fix for using the variables within the Java.
Another use case for this has been identified for reducing duplication in Operation chains. A simple example is where an different value should be used within the chain based on true or false. At the moment this requires a duplication of the operations across the true and false branches, with the values hardcoded. With variable substitution, there would be no need for duplication in the chain or hardcoding.