Gosu methods for base data copy

Base data copy is implemented by the SideBySideBaseDataCopy method in gw.job.sxs. When base data is modified on an underlying PolicyPeriod, this method copies the change to the other side-by-side policy periods. As necessary, this method creates and removes entities so that the base data appears to be shared among the versions in the side-by-side job.

Note: In the policy graph, data that is not base data is referred to as side-by-side data. Unlike base data, side-by-side data is not synchronized between the policy graphs.

The SideBySideBaseDataCopy class uses the MatchableTreeTraverser class to traverse the policy graph of the source and destination periods, collecting information for use during base data copy. Base data copy starts at PolicyPeriod then recursively traverses each link until reaching data excluded from base data.

In SideBySideBaseDataCopy, the main method for copying base data is the copySlice method. This method has three phases.

Phase 1: Build map of matchable keys and edge map

The copySlice method calls the MatchableTreeTraverser class to build a map of MatchableKey objects for each node in the policy graph. The MatchableKey objects are used to determine if nodes from two different policy periods are logically equivalent.

The copySlice method also calls the MatchableTreeTraverser class to build an edge map. The edge map contains a set of node to node edges for each relationship between nodes in the policy graph.

The following illustration shows the node and edge maps for the policy graph of a source policy period.



The copySlice method calls MatchableTreeTraverser to build node and edge maps for each destination policy period.

The following illustration shows the node and edge maps for the policy graph of a destination policy period.



Phase 2: Compare source and destination node maps

The copySlice method compares the source and destination node maps and creates or removes nodes from the destination policy graph.

In the following illustration, MatchableKey 1 exists in the source but not the destination. Therefore, copySlice creates a corresponding MatchableKey and a copy of the A node in the destination.

The MatchableKey 6 exists only in the destination node map. Therefore, copySlice removes the MatchableKey and the node.



Using the edge map of the source, the new node is inserted into the policy graph of the destination, as shown in the following illustration.



Phase 3: Update field values in destination

The copySlice method updates field values on the destination policy graph to match values on the source.