Search in sources :

Example 1 with AttributesAndState

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);
}
Also used : AttributesAndState(org.apache.nifi.attribute.expression.language.AttributesAndState) StringQueryResult(org.apache.nifi.attribute.expression.language.evaluation.StringQueryResult)

Aggregations

AttributesAndState (org.apache.nifi.attribute.expression.language.AttributesAndState)1 StringQueryResult (org.apache.nifi.attribute.expression.language.evaluation.StringQueryResult)1