org.apache.sling.servlets.get.impl.helpers
Class ResourceTraversor

java.lang.Object
  extended by org.apache.sling.servlets.get.impl.helpers.ResourceTraversor

public class ResourceTraversor
extends Object


Constructor Summary
ResourceTraversor(int levels, long maxNodes, Resource resource, boolean tidy)
           
 
Method Summary
 void check()
          Check if the resource has less child nodes for the specified amount of levels.
protected  void collectResource(Resource resource, int level)
          Adds a resource in the JSON tree.
 long getCount()
           
 JSONObject getJSONObject()
           
 long getMaxNodes()
           
 void setMaxNodes(long maxNodes)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceTraversor

public ResourceTraversor(int levels,
                         long maxNodes,
                         Resource resource,
                         boolean tidy)
                  throws javax.jcr.RepositoryException,
                         JSONException
Throws:
javax.jcr.RepositoryException
JSONException
Method Detail

check

public void check()
           throws javax.jcr.RepositoryException,
                  RecursionTooDeepException,
                  JSONException
Check if the resource has less child nodes for the specified amount of levels.

Throws:
javax.jcr.RepositoryException
RecursionTooDeepException - When the resource has more child nodes then allowed.
JSONException

collectResource

protected void collectResource(Resource resource,
                               int level)
                        throws javax.jcr.RepositoryException,
                               JSONException
Adds a resource in the JSON tree.

Parameters:
resource - The resource to add
level - The level where this resource is located.
Throws:
javax.jcr.RepositoryException
JSONException

getCount

public long getCount()
Returns:
The number of nodes this visitor found.

setMaxNodes

public void setMaxNodes(long maxNodes)
Parameters:
maxNodes - the maxNodes to set

getMaxNodes

public long getMaxNodes()
Returns:
the maxNodes

getJSONObject

public JSONObject getJSONObject()


Copyright © 2007-2013 The Apache Software Foundation. All Rights Reserved.