Class 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 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.