Interface PersistedCollectionMemberGraph

All Known Implementing Classes:
PersistedCollectionMemberGraphImpl

public interface PersistedCollectionMemberGraph
Graph representation of the collected members of a persisted collection. The roots of the graph are the seeds of the collection (i.e., the initially selected objects). The parent-child relationships represent the navigation path used to collect all members during the last refresh operation. The graph is guaranteed not to contain any cycles, but there may be several paths to any given member.

** IMPORTANT **
For very large graphs it is the caller's responsibility to properly manage performance and memory by inflating member references in chunks, rather than one-at-a-time or all-at-once, and deflating each chunk before inflating the next one. The depth-first navigation iterator provided by this class offers an inflate option to assist with memory management and performance.

Navigation methods:

1) To process a member graph using depth-first navigation:

PersistedCollectionMemberGraph memberGraph = PersistedCollectionHelper.service.getMemberGraph(...);
for (final DepthIterator iter = depthIterator(false, true); iter.hasNext();) {
invalid input: '&nbsp'invalid input: '&nbsp'invalid input: '&nbsp' final PersistedCollectionMemberNode memberNode = iter.next();
invalid input: '&nbsp'invalid input: '&nbsp'invalid input: '&nbsp'
invalid input: '&nbsp'invalid input: '&nbsp'invalid input: '&nbsp' // Custom processing code for member node here...
invalid input: '&nbsp'invalid input: '&nbsp'invalid input: '&nbsp' // Additional information available from methods: iter.getLocalLevel(), iter.getLocalRoles, iter.isRepeated()
invalid input: '&nbsp'invalid input: '&nbsp'invalid input: '&nbsp'
}

2) To process a member graph using breadth-first navigation:

PersistedCollectionMemberGraph memberGraph = PersistedCollectionHelper.service.getMemberGraph(...);
Mapinvalid input: '&ltInteger', Setinvalid input: '&ltPersistedCollectionMemberNode'invalid input: '&gt'invalid input: '&gt' levelToNodeMap = memberGraph.getMemberNodesByLevel();

invalid input: '&nbsp' // Process all member nodes on level 1, then all member nodes on level 2, etc.
for (int i = 1; i invalid input: '&lt'= levelToNodeMap.size(); i++) {
invalid input: '&nbsp'invalid input: '&nbsp'invalid input: '&nbsp' for (PersistedCollectionMemberNode memberNode : levelToNodeMap.get(i)) {
invalid input: '&nbsp'invalid input: '&nbsp'invalid input: '&nbsp'invalid input: '&nbsp'invalid input: '&nbsp'invalid input: '&nbsp'
invalid input: '&nbsp'invalid input: '&nbsp'invalid input: '&nbsp'invalid input: '&nbsp'invalid input: '&nbsp'invalid input: '&nbsp' // Custom processing code for a member node at level i here...
invalid input: '&nbsp'invalid input: '&nbsp'invalid input: '&nbsp'invalid input: '&nbsp'invalid input: '&nbsp'invalid input: '&nbsp' // This algorithm guarantees that all parent nodes of memberNode have already been processed.
invalid input: '&nbsp'invalid input: '&nbsp'invalid input: '&nbsp'invalid input: '&nbsp'invalid input: '&nbsp'invalid input: '&nbsp'
invalid input: '&nbsp'invalid input: '&nbsp'invalid input: '&nbsp' }
}



Supported API: true

Extendable: false

See Also:
  • invalid reference
    wt.facade.persistedcollection.PersistedCollectionMemberNode
  • invalid reference
    wt.facade.persistedcollection.PersistedCollectionService#getMemberGraph(wt.facade.persistedcollection.PersistedCollectableHolder, java.lang.String, java.util.Locale)
  • Method Details

    • size

      int size()
      Get member graph size.

      Supported API: true
      Returns:
      Number of nodes in member graph.
    • getMemberNode

      Get the graph node for a collected member.

      Supported API: true
      Parameters:
      memberRef - ObjectReference for a PersistedCollectable member object.
      Returns:
      PersistedCollectionMemberNode for the specified member reference, or null if the reference is not a member of the graph.
    • getMemberNode

      Get the graph node for a collection member.

      Supported API: true
      Parameters:
      member - PersistedCollectable member object.
      Returns:
      PersistedCollectionMemberNode for the specified member object, or null if the object is not a member of the graph.
    • getAllMemberNodes

      Get collection of all member nodes from the graph.

      Supported API: true
      Returns:
      Collection of all member graph Nodes.
    • getAllMembers

      WTSet getAllMembers()
      Get set of all members from the graph.

      Supported API: true
      Returns:
      Set of all members (non-null, may be empty).
    • clearAllVisited

      void clearAllVisited()
      Clear the visited state of all nodes in the member graph.

      Supported API: true
    • getSeedNodes

      Get member nodes corresponding to the seed objects. Depending on how the configuration specifications were set up for the collector, these objects may be the same as the actual seeds or may be different versions of the actual seeds.

      Supported API: true
      Returns:
      Set of Member graph nodes for the seed members.
    • getMemberNodesByLevel

      Get member nodes sorted by their maximum level in the graph. When navigating nodes by order of increasing level, it is guaranteed that all parents of a node will be visited before the node itself is reached.

      Supported API: true
      Returns:
      Map of maximum level to member nodes at that level (non-null, may be empty).
    • getHolder

      Get the holder for which this member graph was created.

      Supported API: true
      Returns:
      PersistedCollectableHolder object.
    • getDisplayAssistant

      AssociationDisplayAssistant getDisplayAssistant()
      Get the display assistant used for localizing relationship roles.

      Supported API: true
      Returns:
      AssociationDisplayAssistant object.
    • depthIterator

      PersistedCollectionMemberGraph.DepthIterator depthIterator(boolean inflate, boolean skipRepeated)
      Get depth-first graph iterator to PersistedCollectionMemberNode objects with optionally inflated member references. The remove() method may not be called for this iterator.

      Inflating and deflated member references are handled internally to the iterator when created with inflate=true. References are inflated and deflated in chunks to maintain a balance between performance and memory usage. Do not use two or more of these iterators with inflate=true simultaneously for the same member graph (i.e., may result in slow performance or excessive memory usage).

      Supported API: true

      Parameters:
      inflate - Set true to have the iterator inflate the member references of the nodes being returned by the next() method. Set false to have the iterator return member references in whatever state they are currently in, inflated or deflated.
      skipRepeated - True to skip repeated branches of the graph, false to iterate over the entire graph (included repeated branches). If true the iterator will return an entire repeated branch the first time it is encountered, but will only return the root node all subsequent times.
      Returns:
      Iterator to return member nodes using depth-first graph navigation.
      See Also: