Update of /var/cvs/src/org/mmbase/bridge/util
In directory james.mmbase.org:/tmp/cvs-serv4641
Modified Files:
Queries.java
Log Message:
added this method to be able to edit relations within the searchrelate widget
See also: http://cvs.mmbase.org/viewcvs/src/org/mmbase/bridge/util
Index: Queries.java
===================================================================
RCS file: /var/cvs/src/org/mmbase/bridge/util/Queries.java,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -b -r1.110 -r1.111
--- Queries.java 16 Sep 2008 11:20:18 -0000 1.110
+++ Queries.java 7 Nov 2008 13:42:26 -0000 1.111
@@ -26,7 +26,7 @@
* methods are put here.
*
* @author Michiel Meeuwissen
- * @version $Id: Queries.java,v 1.110 2008/09/16 11:20:18 michiel Exp $
+ * @version $Id: Queries.java,v 1.111 2008/11/07 13:42:26 andre Exp $
* @see org.mmbase.bridge.Query
* @since MMBase-1.7
*/
@@ -1351,8 +1351,26 @@
* @since MMBase-1.8.6
*/
public static NodeList removeFromResult(Query q, Node n) {
- List<Step> steps = q.getSteps();
+ NodeList result = getRelations(q, n);
+ NodeIterator ni = result.nodeIterator();
+ while (ni.hasNext()) {
+ Node r = ni.nextNode();
+ r.delete();
+ }
+ return result;
+ }
+
+ /**
+ * Explores a query object, returns the relations the node has within the
query.
+ *
+ * @throws UnsupportedOperationException If it cannot be determined how
the node is related.
+ * @since MMBase-1.9.1
+ * @return The relation nodes
+ * @throws NullPointerException if q or n is <code>null</code>
+ */
+ public static NodeList getRelations(Query q, Node n) {
+ List<Step> steps = q.getSteps();
if (steps.size() < 3) throw new UnsupportedOperationException();
NodeList result = q.getCloud().createNodeList();
@@ -1380,10 +1398,7 @@
Node virtual = ni.nextNode();
Node r = cloud.getNode(virtual.getIntValue(alias));
result.add(r);
- r.delete();
-
}
-
}
}
return result;
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs