1 5 package org.exoplatform.portlets.content.explorer.component; 6 7 import java.io.File ; 8 import java.util.ArrayList ; 9 import java.util.List ; 10 import javax.jcr.Node ; 11 import javax.jcr.NodeIterator ; 12 import org.exoplatform.portlets.content.explorer.component.model.FileNodeDescriptor; 13 import org.exoplatform.portlets.content.explorer.component.model.NodeDescriptor; 14 import org.exoplatform.portlets.content.explorer.component.model.JCRNodeDescriptor; 15 19 public class UIJCRChildrenInfo extends UIChildrenInfo { 20 21 public void onRemove(UIExplorer uiExplorer, NodeDescriptor node) { 22 } 23 24 public void onAddChild(UIExplorer uiExplorer, NodeDescriptor node) { 25 } 26 27 protected List getChildren(UIExplorer uiExplorer, NodeDescriptor node) { 28 UIJCRExplorer explorer = (UIJCRExplorer) uiExplorer ; 29 List nodeChildren = new ArrayList () ; 30 String parentUri = node.getUri() ; 31 if ("/".equals(parentUri)) parentUri = "" ; 32 Node jcrNode = explorer.getCurrentNode() ; 33 try { 34 NodeIterator i = jcrNode.getNodes() ; 35 while(i.hasNext()) { 36 Node child = i.nextNode(); 37 NodeDescriptor uiChild = new JCRNodeDescriptor(parentUri, child) ; 38 nodeChildren.add(uiChild) ; 39 } 40 } catch (Exception ex) { 41 ex.printStackTrace() ; 42 } 43 return nodeChildren ; 44 } 45 } | Popular Tags |