changeset 23:8d5f791f1811

do not use findValue as it searches recursively. This is not what we want in all the cases findValue was used before.
author dirk
date Sun, 18 Sep 2011 09:37:40 +0200
parents eea7df5137ac
children aa933f4d48e7
files conflict-editor/src/main/java/de/codedo/conflicteditor/Conflict.java conflict-editor/src/main/java/de/codedo/conflicteditor/ConflictsView.java conflict-editor/src/main/java/de/codedo/conflicteditor/DocumentMatcher.java conflict-editor/src/test/java/de/codedo/conflicteditor/ConflictTestCase.java conflict-editor/src/test/java/de/codedo/conflicteditor/Playground.java
diffstat 5 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/conflict-editor/src/main/java/de/codedo/conflicteditor/Conflict.java	Sun Sep 18 09:35:43 2011 +0200
+++ b/conflict-editor/src/main/java/de/codedo/conflicteditor/Conflict.java	Sun Sep 18 09:37:40 2011 +0200
@@ -10,7 +10,7 @@
     public Conflict(JsonNode node)
     {
         super();
-        _currentVersionNode = node.findValue("key");
+        _currentVersionNode = node.get("key");
     }
 
     public JsonNode getCurrentDocument()
@@ -20,7 +20,7 @@
 
     public String getId()
     {
-        return _currentVersionNode.findValue("_id").getTextValue();
+        return _currentVersionNode.get("_id").getTextValue();
     }
 
     /**
@@ -28,7 +28,7 @@
      */
     public String getRevision()
     {
-        return _currentVersionNode.findValue("_rev").getTextValue();
+        return _currentVersionNode.get("_rev").getTextValue();
     }
 
     /**
@@ -36,7 +36,7 @@
      */
     public String getConflictRevision()
     {
-        JsonNode conflictsNode = _currentVersionNode.findValue("_conflicts");
+        JsonNode conflictsNode = _currentVersionNode.get("_conflicts");
         if (conflictsNode.isArray())
         {
             return conflictsNode.get(0).getTextValue();
--- a/conflict-editor/src/main/java/de/codedo/conflicteditor/ConflictsView.java	Sun Sep 18 09:35:43 2011 +0200
+++ b/conflict-editor/src/main/java/de/codedo/conflicteditor/ConflictsView.java	Sun Sep 18 09:37:40 2011 +0200
@@ -73,6 +73,6 @@
     {
         ObjectMapper mapper = new ObjectMapper();
         JsonNode rootNode = mapper.readTree(reader);
-        return rootNode.findValue("rows");
+        return rootNode.get("rows");
     }
 }
--- a/conflict-editor/src/main/java/de/codedo/conflicteditor/DocumentMatcher.java	Sun Sep 18 09:35:43 2011 +0200
+++ b/conflict-editor/src/main/java/de/codedo/conflicteditor/DocumentMatcher.java	Sun Sep 18 09:37:40 2011 +0200
@@ -47,7 +47,7 @@
         for (String name : calculateFieldNamesInOriginalOnly())
         {
             // TODO value may not be text
-            String value = _original.findValue(name).getTextValue();
+            String value = _original.get(name).getTextValue();
             Difference diff = new Difference(name, value, null);
             _differences.add(diff);
         }
@@ -66,7 +66,7 @@
         for (String name : calculateFieldNamesInOtherOnly())
         {
             // TODO value may not be text
-            String value = _other.findValue(name).getTextValue();
+            String value = _other.get(name).getTextValue();
             Difference diff = new Difference(name, null, value);
             _differences.add(diff);
         }
@@ -102,8 +102,8 @@
 
     private Difference compareValuesForKey(String key)
     {
-        JsonNode original = _original.findValue(key);
-        JsonNode other = _other.findValue(key);
+        JsonNode original = _original.get(key);
+        JsonNode other = _other.get(key);
 
         if ((original != null) && (other == null))
         {
--- a/conflict-editor/src/test/java/de/codedo/conflicteditor/ConflictTestCase.java	Sun Sep 18 09:35:43 2011 +0200
+++ b/conflict-editor/src/test/java/de/codedo/conflicteditor/ConflictTestCase.java	Sun Sep 18 09:37:40 2011 +0200
@@ -43,7 +43,7 @@
     private ObjectNode createNodeWithConflictRevisions(String... revisions)
     {
         ObjectNode node = createBaseNode();
-        ObjectNode keyNode = (ObjectNode)node.findValue("key");
+        ObjectNode keyNode = (ObjectNode)node.get("key");
 
         ArrayNode conflicts = node.arrayNode();
         for (String revision : revisions)
--- a/conflict-editor/src/test/java/de/codedo/conflicteditor/Playground.java	Sun Sep 18 09:35:43 2011 +0200
+++ b/conflict-editor/src/test/java/de/codedo/conflicteditor/Playground.java	Sun Sep 18 09:37:40 2011 +0200
@@ -27,7 +27,7 @@
         {
             Conflict conflict = new Conflict(conflicts.get(i));
             JsonNode currentDocument = conflict.getCurrentDocument();
-            System.out.println(currentDocument.findValue("rss_url").getTextValue());
+            System.out.println(currentDocument.get("rss_url").getTextValue());
             // System.out.println("current:");
             // prettyPrint(currentDocument);