public ForEachExpressionEvaluator(JsonNodeFactory factory, FieldTreeNode context, ForEachExpression expr) { this.memento = new Memento(factory, context, expr); this.factory = factory; this.numAny = expr.getField().nAnys(); // Resolve the field, make sure it is an array this.updateInfo = generateProcessedInfo(context, expr, null, null); }
public ForEachExpressionEvaluator(JsonNodeFactory factory, FieldTreeNode context, ForEachExpression expr) { this.memento = new Memento(factory, context, expr); this.factory = factory; this.numAny = expr.getField().nAnys(); // Resolve the field, make sure it is an array this.updateInfo = generateProcessedInfo(context, expr, null, null); }
@Override public boolean update(JsonDoc doc, FieldTreeNode contextMd, Path contextPath) { boolean ret = false; if (numAny > 0) { KeyValueCursor<Path, JsonNode> cursor = doc.getAllNodes(memento.expr.getField()); boolean b = cursor.hasNext(); while (b) { cursor.next(); Path currentKey = cursor.getCurrentKey(); JsonNode currentValue = cursor.getCurrentValue(); UpdateInfo updateInfoInstance = generateProcessedInfo(memento.context, memento.expr, currentKey, this.updateInfo.updater); if (update(doc, contextPath, updateInfoInstance)) { ret = true; } b = cursor.hasNext(); } return ret; } else { ret = update(doc, contextPath, this.updateInfo); return ret; } }
@Override public boolean update(JsonDoc doc, FieldTreeNode contextMd, Path contextPath) { boolean ret = false; if (numAny > 0) { KeyValueCursor<Path, JsonNode> cursor = doc.getAllNodes(memento.expr.getField()); boolean b = cursor.hasNext(); while (b) { cursor.next(); Path currentKey = cursor.getCurrentKey(); JsonNode currentValue = cursor.getCurrentValue(); UpdateInfo updateInfoInstance = generateProcessedInfo(memento.context, memento.expr, currentKey, this.updateInfo.updater); if (update(doc, contextPath, updateInfoInstance)) { ret = true; } b = cursor.hasNext(); } return ret; } else { ret = update(doc, contextPath, this.updateInfo); return ret; } }