protected void addVariables(HistoricVariableInstanceQuery variableInstanceQuery, List<QueryVariable> variables) { for (QueryVariable variable : variables) { if (variable.getVariableOperation() == null) { throw new FlowableIllegalArgumentException("Variable operation is missing for variable: " + variable.getName()); } if (variable.getValue() == null) { throw new FlowableIllegalArgumentException("Variable value is missing for variable: " + variable.getName()); } boolean nameLess = variable.getName() == null; Object actualValue = restResponseFactory.getVariableValue(variable); // A value-only query is only possible using equals-operator if (nameLess) { throw new FlowableIllegalArgumentException("Value-only query (without a variable-name) is not supported"); } switch (variable.getVariableOperation()) { case EQUALS: variableInstanceQuery.variableValueEquals(variable.getName(), actualValue); break; default: throw new FlowableIllegalArgumentException("Unsupported variable query operation: " + variable.getVariableOperation()); } } } }