info.magnolia.nodebuilder
Class Ops

java.lang.Object
  extended by info.magnolia.nodebuilder.Ops

public abstract class Ops
extends Object

Factory methods for most common NodeOperation implementations.

Version:
$Revision: $ ($Author: $)
Author:
gjoseph

Constructor Summary
Ops()
           
 
Method Summary
static NodeOperation addNode(String name)
           
static NodeOperation addNode(String name, ItemType type)
           
static NodeOperation addNode(String name, String type)
           
static NodeOperation addProperty(String name, Object value)
          Adds a currently non-existing property.
static NodeOperation copyNode(String nodeName, String dest)
          Copies a node, using session-scoped operation.
static NodeOperation getNode(String name)
           
static NodeOperation moveNode(String nodeName, String dest)
          Moves a node, using session-scoped operation.
static NodeOperation noop()
          No operation; can be useful in ternary expression, for instance.
static NodeOperation onChildNodes(Content.ContentFilter filter, NodeOperation... childrenOps)
          Executes the operation for each child node matching the filter.
static NodeOperation onChildNodes(ItemType type, NodeOperation... childrenOps)
          Executes the operation for each child node of a certain type.
static NodeOperation onChildNodes(NodeOperation... childrenOps)
          Executes the operation for each child node excluding meta data and jcr base node.
static NodeOperation onChildNodes(String type, NodeOperation... childrenOps)
          Executes the operation for each child node of a certain type.
static NodeOperation remove(String name)
          Can remove either a node or property.
static NodeOperation renameNode(String currentName, String newName)
          Renames a node.
static NodeOperation renameProperty(String name, String newName)
          Renames a property by creating a new one and copying the value.
static NodeOperation setProperty(String name, Object newValue)
          Sets the value of an existing property, ignoring its current value.
static NodeOperation setProperty(String name, Object expectedCurrentValue, Object newValue)
          Sets the value of an existing property, only if the actual current value matches the given expected current value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Ops

public Ops()
Method Detail

addNode

public static NodeOperation addNode(String name)

addNode

public static NodeOperation addNode(String name,
                                    String type)

addNode

public static NodeOperation addNode(String name,
                                    ItemType type)

getNode

public static NodeOperation getNode(String name)

remove

public static NodeOperation remove(String name)
Can remove either a node or property.


addProperty

public static NodeOperation addProperty(String name,
                                        Object value)
Adds a currently non-existing property. Throws an ItemExistsException if the property already exists.


setProperty

public static NodeOperation setProperty(String name,
                                        Object newValue)
Sets the value of an existing property, ignoring its current value.

Throws:
javax.jcr.ItemNotFoundException - if the property does not exist.

setProperty

public static NodeOperation setProperty(String name,
                                        Object expectedCurrentValue,
                                        Object newValue)
Sets the value of an existing property, only if the actual current value matches the given expected current value.

Throws:
javax.jcr.ItemNotFoundException - if the property does not exist.
javax.jcr.RepositoryException - if the current value does not match the expected one.

renameNode

public static NodeOperation renameNode(String currentName,
                                       String newName)
Renames a node.


renameProperty

public static NodeOperation renameProperty(String name,
                                           String newName)
Renames a property by creating a new one and copying the value.


moveNode

public static NodeOperation moveNode(String nodeName,
                                     String dest)
Moves a node, using session-scoped operation.


copyNode

public static NodeOperation copyNode(String nodeName,
                                     String dest)
Copies a node, using session-scoped operation.


onChildNodes

public static NodeOperation onChildNodes(NodeOperation... childrenOps)
Executes the operation for each child node excluding meta data and jcr base node.


onChildNodes

public static NodeOperation onChildNodes(String type,
                                         NodeOperation... childrenOps)
Executes the operation for each child node of a certain type.


onChildNodes

public static NodeOperation onChildNodes(ItemType type,
                                         NodeOperation... childrenOps)
Executes the operation for each child node of a certain type.


onChildNodes

public static NodeOperation onChildNodes(Content.ContentFilter filter,
                                         NodeOperation... childrenOps)
Executes the operation for each child node matching the filter.


noop

public static NodeOperation noop()
No operation; can be useful in ternary expression, for instance.



Copyright © 2003-2014 Magnolia International Ltd.. All Rights Reserved.