use of org.camunda.bpm.engine.rest.dto.VariableQueryParameterDto in project camunda-bpm-platform by camunda.
the class VariableInstanceQueryDto method applyFilters.
@Override
protected void applyFilters(VariableInstanceQuery query) {
if (variableName != null) {
query.variableName(variableName);
}
if (variableNameLike != null) {
query.variableNameLike(variableNameLike);
}
if (variableValues != null) {
for (VariableQueryParameterDto variableQueryParam : variableValues) {
String variableName = variableQueryParam.getName();
String op = variableQueryParam.getOperator();
Object variableValue = variableQueryParam.resolveValue(objectMapper);
if (op.equals(VariableQueryParameterDto.EQUALS_OPERATOR_NAME)) {
query.variableValueEquals(variableName, variableValue);
} else if (op.equals(VariableQueryParameterDto.GREATER_THAN_OPERATOR_NAME)) {
query.variableValueGreaterThan(variableName, variableValue);
} else if (op.equals(VariableQueryParameterDto.GREATER_THAN_OR_EQUALS_OPERATOR_NAME)) {
query.variableValueGreaterThanOrEqual(variableName, variableValue);
} else if (op.equals(VariableQueryParameterDto.LESS_THAN_OPERATOR_NAME)) {
query.variableValueLessThan(variableName, variableValue);
} else if (op.equals(VariableQueryParameterDto.LESS_THAN_OR_EQUALS_OPERATOR_NAME)) {
query.variableValueLessThanOrEqual(variableName, variableValue);
} else if (op.equals(VariableQueryParameterDto.NOT_EQUALS_OPERATOR_NAME)) {
query.variableValueNotEquals(variableName, variableValue);
} else if (op.equals(VariableQueryParameterDto.LIKE_OPERATOR_NAME)) {
query.variableValueLike(variableName, String.valueOf(variableValue));
} else {
throw new InvalidRequestException(Status.BAD_REQUEST, "Invalid variable comparator specified: " + op);
}
}
}
if (executionIdIn != null && executionIdIn.length > 0) {
query.executionIdIn(executionIdIn);
}
if (processInstanceIdIn != null && processInstanceIdIn.length > 0) {
query.processInstanceIdIn(processInstanceIdIn);
}
if (caseExecutionIdIn != null && caseExecutionIdIn.length > 0) {
query.caseExecutionIdIn(caseExecutionIdIn);
}
if (caseInstanceIdIn != null && caseInstanceIdIn.length > 0) {
query.caseInstanceIdIn(caseInstanceIdIn);
}
if (taskIdIn != null && taskIdIn.length > 0) {
query.taskIdIn(taskIdIn);
}
if (variableScopeIdIn != null && variableScopeIdIn.length > 0) {
query.variableScopeIdIn(variableScopeIdIn);
}
if (activityInstanceIdIn != null && activityInstanceIdIn.length > 0) {
query.activityInstanceIdIn(activityInstanceIdIn);
}
if (tenantIds != null && !tenantIds.isEmpty()) {
query.tenantIdIn(tenantIds.toArray(new String[tenantIds.size()]));
}
}
Aggregations