Package org.apache.sling.servlets.post

# Klasse AbstractPostOperation

java.lang.Object
org.apache.sling.servlets.post.AbstractPostOperation

Alle implementierten Schnittstellen:
  `PostOperation`

Bekannte direkte Unterklassen:
  `AbstractSlingPostOperation`

@Deprecated public abstract class AbstractPostOperation extends Object implements PostOperation
Veraltet.
(SLING-6722): this class mixes Sling and JCR APIs which is not optimal as nowadays we favor the Sling APIs. There's no intention to remove it however, if you're using JCR APIs anyways in your project it's fine to use it. Theres no public replacement for it as I write this.
The `AbstractPostOperation` class is a base implementation of the `PostOperation` service interface providing actual implementations with useful tooling and common functionality like preparing the change logs or saving or refreshing the JCR Session.

## Feldübersicht

Felder
Modifizierer und Typ
Feld
Beschreibung
`protected final org.slf4j.Logger`
`log`
Veraltet.
default log

### Von Schnittstelle geerbte Felder org.apache.sling.servlets.post.PostOperation

`PROP_OPERATION_NAME, SERVICE_NAME`

## Konstruktorübersicht

Konstruktoren
Konstruktor
Beschreibung
`AbstractPostOperation()`
Veraltet.

## Methodenübersicht

Modifizierer und Typ
Methode
Beschreibung
`protected void`
`checkoutIfNecessary(javax.jcr.Node node, List<Modification> changes, VersioningConfiguration versioningConfiguration)`
Veraltet.
`protected abstract void`
`doRun(org.apache.sling.api.SlingHttpServletRequest request, PostResponse response, List<Modification> changes)`
Veraltet.
Actually performs the desired operation filling progress into the `changes` list and preparing and further information in the `response`.
`protected final String`
`externalizePath(org.apache.sling.api.SlingHttpServletRequest request, String path)`
Veraltet.
Returns an external form of the given path prepending the context path and appending a display extension.
`protected javax.jcr.Node`
`findVersionableAncestor(javax.jcr.Node node)`
Veraltet.
`protected Iterator<org.apache.sling.api.resource.Resource>`
`getApplyToResources(org.apache.sling.api.SlingHttpServletRequest request)`
Veraltet.
Returns an iterator on `Resource` instances addressed in the `SlingPostConstants.RP_APPLY_TO` request parameter.
`protected String`
`getItemPath(org.apache.sling.api.SlingHttpServletRequest request)`
Veraltet.
Returns the path of the resource of the request as the item path.
`protected VersioningConfiguration`
`getVersioningConfiguration(org.apache.sling.api.SlingHttpServletRequest request)`
Veraltet.
Get the versioning configuration.
`protected boolean`
`hasItemPathPrefix(String name)`
Veraltet.
Returns `true` if the `name` starts with either of the prefixes `./`, `../` and `/`.
`protected boolean`
`isSessionSaveRequired(javax.jcr.Session session, org.apache.sling.api.SlingHttpServletRequest request)`
Veraltet.
Check whether commit to the resource resolver should be called.
`protected boolean`
`isSkipCheckin(org.apache.sling.api.SlingHttpServletRequest request)`
Veraltet.
Check if checkin should be skipped
`protected boolean`
`isSkipSessionHandling(org.apache.sling.api.SlingHttpServletRequest request)`
Veraltet.
Check whether changes should be written back
`protected boolean`
`isVersionable(javax.jcr.Node node)`
Veraltet.
`protected void`
`orderNode(org.apache.sling.api.SlingHttpServletRequest request, javax.jcr.Item item, List<Modification> changes)`
Veraltet.
Orders the given node according to the specified command.
`protected String`
`removeAndValidateWorkspace(String path, javax.jcr.Session session)`
Veraltet.
Remove the workspace name, if any, from the start of the path and validate that the session's workspace name matches the path workspace name.
`protected final boolean`
`requireItemPathPrefix(org.apache.sling.api.SlingHttpServletRequest request)`
Veraltet.
Returns true if any of the request parameters starts with `./`.
`protected final String`
`resolvePath(String absPath, String relPath)`
Veraltet.
Resolves the given path with respect to the current root path.
`void`
`run(org.apache.sling.api.SlingHttpServletRequest request, PostResponse response, SlingPostProcessor[] processors)`
Veraltet.
Prepares and finalizes the actual operation.

### Von Klasse geerbte Methoden java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Felddetails

### log

protected final org.slf4j.Logger log
Veraltet.
default log

## Konstruktordetails

### AbstractPostOperation

public AbstractPostOperation()
Veraltet.

## Methodendetails

### run

public void run(org.apache.sling.api.SlingHttpServletRequest request, PostResponse response, SlingPostProcessor[] processors) throws PreconditionViolatedPersistenceException, TemporaryPersistenceException
Veraltet.
Prepares and finalizes the actual operation. Preparation encompasses getting the absolute path of the item to operate on by calling the `getItemPath(SlingHttpServletRequest)` method and setting the location and parent location on the response. After the operation has been done in the `doRun(SlingHttpServletRequest, PostResponse, List)` method the session is saved if there are unsaved modifications. In case of errorrs, the unsaved changes in the session are rolled back.

Angegeben von:
  `run` in Schnittstelle `PostOperation`
Parameter:
  `request` - the request to operate on
  `response` - The `PostResponse` to record execution progress.
  `processors` - The array of processors
Löst aus:
  `PreconditionViolatedPersistenceException` - when a necessary precondition failed, and a retry without further changes doesn't make sense.
  `TemporaryPersistenceException` - when a commit failed, but a retry could make the operation work successfully.

### doRun

protected abstract void doRun(org.apache.sling.api.SlingHttpServletRequest request, PostResponse response, List<Modification> changes) throws javax.jcr.RepositoryException, PreconditionViolatedPersistenceException, TemporaryPersistenceException
Veraltet.
Actually performs the desired operation filling progress into the `changes` list and preparing and further information in the `response`.

The `response` comes prepared with the path, location and parent location set. Other properties are expected to be set by this implementation.

Parameter:
  `request` - The `SlingHttpServletRequest` providing the input, mostly in terms of request parameters, to the operation.
  `response` - The `PostResponse` to fill with response information
  `changes` - A container to add `Modification` instances representing the operations done.
Löst aus:
  `javax.jcr.RepositoryException` - Maybe thrown if any error occurrs while accessing the repository.
  `TemporaryPersistenceException` - if a retry could help
  `PreconditionViolatedPersistenceException` - if a retry doesn't make sense and some preconditions should be changed.

### getVersioningConfiguration

protected VersioningConfiguration getVersioningConfiguration(org.apache.sling.api.SlingHttpServletRequest request)
Veraltet.
Get the versioning configuration.

Parameter:
  `request` - The http request
Gibt zurück:
  The versioning configuration

### isSkipCheckin

protected boolean isSkipCheckin(org.apache.sling.api.SlingHttpServletRequest request)
Veraltet.
Check if checkin should be skipped

Parameter:
  `request` - The http request
Gibt zurück:
  `true` if checkin should be skipped

### isSkipSessionHandling

protected boolean isSkipSessionHandling(org.apache.sling.api.SlingHttpServletRequest request)
Veraltet.
Check whether changes should be written back

Parameter:
  `request` - The http request
Gibt zurück:
  `true` If session handling should be skipped

### isSessionSaveRequired

protected boolean isSessionSaveRequired(javax.jcr.Session session, org.apache.sling.api.SlingHttpServletRequest request) throws javax.jcr.RepositoryException
Veraltet.
Check whether commit to the resource resolver should be called.

Parameter:
  `session` - The JCR session
  `request` - The http request
Gibt zurück:
  `true` if a save is required.
Löst aus:
  `javax.jcr.RepositoryException` - a repository exception

### removeAndValidateWorkspace

protected String removeAndValidateWorkspace(String path, javax.jcr.Session session) throws javax.jcr.RepositoryException
Veraltet.
Remove the workspace name, if any, from the start of the path and validate that the session's workspace name matches the path workspace name.

Parameter:
  `path` - The path
  `session` - The JCR session
Gibt zurück:
  The path without the workspace
Löst aus:
  `javax.jcr.RepositoryException` - a repository exception

### getItemPath

protected String getItemPath(org.apache.sling.api.SlingHttpServletRequest request)
Veraltet.
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.

Parameter:
  `request` - The http request
Gibt zurück:
  The item path

### getApplyToResources

protected Iterator<org.apache.sling.api.resource.Resource> getApplyToResources(org.apache.sling.api.SlingHttpServletRequest request)
Veraltet.
Returns an iterator on `Resource` instances addressed in the `SlingPostConstants.RP_APPLY_TO` request parameter. If the request parameter is not set, `null` is returned. If the parameter is set with valid resources an empty iterator is returned. Any resources addressed in the `SlingPostConstants.RP_APPLY_TO` parameter is ignored.

Parameter:
  `request` - The `SlingHttpServletRequest` object used to get the `SlingPostConstants.RP_APPLY_TO` parameter.
Gibt zurück:
  The iterator of resources listed in the parameter or `null` if the parameter is not set in the request.

### externalizePath

protected final String externalizePath(org.apache.sling.api.SlingHttpServletRequest request, String path)
Veraltet.
Returns an external form of the given path prepending the context path and appending a display extension.

Parameter:
  `request` - The http request
  `path` - the path to externalize
Gibt zurück:
  the url

### resolvePath

protected final String resolvePath(String absPath, String relPath)
Veraltet.
Resolves the given path with respect to the current root path.

Parameter:
  `absPath` - The absolute base path
  `relPath` - the path to resolve
Gibt zurück:
  the given path if it starts with a '/'; a resolved path otherwise.

### requireItemPathPrefix

protected final boolean requireItemPathPrefix(org.apache.sling.api.SlingHttpServletRequest request)
Veraltet.
Returns true if any of the request parameters starts with `./`. In this case only parameters starting with either of the prefixes `./`, `../` and `/` are considered as providing content to be stored. Otherwise all parameters not starting with the command prefix `:` are considered as parameters to be stored.

Parameter:
  `request` - The http request
Gibt zurück:
  If a prefix is required.

### hasItemPathPrefix

protected boolean hasItemPathPrefix(String name)
Veraltet.
Returns `true` if the `name` starts with either of the prefixes `./`, `../` and `/`.

Parameter:
  `name` - The name
Gibt zurück:
  `true` if the name has a prefix

### orderNode

protected void orderNode(org.apache.sling.api.SlingHttpServletRequest request, javax.jcr.Item item, List<Modification> changes) throws javax.jcr.RepositoryException
Veraltet.
Orders the given node according to the specified command. The following syntax is supported: <xmp> | first | before all child nodes | before A | before child node A | after A | after child node A | last | after all nodes | N | at a specific position, N being an integer </xmp>

Parameter:
  `request` - The http request
  `item` - node to order
  `changes` - The list of modifications
Löst aus:
  `javax.jcr.RepositoryException` - if an error occurs

### findVersionableAncestor

protected javax.jcr.Node findVersionableAncestor(javax.jcr.Node node) throws javax.jcr.RepositoryException
Veraltet.

Löst aus:
  `javax.jcr.RepositoryException`

### isVersionable

protected boolean isVersionable(javax.jcr.Node node) throws javax.jcr.RepositoryException
Veraltet.

Löst aus:
  `javax.jcr.RepositoryException`

### checkoutIfNecessary

protected void checkoutIfNecessary(javax.jcr.Node node, List<Modification> changes, VersioningConfiguration versioningConfiguration) throws javax.jcr.RepositoryException
Veraltet.

Löst aus:
  `javax.jcr.RepositoryException`