Author: michiel
Date: 2010-03-23 19:02:27 +0100 (Tue, 23 Mar 2010)
New Revision: 41582

Modified:
   
mmbase/trunk/bridge/src/main/java/org/mmbase/storage/search/implementation/BasicStep.java
   
mmbase/trunk/bridge/src/main/java/org/mmbase/storage/search/implementation/BasicStepField.java
Log:
ported details from 1.9

Modified: 
mmbase/trunk/bridge/src/main/java/org/mmbase/storage/search/implementation/BasicStep.java
===================================================================
--- 
mmbase/trunk/bridge/src/main/java/org/mmbase/storage/search/implementation/BasicStep.java
   2010-03-23 18:02:13 UTC (rev 41581)
+++ 
mmbase/trunk/bridge/src/main/java/org/mmbase/storage/search/implementation/BasicStep.java
   2010-03-23 18:02:27 UTC (rev 41582)
@@ -10,6 +10,7 @@
 package org.mmbase.storage.search.implementation;
 
 import java.util.*;
+import org.mmbase.module.core.MMObjectBuilder;
 import org.mmbase.storage.search.*;
 
 /**
@@ -72,10 +73,9 @@
      */
     public Step addNode(int nodeNumber) {
         if (! modifiable) throw new IllegalStateException();
-        if (nodeNumber < 0) {
-            throw new IllegalArgumentException("Invalid nodeNumber value: " + 
nodeNumber);
+        if (nodes == null) {
+            nodes =  new TreeSet<Integer>();
         }
-        if (nodes == null) nodes =  new TreeSet<Integer>();
         nodes.add(nodeNumber);
         return this;
     }
@@ -103,7 +103,7 @@
 
     // javadoc is inherited
     public SortedSet<Integer> getNodes() {
-        return nodes == null ? null : Collections.unmodifiableSortedSet(nodes);
+        return nodes == null ? null : (modifiable ? nodes : 
Collections.unmodifiableSortedSet(nodes));
     }
 
     // javadoc is inherited

Modified: 
mmbase/trunk/bridge/src/main/java/org/mmbase/storage/search/implementation/BasicStepField.java
===================================================================
--- 
mmbase/trunk/bridge/src/main/java/org/mmbase/storage/search/implementation/BasicStepField.java
      2010-03-23 18:02:13 UTC (rev 41581)
+++ 
mmbase/trunk/bridge/src/main/java/org/mmbase/storage/search/implementation/BasicStepField.java
      2010-03-23 18:02:27 UTC (rev 41582)
@@ -135,36 +135,36 @@
      * @param field The associated field.
      * @throws IllegalArgumentException when an invalid argument is supplied.
      */
-    public BasicStepField(Step step, Field field) {
+    public BasicStepField(Step step, Field f) {
         if (step == null) {
             throw new IllegalArgumentException("Invalid step value: " + step);
         }
         this.step = step;
 
-        if (field == null) {
-            throw new IllegalArgumentException("Invalid field value: " + field 
+ " for " + step);
+        if (f == null) {
+            throw new IllegalArgumentException("Invalid field value: " + f + " 
for " + step);
         }
         // Check field belongs to step
-        if (!step.getTableName().equals(field.getNodeManager().getName())) {
-            throw new IllegalArgumentException("Invalid field value, belongs 
to step " + field.getNodeManager().getName()
+        if (!step.getTableName().equals(f.getNodeManager().getName())) {
+            throw new IllegalArgumentException("Invalid field value, belongs 
to step " + f.getNodeManager().getName()
                                                + " instead of step " +  
step.getTableName() + ": "
-                                               + field);
+                                               + f);
         }
 
-        if (field instanceof org.mmbase.bridge.implementation.BasicField) { // 
not so nice, but I can't come up with something better for now
+        if (f instanceof org.mmbase.bridge.implementation.BasicField) { // not 
so nice, but I can't come up with something better for now
             // SearchQueries can be referenced in caches. We don't want to
             // have references to user clouds there (Field is probably a 
BasicField then)
             // So, we use a specialized anonymous cloud instance
-            CloudContext cloudContext = 
field.getNodeManager().getCloud().getCloudContext();
+            CloudContext cloudContext = 
f.getNodeManager().getCloud().getCloudContext();
             Cloud anonymousCloud = anonymousClouds.get(cloudContext);
             if (anonymousCloud == null) {
                 anonymousCloud = cloudContext.getCloud("mmbase");
                 anonymousClouds.put(cloudContext, anonymousCloud);
             }
-            NodeManager anonymousNodeManager = 
anonymousCloud.getNodeManager(field.getNodeManager().getName());
-            field = anonymousNodeManager.getField(field.getName());
+            NodeManager anonymousNodeManager = 
anonymousCloud.getNodeManager(f.getNodeManager().getName());
+            f = anonymousNodeManager.getField(f.getName());
         }
-        this.field = field;
+        this.field = f;
     }
 
     /**

_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to