当前位置: 首页>>代码示例>>Java>>正文


Java NaryFieldRelationalExpression类代码示例

本文整理汇总了Java中com.redhat.lightblue.query.NaryFieldRelationalExpression的典型用法代码示例。如果您正苦于以下问题:Java NaryFieldRelationalExpression类的具体用法?Java NaryFieldRelationalExpression怎么用?Java NaryFieldRelationalExpression使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


NaryFieldRelationalExpression类属于com.redhat.lightblue.query包,在下文中一共展示了NaryFieldRelationalExpression类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: rewrite

import com.redhat.lightblue.query.NaryFieldRelationalExpression; //导入依赖的package包/类
@Override
public QueryExpression rewrite(QueryExpression q) {
    UnaryLogicalExpression le = dyncast(UnaryLogicalExpression.class, q);
    if (le != null && le.getOp() == UnaryLogicalOperator._not) {
        ValueComparisonExpression vce = dyncast(ValueComparisonExpression.class, le.getQuery());
        if (vce != null) {
            return new ValueComparisonExpression(vce.getField(), vce.getOp().negate(), vce.getRvalue());
        } else {
            FieldComparisonExpression fce = dyncast(FieldComparisonExpression.class, le.getQuery());
            if (fce != null) {
                return new FieldComparisonExpression(fce.getField(), fce.getOp().negate(), fce.getRfield());
            } else {
                NaryValueRelationalExpression nre = dyncast(NaryValueRelationalExpression.class, le.getQuery());
                if (nre != null) {
                    return new NaryValueRelationalExpression(nre.getField(), nre.getOp().negate(), nre.getValues());
                } else {
                    NaryFieldRelationalExpression nfe = dyncast(NaryFieldRelationalExpression.class, le.getQuery());
                    if (nfe != null) {
                        return new NaryFieldRelationalExpression(nfe.getField(), nfe.getOp().negate(), nfe.getRfield());
                    }
                }
            }
        }
    }
    return q;
}
 
开发者ID:lightblue-platform,项目名称:lightblue-core,代码行数:27,代码来源:EliminateNOT.java

示例2: NaryFieldRelationalExpressionEvaluator

import com.redhat.lightblue.query.NaryFieldRelationalExpression; //导入依赖的package包/类
public NaryFieldRelationalExpressionEvaluator(NaryFieldRelationalExpression expr, FieldTreeNode context) {
    field = expr.getField();
    fieldMd = context.resolve(field);
    if (fieldMd == null) {
        throw new EvaluationError(expr, CrudConstants.ERR_FIELD_NOT_THERE + field);
    }
    rfield = expr.getRfield();
    FieldTreeNode rf = context.resolve(rfield);
    if (rf == null) {
        throw new EvaluationError(expr, CrudConstants.ERR_FIELD_NOT_THERE + field);
    }
    if (rf instanceof ArrayField) {
        rfieldMd = (ArrayField) rf;
    } else {
        throw new EvaluationError(expr, CrudConstants.ERR_REQUIRED_ARRAY + rfield);
    }
    operator = expr.getOp();
    LOGGER.debug("ctor {} {} {}", field, operator, rfield);
}
 
开发者ID:lightblue-platform,项目名称:lightblue-core,代码行数:20,代码来源:NaryFieldRelationalExpressionEvaluator.java

示例3: getInstance

import com.redhat.lightblue.query.NaryFieldRelationalExpression; //导入依赖的package包/类
public static QueryEvaluator getInstance(QueryExpression expr,
                                         FieldTreeNode context) {
    QueryEvaluator ret = null;
    if (expr instanceof ValueComparisonExpression) {
        return new ValueComparisonEvaluator((ValueComparisonExpression) expr, context);
    } else if (expr instanceof FieldComparisonExpression) {
        return new FieldComparisonEvaluator((FieldComparisonExpression) expr, context);
    } else if (expr instanceof RegexMatchExpression) {
        return new RegexEvaluator((RegexMatchExpression) expr, context);
    } else if (expr instanceof NaryValueRelationalExpression) {
        return new NaryValueRelationalExpressionEvaluator((NaryValueRelationalExpression) expr, context);
    } else if (expr instanceof NaryFieldRelationalExpression) {
        return new NaryFieldRelationalExpressionEvaluator((NaryFieldRelationalExpression) expr, context);
    } else if (expr instanceof UnaryLogicalExpression) {
        return new UnaryLogicalExpressionEvaluator((UnaryLogicalExpression) expr, context);
    } else if (expr instanceof NaryLogicalExpression) {
        return new NaryLogicalExpressionEvaluator((NaryLogicalExpression) expr, context);
    } else if (expr instanceof ArrayContainsExpression) {
        return new ArrayContainsEvaluator((ArrayContainsExpression) expr, context);
    } else if (expr instanceof ArrayMatchExpression) {
        return new ArrayMatchEvaluator((ArrayMatchExpression) expr, context);
    }
    return ret;
}
 
开发者ID:lightblue-platform,项目名称:lightblue-core,代码行数:25,代码来源:QueryEvaluator.java

示例4: translate

import com.redhat.lightblue.query.NaryFieldRelationalExpression; //导入依赖的package包/类
/**
 * @param context The field tree node for the latest enclosing context (array of elemMatch, or top level node)
 * @param query The query to translate
 * @param emd The metadata
 * @param fullPath Current full path
 */
private DBObject translate(FieldTreeNode context, QueryExpression query, EntityMetadata emd, MutablePath fullPath) {
    DBObject ret;
    try {
        if (query instanceof ArrayContainsExpression) {
            ret = translateArrayContains(context, emd, (ArrayContainsExpression) query,fullPath);
        } else if (query instanceof ArrayMatchExpression) {
            ret = translateArrayElemMatch(context, emd, (ArrayMatchExpression) query, emd, fullPath);
        } else if (query instanceof FieldComparisonExpression) {
            ret = translateFieldComparison(context, emd, (FieldComparisonExpression) query, fullPath);
        } else if (query instanceof NaryLogicalExpression) {
            ret = translateNaryLogicalExpression(context, emd, (NaryLogicalExpression) query, emd, fullPath);
        } else if (query instanceof NaryValueRelationalExpression) {
            ret = translateNaryValueRelationalExpression(context, emd, (NaryValueRelationalExpression) query,fullPath);
        } else if (query instanceof NaryFieldRelationalExpression) {
            ret = translateNaryFieldRelationalExpression(context, emd, (NaryFieldRelationalExpression) query,fullPath);
        } else if (query instanceof RegexMatchExpression) {
            ret = translateRegexMatchExpression(context, emd, (RegexMatchExpression) query, emd, fullPath);
        } else if (query instanceof UnaryLogicalExpression) {
            ret = translateUnaryLogicalExpression(context, emd, (UnaryLogicalExpression) query, emd, fullPath);
        } else {
            ret = translateValueComparisonExpression(context, emd, (ValueComparisonExpression) query,fullPath);
        }
    } catch (NeedsJS x) {
        // We can't translate the query, we have to write a $where query
        // But we can't do that if we're in an arrayElemMatch
        if(fullPath.isEmpty()) {
            JSQueryTranslator tx=new JSQueryTranslator(emd);
            ret=new BasicDBObject("$where",tx.translateQuery(query).toString());
        } else
            throw x; // Continue unroll stack
    }
    return ret;
}
 
开发者ID:lightblue-platform,项目名称:lightblue-mongo,代码行数:40,代码来源:ExpressionTranslator.java

示例5: translateNaryFieldRelationalExpression

import com.redhat.lightblue.query.NaryFieldRelationalExpression; //导入依赖的package包/类
private DBObject translateNaryFieldRelationalExpression(FieldTreeNode context, EntityMetadata md,  NaryFieldRelationalExpression expr,MutablePath fullPath) {        
    FieldInfo finfo=resolveFieldForQuery(context,fullPath.immutableCopy(),expr.getField());
    Type t = finfo.fieldMd.getType();
    if (t.supportsEq()) {
        if(!fullPath.isEmpty()) {
            // We are in array elemMatch query, and can't use a $where
            throw new NeedsJS();
        }
        JSQueryTranslator jstx=new JSQueryTranslator(md);
        return new BasicDBObject("$where",jstx.translateQuery(expr).toString());
    } else {
        throw Error.get(ERR_INVALID_FIELD, expr.toString());
    }
}
 
开发者ID:lightblue-platform,项目名称:lightblue-mongo,代码行数:15,代码来源:ExpressionTranslator.java

示例6: itrNaryFieldRelationalExpression

import com.redhat.lightblue.query.NaryFieldRelationalExpression; //导入依赖的package包/类
@Override
protected Filter itrNaryFieldRelationalExpression(NaryFieldRelationalExpression q, Path context) {
    //TODO: Support
    throw new UnsupportedOperationException("Operation not yet supported");
}
 
开发者ID:lightblue-platform,项目名称:lightblue-ldap,代码行数:6,代码来源:FilterBuilder.java

示例7: testbuild_NaryFieldRelationalExpression

import com.redhat.lightblue.query.NaryFieldRelationalExpression; //导入依赖的package包/类
@Test(expected = UnsupportedOperationException.class)
public void testbuild_NaryFieldRelationalExpression(){
    QueryExpression query = new NaryFieldRelationalExpression(null, null, null);

    new FilterBuilder(new TrivialLdapFieldNameTranslator()).build(query);
}
 
开发者ID:lightblue-platform,项目名称:lightblue-ldap,代码行数:7,代码来源:FilterBuilderTest.java


注:本文中的com.redhat.lightblue.query.NaryFieldRelationalExpression类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。