org.apache.jackrabbit.core.util
Class ReferenceChangeTracker

java.lang.Object
  extended by org.apache.jackrabbit.core.util.ReferenceChangeTracker

public class ReferenceChangeTracker
extends Object

Simple helper class that can be used to keep track of node id mappings (e.g. if the id of an imported or copied node is mapped to a new id) and processed (e.g. imported or copied) reference properties that might need correcting depending on the id mappings.


Constructor Summary
ReferenceChangeTracker()
           
 
Method Summary
 void clear()
          Resets all internal state.
 NodeId getMappedId(NodeId oldId)
          Returns the new node id to which oldId has been mapped or null if no such mapping exists.
 Iterator<Object> getProcessedReferences()
          Returns an iterator over all processed reference properties.
 void mappedId(NodeId oldId, NodeId newId)
          Store the given id mapping for later lookup using getMappedId(NodeId).
 void processedReference(Object refProp)
          Store the given reference property for later retrieval using getProcessedReferences().
 boolean removeReferences(List<Object> processedReferences)
          Remove the given references that have already been processed from the references list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReferenceChangeTracker

public ReferenceChangeTracker()
Method Detail

clear

public void clear()
Resets all internal state.


mappedId

public void mappedId(NodeId oldId,
                     NodeId newId)
Store the given id mapping for later lookup using getMappedId(NodeId).

Parameters:
oldId - old node id
newId - new node id

processedReference

public void processedReference(Object refProp)
Store the given reference property for later retrieval using getProcessedReferences().

Parameters:
refProp - reference property

getMappedId

public NodeId getMappedId(NodeId oldId)
Returns the new node id to which oldId has been mapped or null if no such mapping exists.

Parameters:
oldId - old node id
Returns:
mapped new id or null if no such mapping exists
See Also:
mappedId(NodeId, NodeId)

getProcessedReferences

public Iterator<Object> getProcessedReferences()
Returns an iterator over all processed reference properties.

Returns:
an iterator over all processed reference properties
See Also:
processedReference(Object)

removeReferences

public boolean removeReferences(List<Object> processedReferences)
Remove the given references that have already been processed from the references list.

Parameters:
processedReferences -
Returns:
true if the internal list of references changed.


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