Search in sources :

Example 1 with ConditionLeaf

use of io.hdocdb.store.ConditionLeaf in project kgiraffe by rayokota.

the class GraphQLQueryFactory method addNewParentToPaths.

private ConditionNode addNewParentToPaths(String parent, ConditionNode node) {
    if (node.isLeaf()) {
        ConditionLeaf leaf = (ConditionLeaf) node;
        FieldPath fieldPath = leaf.getField().cloneWithNewParent(parent);
        return new ConditionLeaf(fieldPath, leaf.getOp(), leaf.getValue());
    } else {
        ConditionParent parentNode = new ConditionParent(((ConditionParent) node).getType());
        for (ConditionNode child : ((ConditionParent) node).getChildren()) {
            parentNode.add(addNewParentToPaths(parent, child));
        }
        return parentNode;
    }
}
Also used : ConditionLeaf(io.hdocdb.store.ConditionLeaf) FieldPath(org.ojai.FieldPath) ConditionNode(io.hdocdb.store.ConditionNode) ConditionParent(io.hdocdb.store.ConditionParent)

Aggregations

ConditionLeaf (io.hdocdb.store.ConditionLeaf)1 ConditionNode (io.hdocdb.store.ConditionNode)1 ConditionParent (io.hdocdb.store.ConditionParent)1 FieldPath (org.ojai.FieldPath)1