Good question. Currently you would have to save the common parent which in this case is root.

Node root = navigation.loadNodes(Nodes.visitAll());
Node d = root.getNode("a", "b", "c", "d");
Node h = root.getNode("e", "f", "g", "h");
navigation.loadChildren(h); // we'll get an exception if we try to move to a parent that doesn't have children loaded
d.moveTo(h);
navigation.saveNode(root);

The loadChildren method above brings up a point I would like to discuss. We can automatically load children if we detect they are not loaded, however this has performance implications. It behaves much like the internal service where the user must control on what is loaded. Not the most user friendly but there's no unnecessary loading of nodes.

One idea is to make this an option when obtaining the navigation object. So one could say something like portal.getNavigation(siteId, true) and all interactions with the nodes obtained from this navigation object would load children automatically. You could even pass in a default NodeVisitor that could be used everytime a node w/out children loaded is encountered.

- Nick

On 12/12/2012 05:43 AM, Trong Tran wrote:
Hi Nick,

for Navigation API, could you describe about the move action of node on navigation ? how do we do to save the move of a node on different branches ?

For instance, if I move the node /a/b/c/d to parent /e/f/g/h, do I have to save both c (for deleting d) and h (for adding d) ?

On 11 December 2012 07:24, Nick Scavelli <nscavell@redhat.com> wrote:
All,

I wanted to send an email to discuss the public API and more specifically the current efforts around Navigation. I created a forum post here https://community.jboss.org/thread/215521 to show the information a little easier; however, since I think discussions are easier to follow in an email, I encourage people to reply to this email rather then the forum for further discussion.

Javadoc published here: http://gatein.github.com/gatein-api-java/ (I had problems with Chrome cache, so clear cache if you get 404 errors)

Since the navigation part of the public API is the part we've been focusing on, it's going to be the most complete in terms of design, javadoc, etc. So I am expecting more feedback in this area as apposed to things like pages and sites.

- Nick






_______________________________________________
gatein-dev mailing list
gatein-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/gatein-dev