Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright (C) 2009 eXo Platform SAS.
   *
   * This is free software; you can redistribute it and/or modify it
   * under the terms of the GNU Lesser General Public License as
   * published by the Free Software Foundation; either version 2.1 of
   * the License, or (at your option) any later version.
   *
   * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
 package org.exoplatform.services.jcr.webdav.command;
 
 
 import java.net.URI;
 import java.util.List;
 
 import javax.jcr.Node;
Created by The eXo Platform SAS. Author : Vitaly Guly.

Version:
$Id: $
 
 
 public class PropPatchCommand
 {

   
logger.
 
    private static Log log = ExoLogger.getLogger("exo.jcr.component.webdav.PropPatchCommand");

   
resource locks.
 
    protected final NullResourceLocksHolder lockHolder;

   
Constructor.

Parameters:
lockHolder resource locks
 
    public PropPatchCommand(NullResourceLocksHolder lockHolder)
    {
       this. = lockHolder;
    }

   
Webdav Proppatch method method implementation.

Parameters:
session current session
path resource path
body request body
tokens tokens
baseURI base uri
Returns:
the instance of javax.ws.rs.core.Response
 
    public Response propPatch(Session sessionString pathHierarchicalProperty bodyList<Stringtokens,
       String baseURI)
    {
       try
       {
 
          .checkLock(sessionpathtokens);
 
          Node node = (Node)session.getItem(path);
 
          WebDavNamespaceContext nsContext = new WebDavNamespaceContext(session);
          URI uri = new URI(TextUtil.escape(baseURI + node.getPath(), '%'true));
 
          List<HierarchicalPropertysetList = Collections.emptyList();
          if (body.getChild(new QName("DAV:""set")) != null)
          {
             setList = setList(body);
          }
         List<HierarchicalPropertyremoveList = Collections.emptyList();
         if (body.getChild(new QName("DAV:""remove")) != null)
         {
            removeList = removeList(body);
         }
         PropPatchResponseEntity entity = new PropPatchResponseEntity(nsContextnodeurisetListremoveList);
         return Response.status(.).entity(entity).type(.).build();
      }
      catch (PathNotFoundException exc)
      {
         return Response.status(.).entity(exc.getMessage()).build();
      }
      catch (LockException exc)
      {
         return Response.status(.).entity(exc.getMessage()).build();
      }
      catch (Exception exc)
      {
         .error(exc.getMessage(), exc);
         return Response.serverError().entity(exc.getMessage()).build();
      }
   }

   
List of properties to set.

Parameters:
request request body
Returns:
list of properties to set.
   {
      HierarchicalProperty set = request.getChild(new QName("DAV:""set"));
      HierarchicalProperty prop = set.getChild(new QName("DAV:""prop"));
      List<HierarchicalPropertysetList = prop.getChildren();
      return setList;
   }

   
List of properties to remove.

Parameters:
request request body
Returns:
list of properties to remove.
   {
      HierarchicalProperty remove = request.getChild(new QName("DAV:""remove"));
      HierarchicalProperty prop = remove.getChild(new QName("DAV:""prop"));
      List<HierarchicalPropertyremoveList = prop.getChildren();
      return removeList;
   }
New to GrepCode? Check out our FAQ X