Class ImportOperation
- java.lang.Object
-
- org.apache.sling.servlets.post.impl.operations.AbstractPostOperation
-
- org.apache.sling.servlets.post.impl.operations.ImportOperation
-
- All Implemented Interfaces:
PostOperation
public class ImportOperation extends AbstractPostOperation
TheImportOperationclass implements theSlingPostConstants.OPERATION_IMPORTimport operation for the Sling default POST servlet.
-
-
Field Summary
-
Fields inherited from class org.apache.sling.servlets.post.impl.operations.AbstractPostOperation
jcrSupport, log
-
Fields inherited from interface org.apache.sling.servlets.post.PostOperation
PROP_OPERATION_NAME, SERVICE_NAME
-
-
Constructor Summary
Constructors Constructor Description ImportOperation()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Map<String,RequestProperty>collectContent(org.apache.sling.api.SlingHttpServletRequest request, PostResponse response)Collects the properties that form the content to be written back to the resource tree.protected org.apache.sling.api.resource.ResourcedeepGetOrCreateResource(org.apache.sling.api.resource.ResourceResolver resolver, String path, Map<String,RequestProperty> reqProperties, List<Modification> changes, VersioningConfiguration versioningConfiguration)Deep gets or creates a resource, parent-padding with default resources.protected voiddoRun(org.apache.sling.api.SlingHttpServletRequest request, PostResponse response, List<Modification> changes)Actually performs the desired operation filling progress into thechangeslist and preparing and further information in theresponse.protected StringgenerateName(org.apache.sling.api.SlingHttpServletRequest request, String basePath)protected voidprocessCreate(org.apache.sling.api.resource.ResourceResolver resolver, Map<String,RequestProperty> reqProperties, PostResponse response, List<Modification> changes, VersioningConfiguration versioningConfiguration)Create resource(s) according to current requestvoidsetContentImporter(Object importer)voidsetDefaultNodeNameGenerator(NodeNameGenerator defaultNodeNameGenerator)voidsetExtraNodeNameGenerators(NodeNameGenerator[] extraNodeNameGenerators)voidsetIgnoredParameterNamePattern(Pattern ignoredParameterNamePattern)voidunsetContentImporter(Object importer)protected voidupdateMixins(org.apache.sling.api.resource.ResourceResolver resolver, String path, Map<String,RequestProperty> reqProperties, List<Modification> changes, VersioningConfiguration versioningConfiguration)protected voidupdateNodeType(org.apache.sling.api.resource.ResourceResolver resolver, String path, Map<String,RequestProperty> reqProperties, List<Modification> changes, VersioningConfiguration versioningConfiguration)-
Methods inherited from class org.apache.sling.servlets.post.impl.operations.AbstractPostOperation
externalizePath, getApplyToResources, getResourcePath, getVersioningConfiguration, isSkipCheckin, orderResource, run
-
-
-
-
Method Detail
-
setContentImporter
public void setContentImporter(Object importer)
-
unsetContentImporter
public void unsetContentImporter(Object importer)
-
doRun
protected void doRun(org.apache.sling.api.SlingHttpServletRequest request, PostResponse response, List<Modification> changes) throws org.apache.sling.api.resource.PersistenceExceptionDescription copied from class:AbstractPostOperationActually performs the desired operation filling progress into thechangeslist and preparing and further information in theresponse.The
responsecomes prepared with the path, location and parent location set. Other properties are expected to be set by this implementation.- Specified by:
doRunin classAbstractPostOperation- Parameters:
request- TheSlingHttpServletRequestproviding the input, mostly in terms of request parameters, to the operation.response- ThePostResponseto fill with response informationchanges- A container to addModificationinstances 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(NodeNameGenerator defaultNodeNameGenerator)
-
setExtraNodeNameGenerators
public void setExtraNodeNameGenerators(NodeNameGenerator[] extraNodeNameGenerators)
-
setIgnoredParameterNamePattern
public void setIgnoredParameterNamePattern(Pattern ignoredParameterNamePattern)
-
processCreate
protected void processCreate(org.apache.sling.api.resource.ResourceResolver resolver, Map<String,RequestProperty> reqProperties, PostResponse response, List<Modification> changes, VersioningConfiguration versioningConfiguration) throws org.apache.sling.api.resource.PersistenceExceptionCreate resource(s) according to current request- Parameters:
resolver- the resourceResolver to usereqProperties- required propertiesresponse- the responsechanges- the changes to applyversioningConfiguration- 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.SlingHttpServletRequest request, PostResponse response)
Collects the properties that form the content to be written back to the resource tree.- Parameters:
request- the requestresponse- 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.PersistenceExceptionDeep 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 usepath- path to resources that needs to be deep-createdreqProperties- the properties to addchanges- the changes to applyversioningConfiguration- the versioning configuration- Returns:
- Resource at path
- Throws:
org.apache.sling.api.resource.PersistenceException- if an error occursIllegalArgumentException- if the path is relative and parent isnull
-
-