private static PrintableNode convertOperatorNode(final ExpressionOperator oldNode,
                                                     final Set<String> fieldBlackList) {
        // ExpressionOperator can be created with no child nodes so if that is
        // the case just return null and handle for
        // the null in the calling method

        if (oldNode.getChildren() == null || oldNode.getChildren().size() == 0) {
            return null;
        } else {
            final FilterOperationMode operationMode = FilterOperationMode.valueOf(oldNode.op().toString());

            final List<PrintableNode> children = new ArrayList<>();

            for (final ExpressionItem oldChild : oldNode.getChildren()) {
                final PrintableNode newChild = convertNode(oldChild, fieldBlackList);

                // if the newChild is null it means it was probably an
                // ExpressionOperator with no children
                if (newChild != null) {
                    children.add(newChild);
                }
            }

            PrintableNode newNode = null;
            // term nodes may have been returned as null if they were expression
            // terms that this tree does not support
            if (children.isEmpty()) {
                // newNode is already null so do nothing
            } else if (children.size() == 1 && !operationMode.equals(FilterOperationMode.NOT)) {
                // only have one child for an AND or OR so no point in keeping
                // the operator node, just had the one child
                // to the tree instead
                newNode = children.get(0);
            } else {
                newNode = new OperatorNode(operationMode, children);
            }

            return newNode;
        }
    }
@return The converted node, null if the old node has no children
stroom-statistics/stroom-statistics-impl-sql/src/main/java/stroom/statistics/impl/sql/search/FilterTermsTreeBuilder.java