org.apache.sling.servlets.post.impl.operations
Class ModifyOperation

java.lang.Object
  extended by org.apache.sling.servlets.post.AbstractSlingPostOperation
      extended by org.apache.sling.servlets.post.impl.operations.ModifyOperation
All Implemented Interfaces:
SlingPostOperation

public class ModifyOperation
extends AbstractSlingPostOperation

The ModifyOperation class implements the default operation called by the Sling default POST servlet if no operation is requested by the client. This operation is able to create and/or modify content.


Field Summary
 
Fields inherited from class org.apache.sling.servlets.post.AbstractSlingPostOperation
log
 
Fields inherited from interface org.apache.sling.servlets.post.SlingPostOperation
PROP_OPERATION_NAME, SERVICE_NAME
 
Constructor Summary
ModifyOperation(NodeNameGenerator defaultNodeNameGenerator, DateParser dateParser, javax.servlet.ServletContext servletContext)
           
 
Method Summary
protected  Map<String,RequestProperty> collectContent(SlingHttpServletRequest request, HtmlResponse response)
          Collects the properties that form the content to be written back to the repository.
protected  javax.jcr.Node deepGetOrCreateNode(javax.jcr.Session session, String path, Map<String,RequestProperty> reqProperties, List<Modification> changes, VersioningConfiguration versioningConfiguration)
          Deep gets or creates a node, parent-padding with default nodes nodes.
protected  void doRun(SlingHttpServletRequest request, HtmlResponse response, List<Modification> changes)
           
protected  String generateName(SlingHttpServletRequest request, String basePath)
           
protected  String getItemPath(SlingHttpServletRequest request)
          Returns the path of the resource of the request as the item path.
protected  void processCreate(javax.jcr.Session session, Map<String,RequestProperty> reqProperties, HtmlResponse response, List<Modification> changes, VersioningConfiguration versioningConfiguration)
          Create node(s) according to current request
 void setExtraNodeNameGenerators(NodeNameGenerator[] extraNodeNameGenerators)
           
protected  void updateMixins(javax.jcr.Session session, String path, Map<String,RequestProperty> reqProperties, List<Modification> changes, VersioningConfiguration versioningConfiguration)
           
 
Methods inherited from class org.apache.sling.servlets.post.AbstractSlingPostOperation
checkoutIfNecessary, externalizePath, findVersionableAncestor, getApplyToResources, getVersioningConfiguration, hasItemPathPrefix, isSkipCheckin, isVersionable, orderNode, removeAndValidateWorkspace, requireItemPathPrefix, resolvePath, run
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModifyOperation

public ModifyOperation(NodeNameGenerator defaultNodeNameGenerator,
                       DateParser dateParser,
                       javax.servlet.ServletContext servletContext)
Method Detail

doRun

protected void doRun(SlingHttpServletRequest request,
                     HtmlResponse response,
                     List<Modification> changes)
              throws javax.jcr.RepositoryException
Specified by:
doRun in class AbstractSlingPostOperation
Throws:
javax.jcr.RepositoryException

getItemPath

protected String getItemPath(SlingHttpServletRequest request)
Description copied from class: AbstractSlingPostOperation
Returns the path of the resource of the request as the item path.

This method may be overwritten by extension if the operation has different requirements on path processing.

Overrides:
getItemPath in class AbstractSlingPostOperation

setExtraNodeNameGenerators

public void setExtraNodeNameGenerators(NodeNameGenerator[] extraNodeNameGenerators)

processCreate

protected void processCreate(javax.jcr.Session session,
                             Map<String,RequestProperty> reqProperties,
                             HtmlResponse response,
                             List<Modification> changes,
                             VersioningConfiguration versioningConfiguration)
                      throws javax.jcr.RepositoryException
Create node(s) according to current request

Throws:
javax.jcr.RepositoryException - if a repository error occurs

updateMixins

protected void updateMixins(javax.jcr.Session session,
                            String path,
                            Map<String,RequestProperty> reqProperties,
                            List<Modification> changes,
                            VersioningConfiguration versioningConfiguration)
                     throws javax.jcr.PathNotFoundException,
                            javax.jcr.RepositoryException,
                            javax.jcr.nodetype.NoSuchNodeTypeException,
                            javax.jcr.version.VersionException,
                            javax.jcr.nodetype.ConstraintViolationException,
                            javax.jcr.lock.LockException
Throws:
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException
javax.jcr.nodetype.NoSuchNodeTypeException
javax.jcr.version.VersionException
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.lock.LockException

collectContent

protected Map<String,RequestProperty> collectContent(SlingHttpServletRequest request,
                                                     HtmlResponse response)
Collects the properties that form the content to be written back to the repository.

Throws:
javax.jcr.RepositoryException - if a repository error occurs
javax.servlet.ServletException - if an internal error occurs

deepGetOrCreateNode

protected javax.jcr.Node deepGetOrCreateNode(javax.jcr.Session session,
                                             String path,
                                             Map<String,RequestProperty> reqProperties,
                                             List<Modification> changes,
                                             VersioningConfiguration versioningConfiguration)
                                      throws javax.jcr.RepositoryException
Deep gets or creates a node, parent-padding with default nodes nodes. If the path is empty, the given parent node is returned.

Parameters:
path - path to node that needs to be deep-created
checkedOutNodes -
Returns:
node at path
Throws:
javax.jcr.RepositoryException - if an error occurs
IllegalArgumentException - if the path is relative and parent is null

generateName

protected String generateName(SlingHttpServletRequest request,
                              String basePath)
                       throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException


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