@ConsumerType public abstract class OnDeployScriptBase extends Object implements OnDeployScript
| Modifier and Type | Field and Description |
|---|---|
protected org.slf4j.Logger |
logger |
| Constructor and Description |
|---|
OnDeployScriptBase() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
execute()
Execute the script.
|
void |
execute(org.apache.sling.api.resource.ResourceResolver resourceResolver)
Execute the script, passing in a resourceResolver instance.
|
protected javax.jcr.Node |
getOrCreateNode(String absolutePath)
Retrieve a node, or create it if not present.
|
protected javax.jcr.Node |
getOrCreateNode(String absolutePath,
String nodeType)
Retrieve a node, or create it if not present.
|
protected javax.jcr.Node |
getOrCreateNode(String absolutePath,
String intermediateNodeType,
String nodeType)
Retrieve a node, or create it if not present.
|
protected com.day.cq.wcm.api.PageManager |
getPageManager() |
protected org.apache.sling.api.resource.ResourceResolver |
getResourceResolver() |
protected javax.jcr.Session |
getSession() |
protected javax.jcr.Workspace |
getWorkspace() |
protected void |
removeResource(String path)
Remove node at a given path.
|
protected void |
renameProperty(javax.jcr.Node node,
String oldPropertyName,
String newPropertyName)
Rename a property on a node.
|
protected void |
renameProperty(org.apache.sling.api.resource.Resource resource,
String oldPropertyName,
String newPropertyName)
Rename a property on a resource.
|
protected void |
searchAndUpdateResourceType(String oldResourceType,
String newResourceType)
Searches for the current sling:resourceType under /content and replaces any nodes it finds
with the newResourceType.
|
protected void |
updateResourceType(javax.jcr.Node node,
String resourceType)
Update the sling:resourceType of a node.
|
public final void execute(org.apache.sling.api.resource.ResourceResolver resourceResolver)
OnDeployScriptexecute in interface OnDeployScriptresourceResolver - Resource resolver.OnDeployScript.execute(ResourceResolver)protected abstract void execute()
throws Exception
Exceptionprotected final javax.jcr.Node getOrCreateNode(String absolutePath) throws javax.jcr.RepositoryException
absolutePath - Path to fetch or create.javax.jcr.RepositoryExceptionprotected final javax.jcr.Node getOrCreateNode(String absolutePath, String nodeType) throws javax.jcr.RepositoryException
absolutePath - Path to fetch or create.nodeType - The type of node to create.javax.jcr.RepositoryExceptionprotected final javax.jcr.Node getOrCreateNode(String absolutePath, String intermediateNodeType, String nodeType) throws javax.jcr.RepositoryException
absolutePath - Path to fetch or create.intermediateNodeType - The type of intermediate nodes to create.nodeType - The type of node to create.javax.jcr.RepositoryExceptionprotected final void renameProperty(javax.jcr.Node node,
String oldPropertyName,
String newPropertyName)
throws javax.jcr.RepositoryException
node - Node to update the property name on.oldPropertyName - Old property name.newPropertyName - New property name.javax.jcr.RepositoryExceptionprotected final void renameProperty(org.apache.sling.api.resource.Resource resource,
String oldPropertyName,
String newPropertyName)
resource - Resource to update the property name on.oldPropertyName - Old property name.newPropertyName - New property name.protected final void removeResource(String path) throws javax.jcr.RepositoryException
path - Path to the node to remove.javax.jcr.RepositoryExceptionprotected final void searchAndUpdateResourceType(String oldResourceType, String newResourceType) throws javax.jcr.RepositoryException
oldResourceType - The current sling:resourceType.newResourceType - The new sling:resourceType to be used.javax.jcr.RepositoryExceptionprotected final void updateResourceType(javax.jcr.Node node,
String resourceType)
throws javax.jcr.RepositoryException
node - The node to update.resourceType - The new sling:resourceType to be used.javax.jcr.RepositoryExceptionprotected final org.apache.sling.api.resource.ResourceResolver getResourceResolver()
protected final com.day.cq.wcm.api.PageManager getPageManager()
protected final javax.jcr.Session getSession()
protected final javax.jcr.Workspace getWorkspace()
Copyright © 2013–2020 Adobe. All rights reserved.