use of org.apache.nifi.attribute.expression.language.AttributesAndState in project nifi by apache.
the class GetStateVariableEvaluator method evaluate.
@Override
public QueryResult<String> evaluate(Map<String, String> attributes) {
if (!(attributes instanceof AttributesAndState)) {
return new StringQueryResult(null);
}
final String subjectValue = subject.evaluate(attributes).getValue();
if (subjectValue == null) {
return new StringQueryResult(null);
}
AttributesAndState attributesAndState = (AttributesAndState) attributes;
Map<String, String> stateMap = attributesAndState.getStateMap();
String stateValue = stateMap.get(subjectValue);
return new StringQueryResult(stateValue);
}
Aggregations