12-09-2015 02:22 AM
/**
* Recursive find of all item head nodes from a given node ref
*
* @param nodeRef
*/
public List<NodeRef> findAllNodes(NodeRef nodeRef) throws Exception
{
List<NodeRef> nodes = new ArrayList<NodeRef>();
if(!this.dao.isNodeIgnored(nodeRef.toString()))
{
if(this.dao.isFolder(nodeRef))
{
nodes.add(nodeRef); // add folder as well
List<NodeRef> children= this.dao.getChildren(nodeRef);
for (NodeRef child : children)
{
nodes.addAll(this.findAllNodes(child));
}
}
else
{
nodes.add(nodeRef);
}
}
return nodes;
}
/**
* The following functions are part of the dao class as referenced from above
*/
public boolean isNodeIgnored(String nodeRef)
{
log.debug("isNodeIgnored");
NodeRef nr = getNodeRef(nodeRef);
QName value = nodeService.getType(nr);
log.debug("isNodeIgnored got service type");
return isTypeIgnored(value);
}
public boolean isFolder(NodeRef nodeRef) throws Exception
{
FileInfo info = service.getFileInfo(nodeRef);
return info.isFolder();
}
public List<NodeRef> getChildren(NodeRef nodeRef) throws Exception
{
List<NodeRef> listChildren = new ArrayList<NodeRef>();
List<ChildAssociationRef> children = nodeService.getChildAssocs(nodeRef);
for (ChildAssociationRef childAssociationRef : children)
{
NodeRef child = childAssociationRef.getChildRef();
if(this.isTypeIgnored(nodeService.getType(child)))
{
continue;
}
listChildren.add(new NodeRef(child.toString())); // deep copy
}
return listChildren;
}
05-24-2018 06:57 AM
Hey,
Any chance that you were able to figure out what is the issue here. As we also facing the same issue.