Class ImportOperation

java.lang.Object
org.apache.sling.servlets.post.impl.operations.AbstractPostOperation
org.apache.sling.servlets.post.impl.operations.ImportOperation
All Implemented Interfaces:
JakartaPostOperation

public class ImportOperation extends AbstractPostOperation
The ImportOperation class implements the SlingPostConstants.OPERATION_IMPORT import operation for the Sling default POST servlet.
  • Constructor Details

    • ImportOperation

      public ImportOperation()
  • Method Details

    • setContentImporter

      public void setContentImporter(Object importer)
    • unsetContentImporter

      public void unsetContentImporter(Object importer)
    • doRun

      protected void doRun(org.apache.sling.api.SlingJakartaHttpServletRequest request, JakartaPostResponse response, List<Modification> changes) throws org.apache.sling.api.resource.PersistenceException
      Description copied from class: AbstractPostOperation
      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.

      Specified by:
      doRun in class AbstractPostOperation
      Parameters:
      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.
      Throws:
      org.apache.sling.api.resource.PersistenceException - Maybe thrown if any error occurs while accessing the repository.
    • setDefaultNodeNameGenerator

      public void setDefaultNodeNameGenerator(JakartaNodeNameGenerator defaultNodeNameGenerator)
    • setExtraNodeNameGenerators

      public void setExtraNodeNameGenerators(JakartaNodeNameGenerator[] extraNodeNameGenerators)
    • setIgnoredParameterNamePattern

      public void setIgnoredParameterNamePattern(Pattern ignoredParameterNamePattern)
    • processCreate

      protected void processCreate(org.apache.sling.api.resource.ResourceResolver resolver, Map<String,RequestProperty> reqProperties, JakartaPostResponse response, List<Modification> changes, VersioningConfiguration versioningConfiguration) throws org.apache.sling.api.resource.PersistenceException
      Create resource(s) according to current request
      Parameters:
      resolver - the resourceResolver to use
      reqProperties - required properties
      response - the response
      changes - the changes to apply
      versioningConfiguration - versioning configuration
      Throws:
      org.apache.sling.api.resource.PersistenceException - if a resource error occurs
    • updateNodeType

      protected void updateNodeType(org.apache.sling.api.resource.ResourceResolver resolver, String path, Map<String,RequestProperty> reqProperties, List<Modification> changes, VersioningConfiguration versioningConfiguration) throws org.apache.sling.api.resource.PersistenceException
      Throws:
      org.apache.sling.api.resource.PersistenceException
    • updateMixins

      protected void updateMixins(org.apache.sling.api.resource.ResourceResolver resolver, String path, Map<String,RequestProperty> reqProperties, List<Modification> changes, VersioningConfiguration versioningConfiguration) throws org.apache.sling.api.resource.PersistenceException
      Throws:
      org.apache.sling.api.resource.PersistenceException
    • collectContent

      protected Map<String,RequestProperty> collectContent(org.apache.sling.api.SlingJakartaHttpServletRequest request, JakartaPostResponse response)
      Collects the properties that form the content to be written back to the resource tree.
      Parameters:
      request - the request
      response - the response
      Returns:
      the collected properties
    • deepGetOrCreateResource

      protected org.apache.sling.api.resource.Resource deepGetOrCreateResource(org.apache.sling.api.resource.ResourceResolver resolver, String path, Map<String,RequestProperty> reqProperties, List<Modification> changes, VersioningConfiguration versioningConfiguration) throws org.apache.sling.api.resource.PersistenceException
      Deep gets or creates a resource, parent-padding with default resources. If the path is empty, the given parent resource is returned.
      Parameters:
      resolver - the resource resolver to use
      path - path to resources that needs to be deep-created
      reqProperties - the properties to add
      changes - the changes to apply
      versioningConfiguration - the versioning configuration
      Returns:
      Resource at path
      Throws:
      org.apache.sling.api.resource.PersistenceException - if an error occurs
      IllegalArgumentException - if the path is relative and parent is null
    • generateName

      protected String generateName(org.apache.sling.api.SlingJakartaHttpServletRequest request, String basePath) throws org.apache.sling.api.resource.PersistenceException
      Throws:
      org.apache.sling.api.resource.PersistenceException