Search in sources :

Example 11 with Link

use of org.wso2.carbon.bpel.ui.bpel2svg.Link in project siddhi by wso2.

the class SiddhiQLBaseVisitorImpl method visitEquality_math_operation.

/**
 * {@inheritDoc}
 * <p>The default implementation returns the result of calling
 * {@link #visitChildren} on {@code ctx}.</p>
 *
 * @param ctx
 */
@Override
public Expression visitEquality_math_operation(@NotNull SiddhiQLParser.Equality_math_operationContext ctx) {
    if (ctx.eq != null) {
        Expression expression = Expression.compare((Expression) visit(ctx.math_operation(0)), Compare.Operator.EQUAL, (Expression) visit(ctx.math_operation(1)));
        populateQueryContext(expression, ctx);
        return expression;
    } else if (ctx.not_eq != null) {
        Expression expression = Expression.compare((Expression) visit(ctx.math_operation(0)), Compare.Operator.NOT_EQUAL, (Expression) visit(ctx.math_operation(1)));
        populateQueryContext(expression, ctx);
        return expression;
    } else {
        throw newSiddhiParserException(ctx);
    }
}
Also used : Expression(org.wso2.siddhi.query.api.expression.Expression)

Example 12 with Link

use of org.wso2.carbon.bpel.ui.bpel2svg.Link in project siddhi by wso2.

the class SiddhiQLBaseVisitorImpl method visitOutput_attribute.

/**
 * {@inheritDoc}
 * <p>The default implementation returns the result of calling
 * {@link #visitChildren} on {@code ctx}.</p>
 *
 * @param ctx
 */
@Override
public Object visitOutput_attribute(@NotNull SiddhiQLParser.Output_attributeContext ctx) {
    // ;
    if (ctx.AS() != null) {
        OutputAttribute outputAttribute = new OutputAttribute((String) visit(ctx.attribute_name()), (Expression) visit(ctx.attribute()));
        populateQueryContext(outputAttribute, ctx);
        return outputAttribute;
    } else {
        OutputAttribute outputAttribute = new OutputAttribute((Variable) visit(ctx.attribute_reference()));
        populateQueryContext(outputAttribute, ctx);
        return outputAttribute;
    }
}
Also used : OutputAttribute(org.wso2.siddhi.query.api.execution.query.selection.OutputAttribute)

Example 13 with Link

use of org.wso2.carbon.bpel.ui.bpel2svg.Link in project siddhi by wso2.

the class SiddhiQLBaseVisitorImpl method visitSigned_int_value.

/**
 * {@inheritDoc}
 * <p>The default implementation returns the result of calling
 * {@link #visitChildren} on {@code ctx}.</p>
 *
 * @param ctx
 */
@Override
public IntConstant visitSigned_int_value(@NotNull SiddhiQLParser.Signed_int_valueContext ctx) {
    IntConstant intConstant = Expression.value(Integer.parseInt(ctx.getText()));
    populateQueryContext(intConstant, ctx);
    return intConstant;
}
Also used : IntConstant(org.wso2.siddhi.query.api.expression.constant.IntConstant)

Example 14 with Link

use of org.wso2.carbon.bpel.ui.bpel2svg.Link in project siddhi by wso2.

the class SiddhiQLBaseVisitorImpl method visitSigned_double_value.

/**
 * {@inheritDoc}
 * <p>The default implementation returns the result of calling
 * {@link #visitChildren} on {@code ctx}.</p>
 *
 * @param ctx
 */
@Override
public DoubleConstant visitSigned_double_value(@NotNull SiddhiQLParser.Signed_double_valueContext ctx) {
    DoubleConstant doubleConstant = Expression.value(Double.parseDouble(ctx.getText()));
    populateQueryContext(doubleConstant, ctx);
    return doubleConstant;
}
Also used : DoubleConstant(org.wso2.siddhi.query.api.expression.constant.DoubleConstant)

Example 15 with Link

use of org.wso2.carbon.bpel.ui.bpel2svg.Link in project siddhi by wso2.

the class SiddhiQLBaseVisitorImpl method visitSequence_collection_stateful_source.

/**
 * {@inheritDoc}
 * <p>The default implementation returns the result of calling
 * {@link #visitChildren} on {@code ctx}.</p>
 *
 * @param ctx
 */
@Override
public CountStateElement visitSequence_collection_stateful_source(@NotNull SiddhiQLParser.Sequence_collection_stateful_sourceContext ctx) {
    // sequence_collection_stateful_source
    // :standard_stateful_source ('<' collect '>'|zero_or_more='*'|zero_or_one='?'|one_or_more='+')
    // ;
    StreamStateElement streamStateElement = (StreamStateElement) visit(ctx.standard_stateful_source());
    if (ctx.one_or_more != null) {
        CountStateElement countStateElement = new CountStateElement(streamStateElement, 1, CountStateElement.ANY);
        populateQueryContext(countStateElement, ctx);
        return countStateElement;
    } else if (ctx.zero_or_more != null) {
        CountStateElement countStateElement = new CountStateElement(streamStateElement, 0, CountStateElement.ANY);
        populateQueryContext(countStateElement, ctx);
        return countStateElement;
    } else if (ctx.zero_or_one != null) {
        CountStateElement countStateElement = new CountStateElement(streamStateElement, 0, 1);
        populateQueryContext(countStateElement, ctx);
        return countStateElement;
    } else if (ctx.collect() != null) {
        Object[] minMax = (Object[]) visit(ctx.collect());
        int min = CountStateElement.ANY;
        int max = CountStateElement.ANY;
        if (minMax[0] != null) {
            min = (Integer) minMax[0];
        }
        if (minMax[1] != null) {
            max = (Integer) minMax[1];
        }
        CountStateElement countStateElement = new CountStateElement(streamStateElement, min, max);
        populateQueryContext(countStateElement, ctx);
        return countStateElement;
    } else {
        throw newSiddhiParserException(ctx);
    }
}
Also used : CountStateElement(org.wso2.siddhi.query.api.execution.query.input.state.CountStateElement) StreamStateElement(org.wso2.siddhi.query.api.execution.query.input.state.StreamStateElement) AbsentStreamStateElement(org.wso2.siddhi.query.api.execution.query.input.state.AbsentStreamStateElement)

Aggregations

PreparedStatement (java.sql.PreparedStatement)47 ArrayList (java.util.ArrayList)47 Connection (java.sql.Connection)43 SQLException (java.sql.SQLException)41 ResultSet (java.sql.ResultSet)37 APIMgtDAOException (org.wso2.carbon.apimgt.core.exception.APIMgtDAOException)26 BLangPackage (org.wso2.ballerinalang.compiler.tree.BLangPackage)18 HashSet (java.util.HashSet)16 APIManagementException (org.wso2.carbon.apimgt.core.exception.APIManagementException)15 IOException (java.io.IOException)14 HashMap (java.util.HashMap)14 List (java.util.List)13 Map (java.util.Map)13 Expression (org.wso2.siddhi.query.api.expression.Expression)13 CompilerContext (org.wso2.ballerinalang.compiler.util.CompilerContext)12 TimeConstant (org.wso2.siddhi.query.api.expression.constant.TimeConstant)12 DiagnosticPos (org.wso2.ballerinalang.compiler.util.diagnotic.DiagnosticPos)11 API (org.wso2.carbon.apimgt.core.models.API)11 UserStoreException (org.wso2.carbon.user.api.UserStoreException)10 SiddhiQLParser (org.wso2.siddhi.query.compiler.SiddhiQLParser)10