Package org.apache.sling.servlets.post.impl.operations

# Klasse AbstractPostOperation

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

Alle implementierten Schnittstellen:
  `JakartaPostOperation`

Bekannte direkte Unterklassen:
  `CheckinOperation`, `CheckoutOperation`, `CopyOperation`, `DeleteOperation`, `ImportOperation`, `ModifyOperation`, `MoveOperation`, `RestoreOperation`, `StreamedUploadOperation`

public abstract class AbstractPostOperation extends Object implements JakartaPostOperation
The `AbstractPostOperation` class is a base implementation of the `JakartaPostOperation` service interface providing actual implementations with useful tooling and common functionality like preparing the change logs or saving or refreshing. As this package is not exported, if you want to use this as a base class for custom operations you'll need to embed it in your bundles using the appropriate bnd directive.

## Feldübersicht

Felder
Modifizierer und Typ
Feld
Beschreibung
`protected final JCRSupport`
`jcrSupport`
The JCR support provides additional functionality if the resources are backed by JCR.
`protected final org.slf4j.Logger`
`log`
Default logger

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

`PROP_OPERATION_NAME, SERVICE_NAME`

## Konstruktorübersicht

Konstruktoren
Konstruktor
Beschreibung
`AbstractPostOperation()`

## Methodenübersicht

Modifizierer und Typ
Methode
Beschreibung
`protected abstract void`
`doRun(org.apache.sling.api.SlingJakartaHttpServletRequest request, JakartaPostResponse response, List<Modification> changes)`
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.SlingJakartaHttpServletRequest request, String path)`
Returns an external form of the given path prepending the context path and appending a display extension.
`protected Iterator<org.apache.sling.api.resource.Resource>`
`getApplyToResources(org.apache.sling.api.SlingJakartaHttpServletRequest request)`
Returns an iterator on `Resource` instances addressed in the `SlingPostConstants.RP_APPLY_TO` request parameter.
`protected String`
`getResourcePath(org.apache.sling.api.SlingJakartaHttpServletRequest request)`
Returns the path of the resource of the request as the resource path.
`protected VersioningConfiguration`
`getVersioningConfiguration(org.apache.sling.api.SlingJakartaHttpServletRequest request)`
Get the versioning configuration.
`protected boolean`
`isSkipCheckin(org.apache.sling.api.SlingJakartaHttpServletRequest request)`
Check if checkin should be skipped
`protected void`
`orderResource(org.apache.sling.api.SlingJakartaHttpServletRequest request, org.apache.sling.api.resource.Resource resource, List<Modification> changes)`
Orders the given resource according to the specified command.
`void`
`run(org.apache.sling.api.SlingJakartaHttpServletRequest request, JakartaPostResponse response, SlingJakartaPostProcessor[] processors)`
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
Default logger

### jcrSupport

protected final JCRSupport jcrSupport
The JCR support provides additional functionality if the resources are backed by JCR.

## Konstruktordetails

### AbstractPostOperation

public AbstractPostOperation()

## Methodendetails

### run

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

Angegeben von:
  `run` in Schnittstelle `JakartaPostOperation`
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.
  `org.apache.sling.api.resource.PersistenceException` - when the commit fails

### doRun

protected abstract void doRun(org.apache.sling.api.SlingJakartaHttpServletRequest request, JakartaPostResponse response, List<Modification> changes) throws org.apache.sling.api.resource.PersistenceException
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 `SlingJakartaHttpServletRequest` 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:
  `org.apache.sling.api.resource.PersistenceException` - Maybe thrown if any error occurs while accessing the repository.

### getVersioningConfiguration

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

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

### isSkipCheckin

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

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

### getApplyToResources

protected Iterator<org.apache.sling.api.resource.Resource> getApplyToResources(org.apache.sling.api.SlingJakartaHttpServletRequest request)
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 `SlingJakartaHttpServletRequest` 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.SlingJakartaHttpServletRequest request, String path)
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

### getResourcePath

protected String getResourcePath(org.apache.sling.api.SlingJakartaHttpServletRequest request)
Returns the path of the resource of the request as the resource 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 resource path

### orderResource

protected void orderResource(org.apache.sling.api.SlingJakartaHttpServletRequest request, org.apache.sling.api.resource.Resource resource, List<Modification> changes) throws org.apache.sling.api.resource.PersistenceException
Orders the given resource 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
  `resource` - the resource to order
  `changes` - the list of modifications
Löst aus:
  `org.apache.sling.api.resource.PersistenceException` - in case the operation is not successful