Search in sources :

Example 96 with Variable

use of org.wso2.siddhi.query.api.expression.Variable in project siddhi by wso2.

the class SiddhiQLBaseVisitorImpl method visitGroup_by_query_selection.

@Override
public BasicSelector visitGroup_by_query_selection(@NotNull SiddhiQLParser.Group_by_query_selectionContext ctx) {
    BasicSelector selector = new BasicSelector();
    List<OutputAttribute> attributeList = new ArrayList<OutputAttribute>(ctx.output_attribute().size());
    for (SiddhiQLParser.Output_attributeContext output_attributeContext : ctx.output_attribute()) {
        attributeList.add((OutputAttribute) visit(output_attributeContext));
    }
    selector.addSelectionList(attributeList);
    if (ctx.group_by() != null) {
        selector.addGroupByList((List<Variable>) visit(ctx.group_by()));
    }
    populateQueryContext(selector, ctx);
    return selector;
}
Also used : SiddhiQLParser(org.wso2.siddhi.query.compiler.SiddhiQLParser) Variable(org.wso2.siddhi.query.api.expression.Variable) BasicSelector(org.wso2.siddhi.query.api.execution.query.selection.BasicSelector) ArrayList(java.util.ArrayList) OutputAttribute(org.wso2.siddhi.query.api.execution.query.selection.OutputAttribute)

Example 97 with Variable

use of org.wso2.siddhi.query.api.expression.Variable in project siddhi by wso2.

the class ExpressionBuilder method buildVariableExecutors.

private void buildVariableExecutors(Expression expression, ExpressionVisitor expressionVisitor) {
    try {
        if (expression instanceof And) {
            expressionVisitor.beginVisitAnd();
            expressionVisitor.beginVisitAndLeftOperand();
            buildVariableExecutors(((And) expression).getLeftExpression(), expressionVisitor);
            expressionVisitor.endVisitAndLeftOperand();
            expressionVisitor.beginVisitAndRightOperand();
            buildVariableExecutors(((And) expression).getRightExpression(), expressionVisitor);
            expressionVisitor.endVisitAndRightOperand();
            expressionVisitor.endVisitAnd();
        } else if (expression instanceof Or) {
            expressionVisitor.beginVisitOr();
            expressionVisitor.beginVisitOrLeftOperand();
            buildVariableExecutors(((Or) expression).getLeftExpression(), expressionVisitor);
            expressionVisitor.endVisitOrLeftOperand();
            expressionVisitor.beginVisitOrRightOperand();
            buildVariableExecutors(((Or) expression).getRightExpression(), expressionVisitor);
            expressionVisitor.endVisitOrRightOperand();
            expressionVisitor.endVisitOr();
        } else if (expression instanceof Not) {
            expressionVisitor.beginVisitNot();
            buildVariableExecutors(((Not) expression).getExpression(), expressionVisitor);
            expressionVisitor.endVisitNot();
        } else if (expression instanceof Compare) {
            expressionVisitor.beginVisitCompare(((Compare) expression).getOperator());
            expressionVisitor.beginVisitCompareLeftOperand(((Compare) expression).getOperator());
            buildVariableExecutors(((Compare) expression).getLeftExpression(), expressionVisitor);
            expressionVisitor.endVisitCompareLeftOperand(((Compare) expression).getOperator());
            expressionVisitor.beginVisitCompareRightOperand(((Compare) expression).getOperator());
            buildVariableExecutors(((Compare) expression).getRightExpression(), expressionVisitor);
            expressionVisitor.endVisitCompareRightOperand(((Compare) expression).getOperator());
            expressionVisitor.endVisitCompare(((Compare) expression).getOperator());
        } else if (expression instanceof Add) {
            expressionVisitor.beginVisitMath(ExpressionVisitor.MathOperator.ADD);
            expressionVisitor.beginVisitMathLeftOperand(ExpressionVisitor.MathOperator.ADD);
            buildVariableExecutors(((Add) expression).getLeftValue(), expressionVisitor);
            expressionVisitor.endVisitMathLeftOperand(ExpressionVisitor.MathOperator.ADD);
            expressionVisitor.beginVisitMathRightOperand(ExpressionVisitor.MathOperator.ADD);
            buildVariableExecutors(((Add) expression).getRightValue(), expressionVisitor);
            expressionVisitor.endVisitMathRightOperand(ExpressionVisitor.MathOperator.ADD);
            expressionVisitor.endVisitMath(ExpressionVisitor.MathOperator.ADD);
        } else if (expression instanceof Subtract) {
            expressionVisitor.beginVisitMath(ExpressionVisitor.MathOperator.SUBTRACT);
            expressionVisitor.beginVisitMathLeftOperand(ExpressionVisitor.MathOperator.SUBTRACT);
            buildVariableExecutors(((Subtract) expression).getLeftValue(), expressionVisitor);
            expressionVisitor.endVisitMathLeftOperand(ExpressionVisitor.MathOperator.SUBTRACT);
            expressionVisitor.beginVisitMathRightOperand(ExpressionVisitor.MathOperator.SUBTRACT);
            buildVariableExecutors(((Subtract) expression).getRightValue(), expressionVisitor);
            expressionVisitor.endVisitMathRightOperand(ExpressionVisitor.MathOperator.SUBTRACT);
            expressionVisitor.endVisitMath(ExpressionVisitor.MathOperator.SUBTRACT);
        } else if (expression instanceof Divide) {
            expressionVisitor.beginVisitMath(ExpressionVisitor.MathOperator.DIVIDE);
            expressionVisitor.beginVisitMathLeftOperand(ExpressionVisitor.MathOperator.DIVIDE);
            buildVariableExecutors(((Divide) expression).getLeftValue(), expressionVisitor);
            expressionVisitor.endVisitMathLeftOperand(ExpressionVisitor.MathOperator.DIVIDE);
            expressionVisitor.beginVisitMathRightOperand(ExpressionVisitor.MathOperator.DIVIDE);
            buildVariableExecutors(((Divide) expression).getRightValue(), expressionVisitor);
            expressionVisitor.endVisitMathRightOperand(ExpressionVisitor.MathOperator.DIVIDE);
            expressionVisitor.endVisitMath(ExpressionVisitor.MathOperator.DIVIDE);
        } else if (expression instanceof Multiply) {
            expressionVisitor.beginVisitMath(ExpressionVisitor.MathOperator.MULTIPLY);
            expressionVisitor.beginVisitMathLeftOperand(ExpressionVisitor.MathOperator.MULTIPLY);
            buildVariableExecutors(((Multiply) expression).getLeftValue(), expressionVisitor);
            expressionVisitor.endVisitMathLeftOperand(ExpressionVisitor.MathOperator.MULTIPLY);
            expressionVisitor.beginVisitMathRightOperand(ExpressionVisitor.MathOperator.MULTIPLY);
            buildVariableExecutors(((Multiply) expression).getRightValue(), expressionVisitor);
            expressionVisitor.endVisitMathRightOperand(ExpressionVisitor.MathOperator.MULTIPLY);
            expressionVisitor.endVisitMath(ExpressionVisitor.MathOperator.MULTIPLY);
        } else if (expression instanceof Mod) {
            expressionVisitor.beginVisitMath(ExpressionVisitor.MathOperator.MOD);
            expressionVisitor.beginVisitMathLeftOperand(ExpressionVisitor.MathOperator.MOD);
            buildVariableExecutors(((Mod) expression).getLeftValue(), expressionVisitor);
            expressionVisitor.endVisitMathLeftOperand(ExpressionVisitor.MathOperator.MOD);
            expressionVisitor.beginVisitMathRightOperand(ExpressionVisitor.MathOperator.MOD);
            buildVariableExecutors(((Mod) expression).getRightValue(), expressionVisitor);
            expressionVisitor.endVisitMathRightOperand(ExpressionVisitor.MathOperator.MOD);
            expressionVisitor.endVisitMath(ExpressionVisitor.MathOperator.MOD);
        } else if (expression instanceof IsNull) {
            IsNull isNull = (IsNull) expression;
            if (isNull.getExpression() != null) {
                expressionVisitor.beginVisitIsNull(null);
                buildVariableExecutors(((IsNull) expression).getExpression(), expressionVisitor);
                expressionVisitor.endVisitIsNull(null);
            } else {
                String streamId = isNull.getStreamId();
                MetaStateEvent metaStateEvent = matchingMetaInfoHolder.getMetaStateEvent();
                if (streamId == null) {
                    throw new SiddhiAppCreationException("IsNull does not support streamId being null");
                } else {
                    AbstractDefinition definitionOutput = null;
                    MetaStreamEvent[] metaStreamEvents = metaStateEvent.getMetaStreamEvents();
                    for (int i = 0, metaStreamEventsLength = metaStreamEvents.length; i < metaStreamEventsLength; i++) {
                        MetaStreamEvent metaStreamEvent = metaStreamEvents[i];
                        AbstractDefinition definition = metaStreamEvent.getLastInputDefinition();
                        if (metaStreamEvent.getInputReferenceId() == null) {
                            if (definition.getId().equals(streamId)) {
                                definitionOutput = definition;
                                break;
                            }
                        } else {
                            if (metaStreamEvent.getInputReferenceId().equals(streamId)) {
                                definitionOutput = definition;
                                break;
                            }
                        }
                    }
                    if (definitionOutput != null) {
                        expressionVisitor.beginVisitIsNull(definitionOutput.getId());
                        expressionVisitor.endVisitIsNull(definitionOutput.getId());
                    } else {
                        expressionVisitor.beginVisitIsNull(null);
                        expressionVisitor.endVisitIsNull(null);
                    }
                }
            }
        } else if (expression instanceof In) {
            expressionVisitor.beginVisitIn(((In) expression).getSourceId());
            buildVariableExecutors(((In) expression).getExpression(), expressionVisitor);
            expressionVisitor.endVisitIn(((In) expression).getSourceId());
        } else if (expression instanceof Constant) {
            if (expression instanceof DoubleConstant) {
                expressionVisitor.beginVisitConstant(((DoubleConstant) expression).getValue(), Attribute.Type.DOUBLE);
                expressionVisitor.endVisitConstant(((DoubleConstant) expression).getValue(), Attribute.Type.DOUBLE);
            } else if (expression instanceof StringConstant) {
                expressionVisitor.beginVisitConstant(((StringConstant) expression).getValue(), Attribute.Type.STRING);
                expressionVisitor.endVisitConstant(((StringConstant) expression).getValue(), Attribute.Type.STRING);
            } else if (expression instanceof IntConstant) {
                expressionVisitor.beginVisitConstant(((IntConstant) expression).getValue(), Attribute.Type.INT);
                expressionVisitor.endVisitConstant(((IntConstant) expression).getValue(), Attribute.Type.INT);
            } else if (expression instanceof BoolConstant) {
                expressionVisitor.beginVisitConstant(((BoolConstant) expression).getValue(), Attribute.Type.BOOL);
                expressionVisitor.endVisitConstant(((BoolConstant) expression).getValue(), Attribute.Type.BOOL);
            } else if (expression instanceof FloatConstant) {
                expressionVisitor.beginVisitConstant(((FloatConstant) expression).getValue(), Attribute.Type.FLOAT);
                expressionVisitor.endVisitConstant(((FloatConstant) expression).getValue(), Attribute.Type.FLOAT);
            } else if (expression instanceof LongConstant) {
                expressionVisitor.beginVisitConstant(((LongConstant) expression).getValue(), Attribute.Type.LONG);
                expressionVisitor.endVisitConstant(((LongConstant) expression).getValue(), Attribute.Type.LONG);
            } else {
                throw new OperationNotSupportedException("No constant exist with type " + expression.getClass().getName());
            }
        } else if (expression instanceof AttributeFunction) {
            expressionVisitor.beginVisitAttributeFunction(((AttributeFunction) expression).getNamespace(), ((AttributeFunction) expression).getName());
            Expression[] expressions = ((AttributeFunction) expression).getParameters();
            for (int i = 0; i < expressions.length; i++) {
                expressionVisitor.beginVisitParameterAttributeFunction(i);
                buildVariableExecutors(expressions[i], expressionVisitor);
                expressionVisitor.endVisitParameterAttributeFunction(i);
            }
            expressionVisitor.endVisitAttributeFunction(((AttributeFunction) expression).getNamespace(), ((AttributeFunction) expression).getName());
        } else if (expression instanceof Variable) {
            Variable variable = ((Variable) expression);
            String attributeName = variable.getAttributeName();
            AbstractDefinition definition;
            Attribute.Type type = null;
            int streamEventChainIndex = matchingMetaInfoHolder.getCurrentState();
            if (variable.getStreamId() == null) {
                MetaStreamEvent[] metaStreamEvents = matchingMetaInfoHolder.getMetaStateEvent().getMetaStreamEvents();
                if (streamEventChainIndex == UNKNOWN_STATE) {
                    String firstInput = null;
                    for (int i = 0; i < metaStreamEvents.length; i++) {
                        MetaStreamEvent metaStreamEvent = metaStreamEvents[i];
                        definition = metaStreamEvent.getLastInputDefinition();
                        if (type == null) {
                            try {
                                type = definition.getAttributeType(attributeName);
                                firstInput = "Input Stream: " + definition.getId() + " with " + "reference: " + metaStreamEvent.getInputReferenceId();
                                streamEventChainIndex = i;
                            } catch (AttributeNotExistException e) {
                            // do nothing
                            }
                        } else {
                            try {
                                definition.getAttributeType(attributeName);
                                throw new SiddhiAppValidationException(firstInput + " and Input Stream: " + definition.getId() + " with " + "reference: " + metaStreamEvent.getInputReferenceId() + " contains attribute " + "with same" + " name '" + attributeName + "'");
                            } catch (AttributeNotExistException e) {
                            // do nothing as its expected
                            }
                        }
                    }
                    if (streamEventChainIndex != UNKNOWN_STATE) {
                        if (matchingMetaInfoHolder.getMatchingStreamEventIndex() == streamEventChainIndex) {
                            buildStreamVariableExecutor(variable, streamEventChainIndex, expressionVisitor, type);
                        } else {
                            buildStoreVariableExecutor(variable, expressionVisitor, type, matchingMetaInfoHolder.getStoreDefinition());
                        }
                    }
                } else {
                    MetaStreamEvent metaStreamEvent = matchingMetaInfoHolder.getMetaStateEvent().getMetaStreamEvent(matchingMetaInfoHolder.getCurrentState());
                    definition = metaStreamEvent.getLastInputDefinition();
                    try {
                        type = definition.getAttributeType(attributeName);
                    } catch (AttributeNotExistException e) {
                        throw new SiddhiAppValidationException(e.getMessageWithOutContext() + " Input Stream: " + definition.getId() + " with " + "reference: " + metaStreamEvent.getInputReferenceId(), e.getQueryContextStartIndex(), e.getQueryContextEndIndex(), siddhiAppContext.getName(), siddhiAppContext.getSiddhiAppString());
                    }
                    if (matchingMetaInfoHolder.getCurrentState() == matchingMetaInfoHolder.getMatchingStreamEventIndex()) {
                        buildStreamVariableExecutor(variable, streamEventChainIndex, expressionVisitor, type);
                    } else {
                        buildStoreVariableExecutor(variable, expressionVisitor, type, matchingMetaInfoHolder.getStoreDefinition());
                    }
                }
            } else {
                MetaStreamEvent[] metaStreamEvents = matchingMetaInfoHolder.getMetaStateEvent().getMetaStreamEvents();
                for (int i = 0, metaStreamEventsLength = metaStreamEvents.length; i < metaStreamEventsLength; i++) {
                    MetaStreamEvent metaStreamEvent = metaStreamEvents[i];
                    definition = metaStreamEvent.getLastInputDefinition();
                    if (metaStreamEvent.getInputReferenceId() == null) {
                        if (definition.getId().equals(variable.getStreamId())) {
                            type = definition.getAttributeType(attributeName);
                            streamEventChainIndex = i;
                            break;
                        }
                    } else {
                        if (metaStreamEvent.getInputReferenceId().equals(variable.getStreamId())) {
                            type = definition.getAttributeType(attributeName);
                            streamEventChainIndex = i;
                            break;
                        }
                    }
                }
                if (matchingMetaInfoHolder.getMatchingStreamEventIndex() == streamEventChainIndex) {
                    buildStreamVariableExecutor(variable, streamEventChainIndex, expressionVisitor, type);
                } else {
                    buildStoreVariableExecutor(variable, expressionVisitor, type, matchingMetaInfoHolder.getStoreDefinition());
                }
            }
        }
    } catch (Throwable t) {
        ExceptionUtil.populateQueryContext(t, expression, siddhiAppContext);
        throw t;
    }
}
Also used : Add(org.wso2.siddhi.query.api.expression.math.Add) DoubleConstant(org.wso2.siddhi.query.api.expression.constant.DoubleConstant) Or(org.wso2.siddhi.query.api.expression.condition.Or) Variable(org.wso2.siddhi.query.api.expression.Variable) In(org.wso2.siddhi.query.api.expression.condition.In) StringConstant(org.wso2.siddhi.query.api.expression.constant.StringConstant) Constant(org.wso2.siddhi.query.api.expression.constant.Constant) DoubleConstant(org.wso2.siddhi.query.api.expression.constant.DoubleConstant) LongConstant(org.wso2.siddhi.query.api.expression.constant.LongConstant) FloatConstant(org.wso2.siddhi.query.api.expression.constant.FloatConstant) BoolConstant(org.wso2.siddhi.query.api.expression.constant.BoolConstant) IntConstant(org.wso2.siddhi.query.api.expression.constant.IntConstant) FloatConstant(org.wso2.siddhi.query.api.expression.constant.FloatConstant) Divide(org.wso2.siddhi.query.api.expression.math.Divide) AttributeNotExistException(org.wso2.siddhi.query.api.exception.AttributeNotExistException) Multiply(org.wso2.siddhi.query.api.expression.math.Multiply) IntConstant(org.wso2.siddhi.query.api.expression.constant.IntConstant) Compare(org.wso2.siddhi.query.api.expression.condition.Compare) LongConstant(org.wso2.siddhi.query.api.expression.constant.LongConstant) OperationNotSupportedException(org.wso2.siddhi.core.exception.OperationNotSupportedException) BoolConstant(org.wso2.siddhi.query.api.expression.constant.BoolConstant) Mod(org.wso2.siddhi.query.api.expression.math.Mod) SiddhiAppCreationException(org.wso2.siddhi.core.exception.SiddhiAppCreationException) AbstractDefinition(org.wso2.siddhi.query.api.definition.AbstractDefinition) SiddhiAppValidationException(org.wso2.siddhi.query.api.exception.SiddhiAppValidationException) AttributeFunction(org.wso2.siddhi.query.api.expression.AttributeFunction) MetaStateEvent(org.wso2.siddhi.core.event.state.MetaStateEvent) Not(org.wso2.siddhi.query.api.expression.condition.Not) Expression(org.wso2.siddhi.query.api.expression.Expression) And(org.wso2.siddhi.query.api.expression.condition.And) Subtract(org.wso2.siddhi.query.api.expression.math.Subtract) IsNull(org.wso2.siddhi.query.api.expression.condition.IsNull) StringConstant(org.wso2.siddhi.query.api.expression.constant.StringConstant) MetaStreamEvent(org.wso2.siddhi.core.event.stream.MetaStreamEvent)

Example 98 with Variable

use of org.wso2.siddhi.query.api.expression.Variable in project carbon-business-process by wso2.

the class AnalyticsPublisherExtensionOperation method fillDataArray.

private void fillDataArray(Object[] dataArray, List<AnalyticsKey> payloadAnalyticsKeyList, int startIndex, ExtensionContext context, Element element) throws FaultException {
    for (int i = 0; i < payloadAnalyticsKeyList.size(); i++) {
        AnalyticsKey analyticsKey = payloadAnalyticsKeyList.get(i);
        if (analyticsKey.getExpression() != null) {
            String expression = evaluateXPathExpression(context, analyticsKey.getExpression(), element);
            convertDataType(dataArray, (i + startIndex), analyticsKey, expression);
        } else if (analyticsKey.getVariable() != null && analyticsKey.getPart() == null) {
            if (analyticsKey.getQuery() == null) {
                String variable = context.readVariable(analyticsKey.getVariable()).getTextContent();
                convertDataType(dataArray, (i + startIndex), analyticsKey, variable);
            /* simple types should be specified for here */
            } else {
                String errMsg = "This functionality is currently not supported";
                log.error(errMsg);
                handleException(errMsg);
            }
        } else if (analyticsKey.getVariable() != null && analyticsKey.getPart() != null) {
            NodeList childNodes = context.readVariable(analyticsKey.getVariable()).getChildNodes();
            String result = null;
            String part = analyticsKey.getPart();
            for (int j = 0; j < childNodes.getLength(); j++) {
                Node item = childNodes.item(j);
                if (item != null && item.getNodeType() == Node.ELEMENT_NODE && item.getLocalName().equals(part)) {
                    /* remove the payload part */
                    result = DOMUtils.domToString(DOMUtils.getFirstChildElement(item));
                }
            }
            convertDataType(dataArray, (i + startIndex), analyticsKey, result);
            dataArray[i + startIndex] = result;
        }
    }
}
Also used : AnalyticsKey(org.wso2.carbon.bpel.core.ode.integration.config.analytics.AnalyticsKey) NodeList(org.w3c.dom.NodeList) Node(org.w3c.dom.Node)

Example 99 with Variable

use of org.wso2.siddhi.query.api.expression.Variable in project carbon-business-process by wso2.

the class HistoricDetailService method getVariableFromRequest.

public RestVariable getVariableFromRequest(boolean includeBinary, String detailId) {
    Object value = null;
    HistoricVariableUpdate variableUpdate = null;
    HistoryService historyService = BPMNOSGIService.getHistoryService();
    HistoricDetail detailObject = historyService.createHistoricDetailQuery().id(detailId).singleResult();
    if (detailObject instanceof HistoricVariableUpdate) {
        variableUpdate = (HistoricVariableUpdate) detailObject;
        value = variableUpdate.getValue();
    }
    if (value == null) {
        throw new ActivitiObjectNotFoundException("Historic detail '" + detailId + "' doesn't have a variable value.", VariableInstanceEntity.class);
    } else {
        return new RestResponseFactory().createRestVariable(variableUpdate.getVariableName(), value, null, detailId, RestResponseFactory.VARIABLE_HISTORY_DETAIL, includeBinary, uriInfo.getBaseUri().toString());
    }
}
Also used : HistoricVariableUpdate(org.activiti.engine.history.HistoricVariableUpdate) HistoricDetail(org.activiti.engine.history.HistoricDetail) RestResponseFactory(org.wso2.carbon.bpmn.rest.common.RestResponseFactory) HistoryService(org.activiti.engine.HistoryService) ActivitiObjectNotFoundException(org.activiti.engine.ActivitiObjectNotFoundException)

Example 100 with Variable

use of org.wso2.siddhi.query.api.expression.Variable in project carbon-business-process by wso2.

the class HistoricProcessInstanceService method addVariables.

protected void addVariables(HistoricProcessInstanceQuery processInstanceQuery, List<QueryVariable> variables) {
    for (QueryVariable variable : variables) {
        if (variable.getVariableOperation() == null) {
            throw new ActivitiIllegalArgumentException("Variable operation is missing for variable: " + variable.getName());
        }
        if (variable.getValue() == null) {
            throw new ActivitiIllegalArgumentException("Variable value is missing for variable: " + variable.getName());
        }
        boolean nameLess = variable.getName() == null;
        RestResponseFactory restResponseFactory = new RestResponseFactory();
        Object actualValue = restResponseFactory.getVariableValue(variable);
        // A value-only query is only possible using equals-operator
        if (nameLess && variable.getVariableOperation() != QueryVariable.QueryVariableOperation.EQUALS) {
            throw new ActivitiIllegalArgumentException("Value-only query (without a variable-name) is only supported when using 'equals' operation.");
        }
        switch(variable.getVariableOperation()) {
            case EQUALS:
                if (nameLess) {
                    processInstanceQuery.variableValueEquals(actualValue);
                } else {
                    processInstanceQuery.variableValueEquals(variable.getName(), actualValue);
                }
                break;
            case EQUALS_IGNORE_CASE:
                if (actualValue instanceof String) {
                    processInstanceQuery.variableValueEqualsIgnoreCase(variable.getName(), (String) actualValue);
                } else {
                    throw new ActivitiIllegalArgumentException("Only string variable values are supported when ignoring casing, but was: " + actualValue.getClass().getName());
                }
                break;
            case NOT_EQUALS:
                processInstanceQuery.variableValueNotEquals(variable.getName(), actualValue);
                break;
            case LIKE:
                if (actualValue instanceof String) {
                    processInstanceQuery.variableValueLike(variable.getName(), (String) actualValue);
                } else {
                    throw new ActivitiIllegalArgumentException("Only string variable values are supported for like, but was: " + actualValue.getClass().getName());
                }
                break;
            case GREATER_THAN:
                processInstanceQuery.variableValueGreaterThan(variable.getName(), actualValue);
                break;
            case GREATER_THAN_OR_EQUALS:
                processInstanceQuery.variableValueGreaterThanOrEqual(variable.getName(), actualValue);
                break;
            case LESS_THAN:
                processInstanceQuery.variableValueLessThan(variable.getName(), actualValue);
                break;
            case LESS_THAN_OR_EQUALS:
                processInstanceQuery.variableValueLessThanOrEqual(variable.getName(), actualValue);
                break;
            default:
                throw new ActivitiIllegalArgumentException("Unsupported variable query operation: " + variable.getVariableOperation());
        }
    }
}
Also used : RestResponseFactory(org.wso2.carbon.bpmn.rest.common.RestResponseFactory) QueryVariable(org.wso2.carbon.bpmn.rest.engine.variable.QueryVariable)

Aggregations

RestVariable (org.wso2.carbon.bpmn.rest.engine.variable.RestVariable)37 ArrayList (java.util.ArrayList)31 RestResponseFactory (org.wso2.carbon.bpmn.rest.common.RestResponseFactory)31 BLangVariable (org.wso2.ballerinalang.compiler.tree.BLangVariable)30 Test (org.testng.annotations.Test)28 HTTPTestRequest (org.ballerinalang.test.services.testutils.HTTPTestRequest)26 HTTPCarbonMessage (org.wso2.transport.http.netty.message.HTTPCarbonMessage)26 HttpMessageDataStreamer (org.wso2.transport.http.netty.message.HttpMessageDataStreamer)26 ActivitiIllegalArgumentException (org.activiti.engine.ActivitiIllegalArgumentException)23 BJSON (org.ballerinalang.model.values.BJSON)22 BLangExpression (org.wso2.ballerinalang.compiler.tree.expressions.BLangExpression)18 IOException (java.io.IOException)17 BVarSymbol (org.wso2.ballerinalang.compiler.semantics.model.symbols.BVarSymbol)17 BType (org.wso2.ballerinalang.compiler.semantics.model.types.BType)17 Variable (org.wso2.siddhi.query.api.expression.Variable)17 ActivitiObjectNotFoundException (org.activiti.engine.ActivitiObjectNotFoundException)16 BLangSimpleVarRef (org.wso2.ballerinalang.compiler.tree.expressions.BLangSimpleVarRef)15 DataResponse (org.wso2.carbon.bpmn.rest.model.common.DataResponse)15 Response (javax.ws.rs.core.Response)14 VariableExpressionExecutor (org.wso2.siddhi.core.executor.VariableExpressionExecutor)13