-
- All Implemented Interfaces:
-
java.io.Serializable
public final class Node implements Serializable
Represents a node stored in JCR content repository.
-
-
Field Summary
Fields Modifier and Type Field Description private final Stringnameprivate final StringbaseNameprivate final Stringextensionprivate final Propertiespropertiesprivate final Stringtypeprivate final Nodeparentprivate final Booleanrootprivate final List<Node>parentsprivate final List<Node>childrenprivate final List<Node>siblingsprivate final Booleanexistsprivate final Stringjsonprivate final Repositoryrepositoryprivate final Stringpath
-
Method Summary
Modifier and Type Method Description final Sequence<Node>parents()Get all parent nodes. final Nodechild(String name)Get child node by name. final BooleanhasChild(String name)Check if child node exists. final Sequence<Node>children()Loop over all node child nodes. final Sequence<Node>descendants()final Sequence<Node>siblings()final Nodesibling(String name)final Booleanexists(Boolean recheck)Check if node exists. final RepositoryResultsave(Map<String, Any> properties)Create or update node in repository. final RepositoryResultimport(Map<String, Any> properties, String name, Boolean replace, Boolean replaceProperties)Import node into repository. final RepositoryResultimport(File file, String name, Boolean replace, Boolean replaceProperties)Import content structure defined in JSON file into repository. final RepositoryResultdelete()Delete node and all children from repository. final RepositoryResultreplace(Map<String, Any> properties)Delete node and creates it again. final Unitreload()Synchronize on demand previously loaded properties of node (by default properties are loaded lazily). final Nodecopy(String targetPath)Copy node to from source path to destination path. final Nodemove(String targetPath, Boolean replace)Move node from source path to destination path. final Noderename(String newName, Boolean replace)Change node name (effectively moves node). final NodecopyTo(String targetDir)Copy node to path pointing to folder with preserving original node name. final NodecopyFrom(String sourcePath)Copy node from other path to current path. final Sequence<Node>traverse(Boolean self)Search nodes by traversing a node tree. final Sequence<Node>query(Function1<QueryCriteria, Unit> criteria)Search nodes by querying repository under node path. final Sequence<Node>query(QueryCriteria criteria)Search nodes by querying repository under node path. final RepositoryResultsaveProperty(String name, Object value)Update only single property of node. final RepositoryResultdeleteProperty(String name)Delete single property from node. final RepositoryResultdeleteProperties(Array<Out String> names)Delete multiple properties from node. final RepositoryResultdeleteProperties(Iterable<String> names)Delete multiple properties from node. final BooleanhasProperty(String name)Check if node has property. final BooleanhasProperties(Array<Out String> names)Check if node has properties. final BooleanhasProperties(Iterable<String> names)Check if node has properties. final Unitupload(File file)Upload file to node. final UnituploadFile(File file)Upload asset using default Sling endpoint. final UnituploadDamAsset(File file)Upload asset using dedicated DAM endpoint. final NodeuploadTo(File file)Upload file to current folder node with preserving original file name. final <T extends Any> Tread(Function1<InputStream, T> reader)Read file stored in node. final Unitdownload(String targetFilePath)Download file stored in node to specified local file. final Unitdownload(File targetFile)Download file stored in node to specified local file. final Filedownload()Download file stored in node to temporary directory with preserving file name. final FiledownloadTo(String targetDirPath)Download file stored in node to specified local directory with preserving file name. final FiledownloadTo(File targetDir)Download file stored in node to specified local directory with preserving file name. final FiledownloadPackage(Function1<PackageDefinition, Unit> options)Download node as CRX package. Booleanequals(Object other)IntegerhashCode()StringtoString()final StringgetName()final StringgetBaseName()final StringgetExtension()final PropertiesgetProperties()final StringgetType()final NodegetParent()final BooleangetRoot()final List<Node>getParents()final List<Node>getChildren()final List<Node>getSiblings()final BooleangetExists()final StringgetJson()final RepositorygetRepository()final StringgetPath()-
-
Constructor Detail
-
Node
Node(Repository repository, String path, Map<String, Any> props)
-
-
Method Detail
-
descendants
final Sequence<Node> descendants()
-
save
final RepositoryResult save(Map<String, Any> properties)
Create or update node in repository.
-
import
final RepositoryResult import(Map<String, Any> properties, String name, Boolean replace, Boolean replaceProperties)
Import node into repository.
-
import
final RepositoryResult import(File file, String name, Boolean replace, Boolean replaceProperties)
Import content structure defined in JSON file into repository.
-
delete
final RepositoryResult delete()
Delete node and all children from repository.
-
replace
final RepositoryResult replace(Map<String, Any> properties)
Delete node and creates it again.
-
reload
final Unit reload()
Synchronize on demand previously loaded properties of node (by default properties are loaded lazily).
-
move
final Node move(String targetPath, Boolean replace)
Move node from source path to destination path.
-
rename
final Node rename(String newName, Boolean replace)
Change node name (effectively moves node).
-
copyTo
final Node copyTo(String targetDir)
Copy node to path pointing to folder with preserving original node name.
-
query
final Sequence<Node> query(Function1<QueryCriteria, Unit> criteria)
Search nodes by querying repository under node path.
-
query
final Sequence<Node> query(QueryCriteria criteria)
Search nodes by querying repository under node path.
-
saveProperty
final RepositoryResult saveProperty(String name, Object value)
Update only single property of node.
-
deleteProperty
final RepositoryResult deleteProperty(String name)
Delete single property from node.
-
deleteProperties
final RepositoryResult deleteProperties(Array<Out String> names)
Delete multiple properties from node.
-
deleteProperties
final RepositoryResult deleteProperties(Iterable<String> names)
Delete multiple properties from node.
-
hasProperty
final Boolean hasProperty(String name)
Check if node has property.
-
hasProperties
final Boolean hasProperties(Array<Out String> names)
Check if node has properties.
-
hasProperties
final Boolean hasProperties(Iterable<String> names)
Check if node has properties.
-
uploadFile
final Unit uploadFile(File file)
Upload asset using default Sling endpoint.
-
uploadDamAsset
final Unit uploadDamAsset(File file)
Upload asset using dedicated DAM endpoint.
-
uploadTo
final Node uploadTo(File file)
Upload file to current folder node with preserving original file name.
-
download
final Unit download(String targetFilePath)
Download file stored in node to specified local file.
-
download
final File download()
Download file stored in node to temporary directory with preserving file name.
-
downloadTo
final File downloadTo(String targetDirPath)
Download file stored in node to specified local directory with preserving file name.
-
downloadTo
final File downloadTo(File targetDir)
Download file stored in node to specified local directory with preserving file name.
-
downloadPackage
final File downloadPackage(Function1<PackageDefinition, Unit> options)
Download node as CRX package.
-
getBaseName
final String getBaseName()
-
getExtension
final String getExtension()
-
getProperties
final Properties getProperties()
-
getParents
final List<Node> getParents()
-
getChildren
final List<Node> getChildren()
-
getSiblings
final List<Node> getSiblings()
-
getRepository
final Repository getRepository()
-
-
-
-