@Deprecated public abstract class AbstractPostOperation extends java.lang.Object implements PostOperation
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.Modifier and Type | Field and Description |
---|---|
protected org.slf4j.Logger |
log
Deprecated.
default log
|
PROP_OPERATION_NAME, SERVICE_NAME
Constructor and Description |
---|
AbstractPostOperation()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
protected void |
checkoutIfNecessary(javax.jcr.Node node,
java.util.List<Modification> changes,
VersioningConfiguration versioningConfiguration)
Deprecated.
|
protected abstract void |
doRun(SlingHttpServletRequest request,
PostResponse response,
java.util.List<Modification> changes)
Deprecated.
Actually performs the desired operation filling progress into the
changes list and preparing and further information in the
response . |
protected java.lang.String |
externalizePath(SlingHttpServletRequest request,
java.lang.String path)
Deprecated.
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)
Deprecated.
|
protected java.util.Iterator<Resource> |
getApplyToResources(SlingHttpServletRequest request)
Deprecated.
Returns an iterator on
Resource instances addressed in the
SlingPostConstants.RP_APPLY_TO request parameter. |
protected java.lang.String |
getItemPath(SlingHttpServletRequest request)
Deprecated.
Returns the path of the resource of the request as the item path.
|
protected VersioningConfiguration |
getVersioningConfiguration(SlingHttpServletRequest request)
Deprecated.
Get the versioning configuration.
|
protected boolean |
hasItemPathPrefix(java.lang.String name)
Deprecated.
|
protected boolean |
isSessionSaveRequired(javax.jcr.Session session,
SlingHttpServletRequest request)
Deprecated.
Check whether commit to the resource resolver should be called.
|
protected boolean |
isSkipCheckin(SlingHttpServletRequest request)
Deprecated.
Check if checkin should be skipped
|
protected boolean |
isSkipSessionHandling(SlingHttpServletRequest request)
Deprecated.
Check whether changes should be written back
|
protected boolean |
isVersionable(javax.jcr.Node node)
Deprecated.
|
protected void |
orderNode(SlingHttpServletRequest request,
javax.jcr.Item item,
java.util.List<Modification> changes)
Deprecated.
Orders the given node according to the specified command.
|
protected java.lang.String |
removeAndValidateWorkspace(java.lang.String path,
javax.jcr.Session session)
Deprecated.
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 boolean |
requireItemPathPrefix(SlingHttpServletRequest request)
Deprecated.
Returns true if any of the request parameters starts with
./ . |
protected java.lang.String |
resolvePath(java.lang.String absPath,
java.lang.String relPath)
Deprecated.
Resolves the given path with respect to the current root path.
|
void |
run(SlingHttpServletRequest request,
PostResponse response,
SlingPostProcessor[] processors)
Deprecated.
Prepares and finalizes the actual operation.
|
public void run(SlingHttpServletRequest request, PostResponse response, SlingPostProcessor[] processors) throws PreconditionViolatedPersistenceException, TemporaryPersistenceException
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.run
in interface PostOperation
request
- the request to operate onresponse
- The PostResponse
to record execution
progress.processors
- The array of processorsPreconditionViolatedPersistenceException
- 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.protected abstract void doRun(SlingHttpServletRequest request, PostResponse response, java.util.List<Modification> changes) throws javax.jcr.RepositoryException, PreconditionViolatedPersistenceException, TemporaryPersistenceException
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.
request
- The SlingHttpServletRequest
providing the
input, mostly in terms of request parameters, to the
operation.response
- The PostResponse
to fill with response
informationchanges
- A container to add Modification
instances
representing the operations done.javax.jcr.RepositoryException
- Maybe thrown if any error occurrs while
accessing the repository.TemporaryPersistenceException
- if a retry could helpPreconditionViolatedPersistenceException
- if a retry doesn't make sense
and some preconditions should be changed.protected VersioningConfiguration getVersioningConfiguration(SlingHttpServletRequest request)
request
- The http requestprotected boolean isSkipCheckin(SlingHttpServletRequest request)
request
- The http requesttrue
if checkin should be skippedprotected boolean isSkipSessionHandling(SlingHttpServletRequest request)
request
- The http requesttrue
If session handling should be skippedprotected boolean isSessionSaveRequired(javax.jcr.Session session, SlingHttpServletRequest request) throws javax.jcr.RepositoryException
session
- The JCR sessionrequest
- The http requesttrue
if a save is required.javax.jcr.RepositoryException
- a repository exceptionprotected java.lang.String removeAndValidateWorkspace(java.lang.String path, javax.jcr.Session session) throws javax.jcr.RepositoryException
path
- The pathsession
- The JCR sessionjavax.jcr.RepositoryException
- a repository exceptionprotected java.lang.String getItemPath(SlingHttpServletRequest request)
This method may be overwritten by extension if the operation has different requirements on path processing.
request
- The http requestprotected java.util.Iterator<Resource> getApplyToResources(SlingHttpServletRequest request)
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.request
- The SlingHttpServletRequest
object used to
get the SlingPostConstants.RP_APPLY_TO
parameter.null
if the parameter is not set in the request.protected final java.lang.String externalizePath(SlingHttpServletRequest request, java.lang.String path)
request
- The http requestpath
- the path to externalizeprotected final java.lang.String resolvePath(java.lang.String absPath, java.lang.String relPath)
absPath
- The absolute base pathrelPath
- the path to resolveprotected final boolean requireItemPathPrefix(SlingHttpServletRequest request)
./
.
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.request
- The http requestprotected boolean hasItemPathPrefix(java.lang.String name)
name
- The nametrue
if the name has a prefixprotected void orderNode(SlingHttpServletRequest request, javax.jcr.Item item, java.util.List<Modification> changes) throws javax.jcr.RepositoryException
request
- The http requestitem
- node to orderchanges
- The list of modificationsjavax.jcr.RepositoryException
- if an error occursprotected javax.jcr.Node findVersionableAncestor(javax.jcr.Node node) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
protected boolean isVersionable(javax.jcr.Node node) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
protected void checkoutIfNecessary(javax.jcr.Node node, java.util.List<Modification> changes, VersioningConfiguration versioningConfiguration) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
Copyright © 2022 The Apache Software Foundation. All rights reserved.