aem-plugin / com.cognifide.gradle.aem.common.instance.service.repository / Node

Node

class Node : Serializable

Represents node stored in JCR content repository.

Types

Property

enum class Property

Constructors

<init>

Represents node stored in JCR content repository.

Node(repository: Repository, path: String)

Properties

children

Get all node child nodes.

val children: List<Node>

exists

Check if node exists.

val exists: Boolean

json

val json: String

name

Node name

val name: String

parent

Parent node.

val parent: Node

path

val path: String

properties

JCR node properties.

val properties: Properties

repository

val repository: Repository

type

JCR primary type of node.

val type: String

Functions

children

Loop over all node child nodes.

fun children(): Sequence<Node>

copy

Copy node to from source path to destination path.

fun copy(targetPath: String): Unit

copyFrom

Copy node from other path to current path.

fun copyFrom(sourcePath: String): Unit

copyTo

Copy node to path pointing to folder with preserving original node name.

fun copyTo(targetDir: String): Unit

delete

Delete node and all children from repository.

fun delete(): RepositoryResult

deleteProperties

Delete multiple properties from node.

fun deleteProperties(vararg names: String): RepositoryResult
fun deleteProperties(names: Iterable<String>): RepositoryResult

deleteProperty

Delete single property from node.

fun deleteProperty(name: String): RepositoryResult

download

Download node as CRX package.

fun download(options: PackageDefinition.() -> Unit = {}): File

exists

Check if node exists.

fun exists(recheck: Boolean = false): Boolean

hasProperties

Check if node has properties.

fun hasProperties(vararg names: String): Boolean
fun hasProperties(names: Iterable<String>): Boolean

hasProperty

Check if node has property.

fun hasProperty(name: String): Boolean

reload

Synchronize on demand previously loaded properties of node (by default properties are loaded lazily). Useful when saving and working on same node again (without instantiating separate variable).

fun reload(): Unit

replace

Delete node and creates it again. Use with caution!

fun replace(properties: Map<String, Any?>): RepositoryResult

save

Create or update node in repository.

fun save(properties: Map<String, Any?>): RepositoryResult

saveProperty

Update only single property of node.

fun saveProperty(name: String, value: Any?): RepositoryResult

toString

fun toString(): String

traverse

Search nodes by traversing a node tree. Use sequence filter method to find desired nodes.

fun traverse(self: Boolean = false): Sequence<Node>

Companion Object Properties

TYPE_UNSTRUCTURED

val TYPE_UNSTRUCTURED: Pair<String, String>