// check for regular expression pattern
String subfolderPattern = pathRegexpPattern(subfolder);
if (subfolderPattern != null)
{
// follow all matching sub-folders
NodeSet subfolders = currentFolder.getFolders();
if (subfolders != null)
{
subfolders = subfolders.inclusiveSubset(subfolderPattern);
if (subfolders != null)
{
// recursively process sub-folders if more than
// one match, access single sub-folder, or return
// null if nonexistent
if (subfolders.size() > 1)
{
// recursively process matching sub-folders
List proxies = null;
Iterator subfoldersIter = subfolders.iterator();
while (subfoldersIter.hasNext())
{
currentFolder = (Folder)subfoldersIter.next();
List subfolderProxies = getNodeProxies(currentRegexpPath, currentFolder, onlyViewable, onlyVisible);
if ((subfolderProxies != null) && !subfolderProxies.isEmpty())
{
if (proxies == null)
{
proxies = new ArrayList();
}
proxies.addAll(subfolderProxies);
}
}
return proxies;
}
else if (subfolders.size() == 1)
{
// access single sub-folder
currentFolder = (Folder)subfolders.iterator().next();
}
else
{
// no matching sub-folders
return null;
}
}
else
{
// no matching sub-folders
return null;
}
}
else
{
// no sub-folders
return null;
}
}
else
{
// access single sub-folder or return null if
// nonexistent by throwing exception
currentFolder = currentFolder.getFolder(subfolder);
}
}
catch (NodeException ne)
{
// could not access sub-folders
return null;
}
catch (NodeNotFoundException nnfe)
{
// could not access sub-folders
return null;
}
catch (SecurityException se)
{
// could not access sub-folders
return null;
}
}
}
else
{
try
{
// get all children of current folder
NodeSet children = currentFolder.getAll();
if (children != null)
{
// check for regular expression pattern
String pathPattern = pathRegexpPattern(currentRegexpPath);
if (pathPattern != null)
{
// copy children matching remaining path pattern as
// page, folder, or link proxies if viewable/visible or
// visibilty not required
children = children.inclusiveSubset(pathPattern);
if ((children != null) && !children.isEmpty())
{
List proxies = null;
Iterator childrenIter = children.iterator();
while (childrenIter.hasNext())
{
Node child = (Node)childrenIter.next();
if ((!onlyVisible || !child.isHidden() || (child == currentPage)) &&
(!onlyViewable || isProxyViewable(child, onlyVisible)))
{
if (proxies == null)
{
proxies = new ArrayList(children.size());
}
proxies.add(child);
}
}
return proxies;
}
}
else
{
// access remaining path as page, folder, or link
// node proxy; return null if not found or not
// viewable and visiblity is required
Node child = children.get(currentRegexpPath);
if ((child != null) && (!onlyVisible || !child.isHidden() || (child == currentPage)) &&
(!onlyViewable || isProxyViewable(child, onlyVisible)))
{
List proxies = new ArrayList(1);
proxies.add(currentFolder);