pnever      2003/03/21 07:42:41

  Modified:    src/webdav/server/org/apache/slide/webdav/method
                        ReportMethod.java
  Log:
  Fixed bug: most reports did ignore the Depth: header.
  
  Revision  Changes    Path
  1.48      +95 -17    
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/ReportMethod.java
  
  Index: ReportMethod.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/ReportMethod.java,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- ReportMethod.java 25 Feb 2003 09:13:46 -0000      1.47
  +++ ReportMethod.java 21 Mar 2003 15:42:40 -0000      1.48
  @@ -665,6 +665,30 @@
        * @throws     JDOMException
        */
       protected void executeVersionTreeReport(String requestUri, Element 
parentElement, int depth) throws WebdavException, SlideException, JDOMException {
  +        if (depth < 0) {
  +            return;
  +        }
  +        executeVersionTreeReport( requestUri, parentElement );
  +        ObjectNode onode = structure.retrieve( slideToken, requestUri );
  +        Enumeration childrenEnum = structure.getChildren( slideToken, onode );
  +        while( childrenEnum.hasMoreElements() ) {
  +            ObjectNode cnode = (ObjectNode)childrenEnum.nextElement();
  +            executeVersionTreeReport( cnode.getUri(), parentElement, depth-1 );
  +        }
  +    }
  +    
  +    /**
  +     * Executes a requested <code>version-tree</code> report for a single resource.
  +     *
  +     * @param      requestUri     the URI of the requested resource.
  +     * @param      parentElement  the parent Element to append the
  +     *                            &lt;response&gt;</code> to.
  +     *
  +     * @throws     WebdavException
  +     * @throws     SlideException
  +     * @throws     JDOMException
  +     */
  +    protected void executeVersionTreeReport(String requestUri, Element 
parentElement) throws WebdavException, SlideException, JDOMException {
           
           NodeRevisionDescriptors revisionDescriptors = content.retrieve(slideToken, 
requestUri);
           NodeRevisionDescriptor revisionDescriptor = content.retrieve(slideToken, 
revisionDescriptors);
  @@ -696,8 +720,6 @@
           
       }
       
  -    
  -    
       /**
        * Write the <code>version-tree</code> report for the given revision and
        * recursivly for all successors.
  @@ -847,7 +869,7 @@
        */
       protected void executeExpandPropertyReport(String requestUri, Element 
parentElement, int depth) throws WebdavException, ObjectLockedException, 
RevisionDescriptorNotFoundException, ServiceAccessException, 
LinkedObjectNotFoundException, AccessDeniedException, ObjectNotFoundException, 
JDOMException {
           List requestedPropertyElementList = 
expandPropertyElement.getChildren(E_PROPERTY, NamespaceCache.DEFAULT_NAMESPACE);
  -        writeExpandPropertyReport(requestUri, parentElement, 
requestedPropertyElementList);
  +        writeExpandPropertyReport(requestUri, parentElement, 
requestedPropertyElementList, depth);
       }
       
       /**
  @@ -856,6 +878,7 @@
        * @param      requestUri     the URI of the requested resource.
        * @param      parentElement  the parent Element to append the
        *                            &lt;response&gt;</code> to.
  +     * @param    depth            the depth
        *
        * @throws     WebdavException
        * @throws     ObjectLockedException
  @@ -865,8 +888,38 @@
        * @throws     AccessDeniedException
        * @throws     ObjectNotFoundException
        * @throws     JDOMException
  +     *
        */
       protected void executeAclPrincipalReport(String requestUri, Element 
parentElement, int depth) throws WebdavException, ObjectLockedException, 
RevisionDescriptorNotFoundException, ServiceAccessException, 
LinkedObjectNotFoundException, AccessDeniedException, ObjectNotFoundException, 
JDOMException {
  +        if (depth < 0) {
  +            return;
  +        }
  +        executeAclPrincipalReport( requestUri, parentElement );
  +        ObjectNode onode = structure.retrieve( slideToken, requestUri );
  +        Enumeration childrenEnum = structure.getChildren( slideToken, onode );
  +        while( childrenEnum.hasMoreElements() ) {
  +            ObjectNode cnode = (ObjectNode)childrenEnum.nextElement();
  +            executeAclPrincipalReport( cnode.getUri(), parentElement , depth-1 );
  +        }
  +    }
  +    
  +    /**
  +     * Executes a requested <code>acl-principal-prop</code> report.
  +     *
  +     * @param      requestUri     the URI of the requested resource.
  +     * @param      parentElement  the parent Element to append the
  +     *                            &lt;response&gt;</code> to.
  +     *
  +     * @throws     WebdavException
  +     * @throws     ObjectLockedException
  +     * @throws     RevisionDescriptorNotFoundException
  +     * @throws     ServiceAccessException
  +     * @throws     LinkedObjectNotFoundException
  +     * @throws     AccessDeniedException
  +     * @throws     ObjectNotFoundException
  +     * @throws     JDOMException
  +     */
  +    protected void executeAclPrincipalReport(String requestUri, Element 
parentElement) throws WebdavException, ObjectLockedException, 
RevisionDescriptorNotFoundException, ServiceAccessException, 
LinkedObjectNotFoundException, AccessDeniedException, ObjectNotFoundException, 
JDOMException {
           
           NodeRevisionDescriptors revisionDescriptors = null;
           NodeRevisionDescriptor revisionDescriptor = null;
  @@ -1411,6 +1464,39 @@
        *                            &lt;response&gt;</code> to.
        * @param      requestedPropertyElementList  the List of 
<code>&lt;property&gt;</code>
        *                                           elements which are requested.
  +     * @param    depth               an int
  +     *
  +     * @throws   WebdavException
  +     * @throws   ObjectLockedException
  +     * @throws   RevisionDescriptorNotFoundException
  +     * @throws   ServiceAccessException
  +     * @throws   LinkedObjectNotFoundException
  +     * @throws   AccessDeniedException
  +     * @throws   ObjectNotFoundException
  +     * @throws   JDOMException
  +     *
  +     */
  +    protected void writeExpandPropertyReport(String requestUri, Element 
parentElement, List requestedPropertyElementList, int depth) throws WebdavException, 
ObjectLockedException, RevisionDescriptorNotFoundException, ServiceAccessException, 
LinkedObjectNotFoundException, AccessDeniedException, ObjectNotFoundException, 
JDOMException {
  +        if (depth < 0) {
  +            return;
  +        }
  +        writeExpandPropertyReport( requestUri, parentElement, 
requestedPropertyElementList );
  +        ObjectNode onode = structure.retrieve( slideToken, requestUri );
  +        Enumeration childrenEnum = structure.getChildren( slideToken, onode );
  +        while( childrenEnum.hasMoreElements() ) {
  +            ObjectNode cnode = (ObjectNode)childrenEnum.nextElement();
  +            writeExpandPropertyReport( cnode.getUri(), parentElement, 
requestedPropertyElementList, depth-1 );
  +        }
  +    }
  +    
  +    /**
  +     * Executes a requested <code>expand-propterty</code> report for a single 
resource.
  +     *
  +     * @param      requestUri     the URI of the requested resource.
  +     * @param      parentElement  the parent Element to append the
  +     *                            &lt;response&gt;</code> to.
  +     * @param      requestedPropertyElementList  the List of 
<code>&lt;property&gt;</code>
  +     *                                           elements which are requested.
        *
        * @throws     WebdavException
        * @throws     ObjectLockedException
  @@ -1735,22 +1821,13 @@
           
           String depthStr = req.getHeader("Depth");
           if (depthStr == null) {
  -            depth = INFINITY;
  -        } else if (depthStr.equals("0")) {
               depth = 0;
           } else if (depthStr.equals("1")) {
               depth = 1;
           } else if (depthStr.equalsIgnoreCase("infinity")) {
               depth = INFINITY;
           } else {
  -        try {
  -                depth = Integer.parseInt(depthStr);
  -                if (depth < 0) {
  -                    depth = 0;
  -                }
  -            } catch (NumberFormatException ex) {
  -                depth = INFINITY;
  -            }
  +            depth = 0;
           }
           
           // limit tree browsing a bit
  @@ -1858,6 +1935,7 @@
   
       
       
  +
   
   
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to