org.modeshape.jcr

## Class JcrSession.JcrPreSave

- java.lang.Object
- - org.modeshape.jcr.JcrSession.JcrPreSave

- All Implemented Interfaces:
    SessionCache.PreSave
  Enclosing class:
    JcrSession

      protected final class JcrSession.JcrPreSave
      extends Object
      implements SessionCache.PreSave

  Define the operations that are to be performed on all the nodes that were created or modified within this session. This class was designed to be as efficient as possible for most nodes, since most nodes do not need any additional processing.

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `JcrSession.JcrPreSave(SystemContent content, Map<NodeKey,NodeKey> baseVersionKeys, Map<NodeKey,NodeKey> originalVersionKeys, long aclChangesCount)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `process(MutableCachedNode node, SessionCache.SaveContext context)` Process the supplied node prior to saving the changes.
    `void` | `processAfterLocking(MutableCachedNode modifiedNode, SessionCache.SaveContext context, NodeCache persistentNodeCache)` Process the supplied existing node prior to saving the changes but only after the entry corresponding to the key of the node has been locked in Infinispan.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### JcrSession.JcrPreSave

          protected JcrSession.JcrPreSave(SystemContent content,
                               Map<NodeKey,NodeKey> baseVersionKeys,
                               Map<NodeKey,NodeKey> originalVersionKeys,
                               long aclChangesCount)

  - ### Method Detail

    - #### process

          public void process(MutableCachedNode node,
                     SessionCache.SaveContext context)
                       throws Exception

      Description copied from interface: `SessionCache.PreSave`
      Process the supplied node prior to saving the changes. This allows implementations to use the changes to automatically adjust this node or other content.
      Specified by:
        `process` in interface `SessionCache.PreSave`
      Parameters:
        `node` - the mutable node that was changed in this session; never null
        `context` - the context of the save operation; never null
      Throws:
        `Exception` - if there is a problem during the processing

    - #### processAfterLocking

          public void processAfterLocking(MutableCachedNode modifiedNode,
                                 SessionCache.SaveContext context,
                                 NodeCache persistentNodeCache)
                                   throws RepositoryException

      Description copied from interface: `SessionCache.PreSave`
      Process the supplied existing node prior to saving the changes but only after the entry corresponding to the key of the node has been locked in Infinispan. Note that locking in Infinispan does not occur always, but only if the `LockingMode.PESSIMISTIC` flag is enabled. This method should be implemented as optimal as possible and should only be needed in multi-threaded scenarios where concurrent modifications may break consistency.
      Specified by:
        `processAfterLocking` in interface `SessionCache.PreSave`
      Parameters:
        `modifiedNode` - the mutable node that was changed in this session; never null
        `context` - the context of the save operation; never null
        `persistentNodeCache` - the node cache from which the persistent representation of the nodes can be obtained; never null
      Throws:
        `RepositoryException`

Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.