Search in sources :

Example 1 with SubqueryInternalBuilder

use of com.blazebit.persistence.impl.SubqueryInternalBuilder in project blaze-persistence by Blazebit.

the class ToMultisetFunction method process.

@Override
public Object process(CharSequence result, List<Object> arguments) {
    SubqueryExpression subqueryExpression = (SubqueryExpression) arguments.get(0);
    Subquery subquery = subqueryExpression.getSubquery();
    String[] fields;
    if (subquery instanceof SubqueryInternalBuilder<?>) {
        fields = createFields(((SubqueryInternalBuilder<?>) subquery).getSelectExpressions().size());
    } else {
        throw new IllegalArgumentException("Can't handle: " + subquery);
    }
    if (toJsonFunction == null) {
        return toXmlFunction.process(result, fields);
    } else {
        return toJsonFunction.process(result, fields);
    }
}
Also used : SubqueryInternalBuilder(com.blazebit.persistence.impl.SubqueryInternalBuilder) Subquery(com.blazebit.persistence.parser.expression.Subquery) SubqueryExpression(com.blazebit.persistence.parser.expression.SubqueryExpression)

Example 2 with SubqueryInternalBuilder

use of com.blazebit.persistence.impl.SubqueryInternalBuilder in project blaze-persistence by Blazebit.

the class BetweenBuilderImpl method andSubqery.

@Override
public SubqueryInitiator<T> andSubqery(String subqueryAlias, String expression) {
    verifySubqueryBuilderEnded();
    SubqueryBuilderListenerImpl<T> superExpressionSubqueryListener = new SuperExpressionSubqueryBuilderListener<T>(subqueryAlias, expressionFactory.createSimpleExpression(expression)) {

        @Override
        public void onBuilderEnded(SubqueryInternalBuilder<T> builder) {
            super.onBuilderEnded(builder);
            predicate = new BetweenPredicate(left, start, superExpression, negated);
            listener.onBuilderEnded(BetweenBuilderImpl.this);
        }
    };
    return startSubqueryInitiator(subqueryInitFactory.createSubqueryInitiator(result, superExpressionSubqueryListener, false, clauseType));
}
Also used : SuperExpressionSubqueryBuilderListener(com.blazebit.persistence.impl.builder.expression.SuperExpressionSubqueryBuilderListener) SubqueryInternalBuilder(com.blazebit.persistence.impl.SubqueryInternalBuilder) BetweenPredicate(com.blazebit.persistence.parser.predicate.BetweenPredicate)

Example 3 with SubqueryInternalBuilder

use of com.blazebit.persistence.impl.SubqueryInternalBuilder in project blaze-persistence by Blazebit.

the class BetweenBuilderImpl method andSubqery.

@Override
public SubqueryBuilder<T> andSubqery(String subqueryAlias, String expression, FullQueryBuilder<?, ?> criteriaBuilder) {
    verifySubqueryBuilderEnded();
    SubqueryBuilderListenerImpl<T> superExpressionSubqueryListener = new SuperExpressionSubqueryBuilderListener<T>(subqueryAlias, expressionFactory.createSimpleExpression(expression)) {

        @Override
        public void onBuilderEnded(SubqueryInternalBuilder<T> builder) {
            super.onBuilderEnded(builder);
            predicate = new BetweenPredicate(left, start, superExpression, negated);
            listener.onBuilderEnded(BetweenBuilderImpl.this);
        }
    };
    return startSubqueryBuilder(subqueryInitFactory.createSubqueryBuilder(result, superExpressionSubqueryListener, false, criteriaBuilder, clauseType));
}
Also used : SuperExpressionSubqueryBuilderListener(com.blazebit.persistence.impl.builder.expression.SuperExpressionSubqueryBuilderListener) SubqueryInternalBuilder(com.blazebit.persistence.impl.SubqueryInternalBuilder) BetweenPredicate(com.blazebit.persistence.parser.predicate.BetweenPredicate)

Aggregations

SubqueryInternalBuilder (com.blazebit.persistence.impl.SubqueryInternalBuilder)3 SuperExpressionSubqueryBuilderListener (com.blazebit.persistence.impl.builder.expression.SuperExpressionSubqueryBuilderListener)2 BetweenPredicate (com.blazebit.persistence.parser.predicate.BetweenPredicate)2 Subquery (com.blazebit.persistence.parser.expression.Subquery)1 SubqueryExpression (com.blazebit.persistence.parser.expression.SubqueryExpression)1