Class AbstractPostOperation

    • Field Detail

      • 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.
    • Constructor Detail

      • AbstractPostOperation

        public AbstractPostOperation()
    • Method Detail

      • doRun

        protected abstract void doRun​(org.apache.sling.api.SlingHttpServletRequest request,
                                      PostResponse 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.

        Parameters:
        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.
        Throws:
        org.apache.sling.api.resource.PersistenceException - Maybe thrown if any error occurs while accessing the repository.
      • getVersioningConfiguration

        protected VersioningConfiguration getVersioningConfiguration​(org.apache.sling.api.SlingHttpServletRequest request)
        Get the versioning configuration.
        Parameters:
        request - The http request
        Returns:
        The versioning configuration
      • isSkipCheckin

        protected boolean isSkipCheckin​(org.apache.sling.api.SlingHttpServletRequest request)
        Check if checkin should be skipped
        Parameters:
        request - The http request
        Returns:
        true if checkin should be skipped
      • getApplyToResources

        protected Iterator<org.apache.sling.api.resource.Resource> getApplyToResources​(org.apache.sling.api.SlingHttpServletRequest 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.
        Parameters:
        request - The SlingHttpServletRequest object used to get the SlingPostConstants.RP_APPLY_TO parameter.
        Returns:
        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)
        Returns an external form of the given path prepending the context path and appending a display extension.
        Parameters:
        request - The http request
        path - the path to externalize
        Returns:
        the url
      • getResourcePath

        protected String getResourcePath​(org.apache.sling.api.SlingHttpServletRequest 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.

        Parameters:
        request - The http request
        Returns:
        The resource path
      • orderResource

        protected void orderResource​(org.apache.sling.api.SlingHttpServletRequest 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>
        Parameters:
        request - The http request
        resource - the resource to order
        changes - the list of modifications
        Throws:
        org.apache.sling.api.resource.PersistenceException - in case the operation is not successful