org.apache.jackrabbit.jcr2spi.hierarchy
Interface ChildNodeEntries


public interface ChildNodeEntries

ChildNodeEntries represents a collection of NodeEntrys that also maintains the index values of same-name siblings on insertion and removal.


Field Summary
static int STATUS_INVALIDATED
           
static int STATUS_OK
           
 
Method Summary
 void add(NodeEntry cne)
          Adds a NodeEntry to the end of the list.
 void add(NodeEntry cne, int index)
          Adds a NodeEntry.
Note the following special cases: If an entry with the given index already exists, the the new sibling is inserted before. If the given index is bigger that the last entry in the siblings list, intermediate entries will be created.
 void add(NodeEntry entry, NodeEntry beforeEntry)
          Adds a the new NodeEntry before beforeEntry.
 NodeEntry get(ChildInfo childInfo)
          Find the matching NodeEntry for the given ChildInfo.
 List get(Name nodeName)
          Returns a List of NodeEntrys for the given nodeName.
 NodeEntry get(Name nodeName, int index)
          Returns the NodeEntry with the given nodeName and index.
 NodeEntry get(Name nodeName, String uniqueID)
          Return the NodeEntry that matches the given nodeName and uniqueID or null if no matching entry can be found.
 int getStatus()
          Returns the status of this ChildNodeEntries object.
 Iterator iterator()
          Returns an unmodifiable iterator over all NodeEntry objects present in this ChildNodeEntries collection irrespective of their status.
 void reload()
          Reloads this ChildNodeEntries object.
 NodeEntry remove(NodeEntry childEntry)
          Removes the child node entry refering to the node state.
 NodeEntry reorder(NodeEntry insertEntry, NodeEntry beforeEntry)
          Reorders an existing NodeEntry before another NodeEntry.
 void setStatus(int status)
          Mark ChildNodeEntries in order to force reloading the entries.
 

Field Detail

STATUS_OK

static final int STATUS_OK
See Also:
Constant Field Values

STATUS_INVALIDATED

static final int STATUS_INVALIDATED
See Also:
Constant Field Values
Method Detail

getStatus

int getStatus()
Returns the status of this ChildNodeEntries object.

Returns:
STATUS_OK or STATUS_INVALIDATED

setStatus

void setStatus(int status)
Mark ChildNodeEntries in order to force reloading the entries.

Parameters:
status -

reload

void reload()
            throws ItemNotFoundException,
                   RepositoryException
Reloads this ChildNodeEntries object.

Throws:
ItemNotFoundException
RepositoryException

iterator

Iterator iterator()
Returns an unmodifiable iterator over all NodeEntry objects present in this ChildNodeEntries collection irrespective of their status.

Returns:
Iterator over all NodeEntry object

get

List get(Name nodeName)
Returns a List of NodeEntrys for the given nodeName. This method does not filter out removed NodeEntrys.

Parameters:
nodeName - the child node name.
Returns:
same name sibling nodes with the given nodeName.

get

NodeEntry get(Name nodeName,
              int index)
Returns the NodeEntry with the given nodeName and index. Note, that this method does not filter out removed NodeEntrys.

Parameters:
nodeName - name of the child node entry.
index - the index of the child node entry.
Returns:
the NodeEntry or null if there is no such NodeEntry.

get

NodeEntry get(Name nodeName,
              String uniqueID)
Return the NodeEntry that matches the given nodeName and uniqueID or null if no matching entry can be found.

Parameters:
nodeName -
uniqueID -
Returns:
Throws:
IllegalArgumentException - if the given uniqueID is null.

get

NodeEntry get(ChildInfo childInfo)
Find the matching NodeEntry for the given ChildInfo. Returns null if no matching entry can be found. NOTE, that no check for validity of the entries is made.

Parameters:
childInfo -
Returns:

add

void add(NodeEntry cne)
Adds a NodeEntry to the end of the list. Same as add(NodeEntry, int), where the index is Path.INDEX_UNDEFINED.

Parameters:
cne - the NodeEntry to add.

add

void add(NodeEntry cne,
         int index)
Adds a NodeEntry.
Note the following special cases:
  1. If an entry with the given index already exists, the the new sibling is inserted before.
  2. If the given index is bigger that the last entry in the siblings list, intermediate entries will be created.

Parameters:
cne - the NodeEntry to add.

add

void add(NodeEntry entry,
         NodeEntry beforeEntry)
Adds a the new NodeEntry before beforeEntry.

Parameters:
entry -
beforeEntry -

remove

NodeEntry remove(NodeEntry childEntry)
Removes the child node entry refering to the node state.

Parameters:
childEntry - the entry to be removed.
Returns:
the removed entry or null if there is no such entry.

reorder

NodeEntry reorder(NodeEntry insertEntry,
                  NodeEntry beforeEntry)
Reorders an existing NodeEntry before another NodeEntry. If beforeEntry is null insertEntry is moved to the end of the child node entries.

Parameters:
insertEntry - the NodeEntry to move.
beforeEntry - the NodeEntry where insertEntry is reordered to.
Returns:
the NodeEntry that followed the 'insertEntry' before the reordering.
Throws:
NoSuchElementException - if insertEntry or beforeEntry does not have a NodeEntry in this ChildNodeEntries.


Copyright © 2004-2008 The Apache Software Foundation. All Rights Reserved.