Package com._1c.g5.v8.dt.compare.core
Class ComparisonContext
java.lang.Object
com._1c.g5.v8.dt.compare.core.ComparisonContext
- All Implemented Interfaces:
AutoCloseable
ComparisonContext is able to store comparison-specific information for a single object comparison computation
being performed at the moment. As comparison algorithms could affect other objects, the context is not limited to
store data related to the main target of the comparison process.Each
IComparisonParticipant could register its own set of IObjectComparisonContext's during the
processing.The
ComparisonContext is being created automatically at the beginning of the object comparison process
and being disposed at the end of the comparison process.-
Constructor Summary
ConstructorsConstructorDescriptionComparisonContext(IComparisonSession comparisonSession) Creates context instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddObjectContext(long topNodeId, IObjectComparisonContext objectContext) Adds aIObjectComparisonContextto this context for the given top comparison node.booleancheckNode(ComparisonNode node, String... searchStrings) Shortcut predicative method to find nodes which human/machine readta description matches the given set of substings.voidclose()Closes the context, cleaning/committing all underlying data.describeNode(ComparisonNode node, boolean showFullPath) Gives human/machine-readable description of the comparison for debug purposes: RT - root node TP:linkMain,linkOther,linkAncestor - root node.Gets the batch session handle.Gets the comparison session the context attached to.Gets the comparison transaction associated with the contextGets theComparisonDataSourceTransactionalContextassociated with the current computation.getObjectContext(long topNodeId) Gets aIObjectComparisonContextbeing stored in the context for the given top comparison node.voidsetBatchSessionHandle(Object batchSessionHandle) Sets the batch session handle.voidsetComparisonTransaction(IBmTransaction comparisonTransaction) Sets the comparison transaction.voidsetDataSourceContext(ComparisonDataSourceTransactionalContext dataSourceContext) Sets theComparisonDataSourceTransactionalContext.
-
Constructor Details
-
ComparisonContext
Creates context instance.- Parameters:
comparisonSession- the comparison session, cannot benull
-
-
Method Details
-
addObjectContext
Adds aIObjectComparisonContextto this context for the given top comparison node.- Parameters:
topNodeId- the top comparison node identifier to add object context forobjectContext- The object context to add. Can't benull
-
getComparisonTransaction
Gets the comparison transaction associated with the context- Returns:
- The transaction for the current comparison. Can be
null
-
getComparisonSession
Gets the comparison session the context attached to.- Returns:
- the comparison session, cannot be
null
-
getDataSourceContext
Gets theComparisonDataSourceTransactionalContextassociated with the current computation. The context should be used while accessing the data source objects to ensure the transactional integrity.- Returns:
- The context. Can be
nullduring certain stages of the lifecycle
-
getObjectContext
Gets aIObjectComparisonContextbeing stored in the context for the given top comparison node.- Parameters:
topNodeId- the top comparison node identifier to get object context for- Returns:
- The stored object context. Can be
null
-
getBatchSessionHandle
Gets the batch session handle.- Returns:
- the batch session handle. Can be
null.
-
setComparisonTransaction
Sets the comparison transaction.- Parameters:
The- transaction for the current comparison. Can benull
-
setDataSourceContext
Sets theComparisonDataSourceTransactionalContext.- Parameters:
dataSourceContext- The context to set. Can benull
-
setBatchSessionHandle
Sets the batch session handle.- Parameters:
batchSessionHandle- the batch session handle, can benull.- See Also:
-
checkNode
Shortcut predicative method to find nodes which human/machine readta description matches the given set of substings. See thedescribeNode(ComparisonNode, boolean)for details.- Parameters:
node- The node to check. May not benullsearchStrings- The set of search strings to check against the desription of the node- Returns:
- True if all given strings are contained in the end result
-
describeNode
Gives human/machine-readable description of the comparison for debug purposes: RT - root node TP:linkMain,linkOther,linkAncestor - root node. TP:linkMain,+, - other link is the same as the main, the ancestor link is empty FT:featureName - feature link CE:featureName(1,2,3) - collection element, with indexes for main,other and acestor- Parameters:
node- The node to describe. May not benullshowFullPath- Optionally show the full path for all containment/feature nodes- Returns:
- The description of the node. May not be
null
-
close
public void close()Closes the context, cleaning/committing all underlying data.- Specified by:
closein interfaceAutoCloseable
-