Nuxeo Enterprise Platform 5.4

org.nuxeo.ecm.core.storage.sql
Class HierarchyContext

java.lang.Object
  extended by org.nuxeo.ecm.core.storage.sql.HierarchyContext

public class HierarchyContext
extends java.lang.Object

This class holds cached information for children relationships in the hierarchy table.


Field Summary
 java.util.Map<java.io.Serializable,Children> childrenRegularHard
           
 
Constructor Summary
HierarchyContext(Model model, RowMapper mapper, SessionImpl session, PersistenceContext context)
           
 
Method Summary
 java.io.Serializable checkIn(Node node, java.lang.String label, java.lang.String checkinComment)
          Checks in a node (creates a version).
 void checkOut(Node node)
          Checks out a node.
 int clearCaches()
           
 java.io.Serializable copy(Node source, java.io.Serializable parentId, java.lang.String name)
          Copy a child to a new parent with a new name.
 void createdSimpleFragment(SimpleFragment fragment)
           
 void gatherInvalidations(Invalidations invalidations)
          Gathers invalidations from this session.
 SimpleFragment getChildHierByName(java.io.Serializable parentId, java.lang.String name, boolean complexProp)
          Find a fragment in the hierarchy schema given its parent id and name.
 java.util.List<SimpleFragment> getChildren(java.io.Serializable parentId, java.lang.String name, boolean complexProp)
          Gets the list of children main fragments for a given parent id.
 java.io.Serializable getContainingDocument(java.io.Serializable id)
          Finds the id of the enclosing non-complex-property node.
 SimpleFragment getHier(java.io.Serializable id, boolean allowAbsent)
           
 SimpleFragment getHierIfPresent(java.io.Serializable id)
           
 java.lang.Long getNextPos(java.io.Serializable nodeId, boolean complexProp)
          Gets the next pos value for a new child in a folder.
 boolean isDeleted(java.io.Serializable id)
          Recursively checks if any of a fragment's parents has been deleted.
 void markInvalidated(java.util.Set<RowId> modified)
          Marks locally all the invalidations gathered by a Mapper operation (like a version restore).
 void move(Node source, java.io.Serializable parentId, java.lang.String name)
          Move a child to a new parent with a new name.
 void orderBefore(java.io.Serializable parentId, java.io.Serializable sourceId, java.io.Serializable destId)
          Order a child before another.
 void postSave()
           
 void processReceivedInvalidations(java.util.Set<RowId> modified)
          Processes all invalidations accumulated.
 void recordFragment(Fragment fragment)
           
 void removeFragment(Fragment fragment)
          Deletes a fragment from the context.
 void removeNode(Fragment hierFragment)
           
 void restoreVersion(Node node, Node version)
          Restores a node to a given version.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

childrenRegularHard

public final java.util.Map<java.io.Serializable,Children> childrenRegularHard
Constructor Detail

HierarchyContext

public HierarchyContext(Model model,
                        RowMapper mapper,
                        SessionImpl session,
                        PersistenceContext context)
Method Detail

clearCaches

public int clearCaches()

createdSimpleFragment

public void createdSimpleFragment(SimpleFragment fragment)
                           throws StorageException
Throws:
StorageException

getChildHierByName

public SimpleFragment getChildHierByName(java.io.Serializable parentId,
                                         java.lang.String name,
                                         boolean complexProp)
                                  throws StorageException
Find a fragment in the hierarchy schema given its parent id and name. If the fragment is not in the context, fetch it from the mapper.

Parameters:
parentId - the parent id
name - the name
complexProp - whether to get complex properties or regular children
Returns:
the fragment, or null if not found
Throws:
StorageException

getChildren

public java.util.List<SimpleFragment> getChildren(java.io.Serializable parentId,
                                                  java.lang.String name,
                                                  boolean complexProp)
                                           throws StorageException
Gets the list of children main fragments for a given parent id.

Complex properties and children of ordered folders are returned in the proper order.

Parameters:
parentId - the parent id
name - the name of the children, or null for all
complexProp - whether to get complex properties or regular children
Returns:
the list of children main fragments
Throws:
StorageException

getContainingDocument

public java.io.Serializable getContainingDocument(java.io.Serializable id)
                                           throws StorageException
Finds the id of the enclosing non-complex-property node.

Parameters:
id - the id
Returns:
the id of the containing document, or null if there is no parent or the parent has been deleted.
Throws:
StorageException

orderBefore

public void orderBefore(java.io.Serializable parentId,
                        java.io.Serializable sourceId,
                        java.io.Serializable destId)
                 throws StorageException
Order a child before another.

Parameters:
parentId - the parent id
sourceId - the node id to move
destId - the node id before which to place the source node, if null then move the source to the end
Throws:
StorageException

getNextPos

public java.lang.Long getNextPos(java.io.Serializable nodeId,
                                 boolean complexProp)
                          throws StorageException
Gets the next pos value for a new child in a folder.

Parameters:
nodeId - the folder node id
complexProp - whether to deal with complex properties or regular children
Returns:
the next pos, or null if not orderable
Throws:
StorageException

move

public void move(Node source,
                 java.io.Serializable parentId,
                 java.lang.String name)
          throws StorageException
Move a child to a new parent with a new name.

Parameters:
source - the source
parentId - the destination parent id
name - the new name
Throws:
StorageException

copy

public java.io.Serializable copy(Node source,
                                 java.io.Serializable parentId,
                                 java.lang.String name)
                          throws StorageException
Copy a child to a new parent with a new name.

Parameters:
source - the source of the copy
parentId - the destination parent id
name - the new name
Returns:
the id of the copy
Throws:
StorageException

removeNode

public void removeNode(Fragment hierFragment)
                throws StorageException
Throws:
StorageException

removeFragment

public void removeFragment(Fragment fragment)
                    throws StorageException
Deletes a fragment from the context.

Throws:
StorageException

postSave

public void postSave()

getHierIfPresent

public SimpleFragment getHierIfPresent(java.io.Serializable id)

getHier

public SimpleFragment getHier(java.io.Serializable id,
                              boolean allowAbsent)
                       throws StorageException
Throws:
StorageException

recordFragment

public void recordFragment(Fragment fragment)
                    throws StorageException
Throws:
StorageException

isDeleted

public boolean isDeleted(java.io.Serializable id)
                  throws StorageException
Recursively checks if any of a fragment's parents has been deleted.

Throws:
StorageException

checkIn

public java.io.Serializable checkIn(Node node,
                                    java.lang.String label,
                                    java.lang.String checkinComment)
                             throws StorageException
Checks in a node (creates a version).

Parameters:
node - the node to check in
label - the version label
checkinComment - the version description
Returns:
the created version id
Throws:
StorageException

checkOut

public void checkOut(Node node)
              throws StorageException
Checks out a node.

Parameters:
node - the node to check out
Throws:
StorageException

restoreVersion

public void restoreVersion(Node node,
                           Node version)
                    throws StorageException
Restores a node to a given version.

The restored node is checked in.

Parameters:
node - the node
version - the version to restore on this node
Throws:
StorageException

markInvalidated

public void markInvalidated(java.util.Set<RowId> modified)
Marks locally all the invalidations gathered by a Mapper operation (like a version restore).


gatherInvalidations

public void gatherInvalidations(Invalidations invalidations)
Gathers invalidations from this session.

Called post-transaction to gathers invalidations to be sent to others.


processReceivedInvalidations

public void processReceivedInvalidations(java.util.Set<RowId> modified)
                                  throws StorageException
Processes all invalidations accumulated.

Called pre-transaction.

Throws:
StorageException

Nuxeo Enterprise Platform 5.4

Copyright © 2010 Nuxeo SAS. All Rights Reserved.