public class Node
Represents node stored in JCR content repository.
| Modifier and Type | Class and Description |
|---|---|
static class |
Node.Companion |
| Modifier and Type | Field and Description |
|---|---|
static Node.Companion |
Companion |
| Constructor and Description |
|---|
Node(Repository repository,
java.lang.String path)
Represents node stored in JCR content repository.
|
| Modifier and Type | Method and Description |
|---|---|
kotlin.sequences.Sequence<com.cognifide.gradle.aem.common.instance.service.repository.Node> |
children()
Loop over all node child nodes.
|
void |
copy(java.lang.String targetPath)
Copy node to from source path to destination path.
|
void |
copyFrom(java.lang.String sourcePath)
Copy node from other path to current path.
|
void |
copyTo(java.lang.String targetDir)
Copy node to path pointing to folder with preserving original node name.
|
RepositoryResult |
delete()
Delete node and all children from repository.
|
RepositoryResult |
deleteProperties(java.lang.String... names)
Delete multiple properties from node.
|
RepositoryResult |
deleteProperties(java.lang.Iterable<java.lang.String> names)
Delete multiple properties from node.
|
RepositoryResult |
deleteProperty(java.lang.String name)
Delete single property from node.
|
boolean |
exists(boolean recheck)
Check if node exists.
|
java.util.List<com.cognifide.gradle.aem.common.instance.service.repository.Node> |
getChildren()
Get all node child nodes.
|
boolean |
getExists()
Check if node exists.
|
java.lang.String |
getJson() |
java.lang.String |
getName()
Node name
|
Node |
getParent()
Parent node.
|
java.lang.String |
getPath() |
Properties |
getProperties()
JCR node properties.
|
Repository |
getRepository() |
java.lang.String |
getType()
JCR primary type of node.
|
boolean |
hasProperties(java.lang.String... names)
Check if node has properties.
|
boolean |
hasProperties(java.lang.Iterable<java.lang.String> names)
Check if node has properties.
|
boolean |
hasProperty(java.lang.String name)
Check if node has property.
|
void |
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).
|
RepositoryResult |
replace(java.util.Map<java.lang.String,? extends java.lang.Object> properties)
Delete node and creates it again. Use with caution!
|
RepositoryResult |
save(java.util.Map<java.lang.String,? extends java.lang.Object> properties)
Create or update node in repository.
|
RepositoryResult |
saveProperty(java.lang.String name,
java.lang.Object value)
Update only single property of node.
|
java.lang.String |
toString() |
kotlin.sequences.Sequence<com.cognifide.gradle.aem.common.instance.service.repository.Node> |
traverse(boolean self)
Search nodes by traversing a node tree.
Use sequence filter method to find desired nodes.
|
public static Node.Companion Companion
public Node(@NotNull
Repository repository,
@NotNull
java.lang.String path)
Represents node stored in JCR content repository.
@NotNull public java.lang.String getName()
Node name
@NotNull public Properties getProperties()
JCR node properties.
Keep in mind that these values are loaded lazily and sometimes it is needed to reload them using dedicated method.
@NotNull public java.lang.String getType()
JCR primary type of node.
@NotNull public Node getParent()
Parent node.
@NotNull public java.util.List<com.cognifide.gradle.aem.common.instance.service.repository.Node> getChildren()
Get all node child nodes.
Because of performance issues, using method is more preferred.
@NotNull public kotlin.sequences.Sequence<com.cognifide.gradle.aem.common.instance.service.repository.Node> children()
Loop over all node child nodes.
public boolean getExists()
Check if node exists.
Not checks again if properties of node are already loaded (skips extra HTTP request / optimization).
public boolean exists(boolean recheck)
Check if node exists.
@NotNull public RepositoryResult save(@NotNull java.util.Map<java.lang.String,? extends java.lang.Object> properties)
Create or update node in repository.
@NotNull public RepositoryResult delete()
Delete node and all children from repository.
@NotNull public RepositoryResult replace(@NotNull java.util.Map<java.lang.String,? extends java.lang.Object> properties)
Delete node and creates it again. Use with caution!
public void 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).
public void copy(@NotNull
java.lang.String targetPath)
Copy node to from source path to destination path.
public void copyTo(@NotNull
java.lang.String targetDir)
Copy node to path pointing to folder with preserving original node name.
public void copyFrom(@NotNull
java.lang.String sourcePath)
Copy node from other path to current path.
@NotNull public kotlin.sequences.Sequence<com.cognifide.gradle.aem.common.instance.service.repository.Node> traverse(boolean self)
Search nodes by traversing a node tree. Use sequence filter method to find desired nodes.
@NotNull public RepositoryResult saveProperty(@NotNull java.lang.String name, @Nullable java.lang.Object value)
Update only single property of node.
@NotNull public RepositoryResult deleteProperty(@NotNull java.lang.String name)
Delete single property from node.
@NotNull public RepositoryResult deleteProperties(@NotNull java.lang.String... names)
Delete multiple properties from node.
@NotNull public RepositoryResult deleteProperties(@NotNull java.lang.Iterable<java.lang.String> names)
Delete multiple properties from node.
public boolean hasProperty(@NotNull
java.lang.String name)
Check if node has property.
public boolean hasProperties(@NotNull
java.lang.String... names)
Check if node has properties.
public boolean hasProperties(@NotNull
java.lang.Iterable<java.lang.String> names)
Check if node has properties.
@NotNull public java.lang.String getJson()
@NotNull public java.lang.String toString()
@NotNull public Repository getRepository()
@NotNull public java.lang.String getPath()