Interface IComparisonSession
- All Superinterfaces:
IProgressMonitorContainer
- All Known Implementing Classes:
ComparisonSession
handle
).
Comparison sessions are entities granting access to the comparison model and various high-level operations with it and with the comparison environment. Also, they allow to subscribe to model events.
Comparison sessions are managed by the comparison manager
. It creates a session
when a comparison process is started for the specified handle
, and discards
it either when the merge process based on that session was successfully finished, or a client
asks to stop
the session's comparison process
with discarding.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
A listener of comparison tree changes. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addChild
(ComparisonNode parentNode, ComparisonNode childNode, IComparedObjects<?> comparedObjects) Adds the specified child node to the specified parent node.void
Adds a comparison result listener.boolean
adoptExternalProperty
(ExternalPropertyComparisonData extPropData) Adopts the given external property if possible.org.eclipse.emf.ecore.EStructuralFeature
adoptMainSideFeature
(org.eclipse.emf.ecore.EStructuralFeature mainSideFeature) Converts, if possible, the main side feature into a other supported by the other side object.boolean
areExplicitCorrespondencesSet
(ComparisonSide sourceSide, ComparisonSide targetSide) An optimization flag indicating whether explicit correspondence settings are set for the specified direction.void
clearCaches
(ComparisonNode node) Clears compared object cache for the specified node.getComparedObjects
(ComparisonNode node, ComparisonContext comparisonContext) Returns a triple of compared objects for the specified node.getComparedObjects
(ComparisonNode node, AbstractComparedEmfObjects<?> topParents, ComparisonContext comparisonContext) Returns a triple of compared objects for the specified node.Returns a collection of correspondences between compared objects.getDataSource
(ComparisonSide side) Returns the comparison data source by its side.getDirectCorrespondence
(String source, ComparisonSide sourceSide, ComparisonSide targetSide) Returns the symbolic link corresponding to the given source symbolic link in the direction defined by the specified comparison sides.org.eclipse.emf.ecore.EClass
getEClassById
(int id) GetsEClass
by its identifier returned bygetEClassId(org.eclipse.emf.ecore.EClass)
method.int
getEClassId
(org.eclipse.emf.ecore.EClass eClass) Gets identifier assigned to the specifiedEClass
.Returns the handle of the comparison process this session is associated with.int
getId()
Gets the id of this comparison session.Gets the integration settings context being associated with the comparison sessionorg.eclipse.emf.ecore.EClass
getMatchedObjectsEClass
(long nodeId) ReturnsEClass
of model objects the node relates to.org.eclipse.emf.ecore.EClass
ReturnsEClass
of model objects the node relates to.getMatchingStrategy
(ComparisonSide firstSide, ComparisonSide secondSide) Returns the matching strategy used between the specified sides.getNode
(long nodeId) Returns a result node by the specified id.getNode
(ComparisonContext comparisonContext, long nodeId) Returns a result node by the specified id.Returns a comparison tree node with serializable merge settings.org.eclipse.emf.ecore.EStructuralFeature
ReturnsEStructuralFeature
of the collection containing the object related to the given comparison node.getPotentialMergeProblemsDescriptions
(long nodeId, ComparisonContext comparisonContext) Returns human-readable descriptions of merge problems of the specified node.Returns collection of nodes that cause potential merge problems.getProjectName
(ComparisonSide side) Returns the given side project name.org.eclipse.emf.ecore.EStructuralFeature
getRelatedFeature
(long nodeId) ReturnsEStructuralFeature
the node relates to.org.eclipse.emf.ecore.EStructuralFeature
ReturnsEStructuralFeature
the node relates to.Returns the resource store accessible within the session.Returns the root of the comparison result tree.Returns container of serializable merge settings of the given node.Returns the settings that were specified when the session was started.Returns the status of the comparison process.Returns the symbolic link translator serving this session.getTopNode
(String symlink, ComparisonSide side) Returns a top node by the specified symbolic link.getTopNodeOf
(long nodeId) Returns a top-level parent node of the node with the specified id.getTopNodeOf
(ComparisonNode node) Returns a top-level parent node of the given node.getTopNodeStatus
(long nodeId) Returns the comparison status of the specified top-level node.boolean
hasExtendedComparisonSettings
(String symlink) Checks if the provided symlink has an extended comparison settings associated with it.boolean
hasPotentialMergeProblems
(long nodeId) Tells whether the node may break the configuration if it is merged.boolean
isExcluded
(String source, ComparisonSide sourceSide, ComparisonSide targetSide) Checks if the specified symbolic link is explicitly excluded from matching in the specified direction.boolean
isFailedOnMergeUsingExternalTool
(long nodeId) Tells whether the merge using external tool failed for the specified node.boolean
isFeatureExcludedFromComparison
(org.eclipse.emf.ecore.EStructuralFeature feature, AbstractComparedEmfObjects<?> comparedContextObjects) Tells whether the feature is excluded from the comparison process.boolean
Checks whether the scope of comparison of the session is global, that is, its settings do not specify any scope object on any side.boolean
isInInputScope
(ComparisonNode node) Checks whether the specified node lies within the input comparison scope (before the scope was extended) of this session.boolean
isInInputScope
(String symlink, ComparisonSide side) Checks whether the specified symbolic link satisfies the input comparison scope (before the scope was extended) on the specified side.boolean
isInScope
(ComparisonNode node) Checks whether the specified node lies within the scope of comparison of this session.boolean
isInScope
(String symlink, ComparisonSide side) Checks whether the specified symbolic link satisfies the scope of comparison on the specified side, that is, is leading to, included into, or coming from the scope of comparison.boolean
Checks whether the comparison session is three-way.void
prioritize
(List<Long> nodeIds) Asks the session to prioritize the comparison of the specified list of nodes.void
removeChild
(ComparisonNode parentNode, ComparisonNode childNode) Removes the specified child from the specified parent node.void
removeChildren
(ComparisonNode node) Recursively removes all children of the specified node.void
Removes a comparison result listener.<T> T
runComparisonTreeReadonlyTask
(IBmTask<T> task) Executes the given read-only BM task for a comparison tree of the specified session.boolean
setCorrespondence
(String mainSymlink, String otherSymlink, String ancestorSymlink) Sets correspondence between two symbolic links and common ancestor (optional).void
setCustomMergeSettings
(long nodeId, CustomMergeSettings settings, ComparisonContext comparisonContext) Sets node's custom merge settings.void
setIntegrationContext
(IntegrationContext integrationContext) Sets the integration settings context for the comparison sessionboolean
setMergeRule
(long nodeId, MergeRule rule, ComparisonContext comparisonContext) Sets the given merge rule to the specified node.boolean
setMustBeMerged
(long nodeId, boolean mustBeMerged, boolean force) Sets the "Merge" flag value to the specified node and to all its children.boolean
setOrderSide
(long nodeId, ComparisonSide orderSide, ComparisonContext comparisonContext) Sets the order side to be used for children ordering for the specified node.Methods inherited from interface com._1c.g5.v8.dt.compare.core.IProgressMonitorContainer
addProgressMonitor, addProgressMonitor, removeProgressMonitor
-
Method Details
-
getHandle
ComparisonProcessHandle getHandle()Returns the handle of the comparison process this session is associated with.- Returns:
- the handle, never
null
-
getSettings
IComparisonProcessSettings getSettings()Returns the settings that were specified when the session was started.- Returns:
- the session settings
-
isGlobalScope
boolean isGlobalScope()Checks whether the scope of comparison of the session is global, that is, its settings do not specify any scope object on any side.- Returns:
true
if the session comparison scope is global, andfalse
otherwise
-
getStatus
ComparisonProcessStatus getStatus()Returns the status of the comparison process.- Returns:
- the status, never
null
-
getDataSource
Returns the comparison data source by its side.- Parameters:
side
- the side of the data source, notnull
- Returns:
- the data source, may be
null
when trying to get the common ancestor of a two-way comparison
-
getNode
Returns a result node by the specified id.- Parameters:
nodeId
- the node id- Returns:
- the node or
null
if no node exists with such id in the model
-
getNode
Returns a result node by the specified id.- Parameters:
comparisonContext
- the comparison context, notnull
nodeId
- the node id- Returns:
- the node or
null
if no node exists with such id in the model
-
getTopNode
Returns a top node by the specified symbolic link.- Parameters:
symlink
- the symbolic link, notnull
side
- the side to search at, can not benull
- Returns:
- the top node or
null
if didn't find it
-
getTopNodeOf
Returns a top-level parent node of the node with the specified id.- Parameters:
nodeId
- the node id to find top parent for- Returns:
- the top node or
null
if no such node found
-
getTopNodeOf
Returns a top-level parent node of the given node.- Parameters:
node
- the node to find top parent for- Returns:
- the top node or
null
if no such node found
-
isInScope
Checks whether the specified node lies within the scope of comparison of this session.- Parameters:
node
- the node to check, cannot benull
- Returns:
true
if the node is within scope, andfalse
otherwise
-
isInScope
Checks whether the specified symbolic link satisfies the scope of comparison on the specified side, that is, is leading to, included into, or coming from the scope of comparison.- Parameters:
symlink
- the symbolic link to checkside
- the side to which symbolic link relates to, notnull
- Returns:
true
if the symbolic link is within scope,false
otherwise
-
isInInputScope
Checks whether the specified node lies within the input comparison scope (before the scope was extended) of this session.- Parameters:
node
- the node to check, cannot benull
- Returns:
true
if the node is within the input scope, andfalse
otherwise
-
isInInputScope
Checks whether the specified symbolic link satisfies the input comparison scope (before the scope was extended) on the specified side.- Parameters:
symlink
- the symbolic link to check, cannot benull
side
- the side to which symbolic link relates to, cannotnull
- Returns:
true
if the symbolic link is within the input scope,false
otherwise
-
getRootNode
RootComparisonNode getRootNode()Returns the root of the comparison result tree.- Returns:
- the root of the comparison result tree.
-
getMatchingStrategy
Returns the matching strategy used between the specified sides.The method is symmetrical, i. e.
getMatchingStrategy(a, b) == getMatchingStrategy(b, a)
.- Parameters:
firstSide
- the first side of the comparison, notnull
secondSide
- the second side of the comparison, notnull
- Returns:
- the matching strategy, never
null
-
getDirectCorrespondence
Returns the symbolic link corresponding to the given source symbolic link in the direction defined by the specified comparison sides.The method will always return
null
if the source is excluded from the comparison in the specified direction.The method is symmetric in the sense that if
A2 == getDirectCorrespondence(A1, side1, side2)
, thenA1 == getDirectCorrespondence(A2, side2, side1)
.- Parameters:
source
- the string with the source symbolic link, notnull
sourceSide
- the source side, notnull
targetSide
- the target side, notnull
- Returns:
- the string with the target symbolic link or
null
if no direct correspondence is set
-
isExcluded
Checks if the specified symbolic link is explicitly excluded from matching in the specified direction.- Parameters:
source
- the source symbolic link, notnull
sourceSide
- the source side, notnull
targetSide
- the target side, notnull
- Returns:
true
if the link is excluded from matching, andfalse
otherwise
-
isThreeWay
boolean isThreeWay()Checks whether the comparison session is three-way.- Returns:
true
if the comparison session is three-way, andfalse
if it is two-way
-
areExplicitCorrespondencesSet
An optimization flag indicating whether explicit correspondence settings are set for the specified direction.- Parameters:
sourceSide
- the source side of the directiontargetSide
- the target side of the direction- Returns:
true
if explicit correspondence are set, andfalse
otherwise
-
addChild
void addChild(ComparisonNode parentNode, ComparisonNode childNode, IComparedObjects<?> comparedObjects) Adds the specified child node to the specified parent node. If a triple of compared objects is given, it is stored in cache for future fast access bygetComparedObjects(ComparisonNode, ComparisonContext)
method.- Parameters:
parentNode
- the parent node, cannot benull
childNode
- the child node to be added, cannot benull
comparedObjects
- the objects being compared by the child node to put in cache, can benull
-
setMustBeMerged
boolean setMustBeMerged(long nodeId, boolean mustBeMerged, boolean force) Sets the "Merge" flag value to the specified node and to all its children. The flag can be set only when comparison process has been finished.- Parameters:
nodeId
- the node idmustBeMerged
- the value to setforce
-true
if we want to force change even if merge rule forbids this- Returns:
true
if the flag set successfully,false
otherwise
-
setMergeRule
Sets the given merge rule to the specified node. The rule can be set only when comparison process has been finished.- Parameters:
nodeId
- the node idrule
- the merge rule to set, cannot benull
comparisonContext
- current comparison operation context, cannot benull
- Returns:
true
if the rule set successfully,false
otherwise
-
setOrderSide
Sets the order side to be used for children ordering for the specified node. The node must support ordering of its children. The method should be called only when comparison process has been finished.- Parameters:
nodeId
- the node idorderSide
- the order side to set, can be either MAIN or OTHER, cannot benull
comparisonContext
- current comparison operation context, cannot benull
- Returns:
true
if the side set successfully,false
otherwise
-
setCustomMergeSettings
void setCustomMergeSettings(long nodeId, CustomMergeSettings settings, ComparisonContext comparisonContext) Sets node's custom merge settings.- Parameters:
nodeId
- the node idsettings
- the custom merge settings to set, cannot benull
comparisonContext
- current comparison operation context, cannot benull
-
addComparisonTreeListener
Adds a comparison result listener.- Parameters:
listener
- the result listener, notnull
-
removeComparisonTreeListener
Removes a comparison result listener.- Parameters:
listener
- the result listener, notnull
-
getTopNodeStatus
Returns the comparison status of the specified top-level node.- Parameters:
nodeId
- the node identifier to get status for, must specify the top-level node- Returns:
- the node comparison status, never
null
-
removeChild
Removes the specified child from the specified parent node.- Parameters:
parentNode
- the parent node from which to remove the child, notnull
childNode
- the child node to remove from the parent node, notnull
-
removeChildren
Recursively removes all children of the specified node.- Parameters:
node
- the node for which to remove all its children, notnull
-
setCorrespondence
Sets correspondence between two symbolic links and common ancestor (optional). The correspondence can be set only when there is no active comparison process. The call of this method causes an automatic start of a new comparison process.- Parameters:
mainSymlink
- the main symbolic link, may benull
otherSymlink
- the other symbolic link, may benull
ancestorSymlink
- the ancestor symbolic link (optional), may benull
- Returns:
true
if the correspondence set successfully,false
otherwise
-
adoptExternalProperty
Adopts the given external property if possible. If adopting is possible, the method fills the provided comparison data container by data to be used for adoption.- Parameters:
extPropData
- the data of the external property to be adopted, cannot benull
- Returns:
true
if adopting is possible,false
otherwise
-
prioritize
Asks the session to prioritize the comparison of the specified list of nodes.- Parameters:
nodeIds
- the ids of the nodes to prioritize their comparison, notnull
-
clearCaches
Clears compared object cache for the specified node.- Parameters:
node
- the node to clear the compared object cache for
-
getComparedObjects
Returns a triple of compared objects for the specified node. Note: it may work slower than#getComparedObjects(ComparisonNode, ComparedEmfObjects)
because it has to obtain the top parents triple first. Use that method if the top parents triple is already known.- Parameters:
node
- the node to get the triple of compared objects for, cannot benull
comparisonContext
- the comparison context, notnull
- Returns:
- the compared objects triple, never
null
-
getComparedObjects
IComparedObjects<?> getComparedObjects(ComparisonNode node, AbstractComparedEmfObjects<?> topParents, ComparisonContext comparisonContext) Returns a triple of compared objects for the specified node. Uses triple of top parents if they are given to speed up objects obtaining.- Parameters:
node
- the node to get the triple of compared objects for, cannot benull
parentTriple
- the triple of top parents ornull
if they are not knowncomparisonContext
- the comparison context, notnull
- Returns:
- the compared objects triple, never
null
-
getSymlinkTranslator
ISymlinkTranslator getSymlinkTranslator()Returns the symbolic link translator serving this session.- Returns:
- the symbolic link translator
-
getResourceStore
IResourceStore getResourceStore()Returns the resource store accessible within the session.- Returns:
- the resource store
-
getId
int getId()Gets the id of this comparison session.- Returns:
- the comparison session id
-
getProjectName
Returns the given side project name.- Parameters:
side
- the comparison side, can not benull
- Returns:
- the given side project name, may be
null
-
setIntegrationContext
Sets the integration settings context for the comparison session- Parameters:
integrationContext
- The integration settings context. Could benull
-
getIntegrationContext
IntegrationContext getIntegrationContext()Gets the integration settings context being associated with the comparison session- Returns:
- The associated integration settings context, if any.
null
otherwise
-
getEClassById
org.eclipse.emf.ecore.EClass getEClassById(int id) GetsEClass
by its identifier returned bygetEClassId(org.eclipse.emf.ecore.EClass)
method.- Parameters:
id
- the identifier to getEClass
by.- Returns:
- the
EClass
identified by the specified id ornull
if doesn't exist
-
getEClassId
int getEClassId(org.eclipse.emf.ecore.EClass eClass) Gets identifier assigned to the specifiedEClass
.- Parameters:
eClass
- theEClass
to get identifier for, cannot benull
- Returns:
- the identifier assigned to the
EClass
-
getMatchedObjectsEClass
org.eclipse.emf.ecore.EClass getMatchedObjectsEClass(long nodeId) ReturnsEClass
of model objects the node relates to.- Parameters:
nodeId
- the nodeId to returnEClass
for- Returns:
- the
EClass
ornull
if the node doesn't relate to any model object
-
getMatchedObjectsEClass
ReturnsEClass
of model objects the node relates to.- Parameters:
node
- the node to return feature for, may benull
- Returns:
- the
EClass
ornull
if the node is null or doesn't relate to any model object
-
getRelatedFeature
org.eclipse.emf.ecore.EStructuralFeature getRelatedFeature(long nodeId) ReturnsEStructuralFeature
the node relates to.- Parameters:
nodeId
- the nodeId to return feature for- Returns:
- the feature or
null
if the node doesn't relate to any feature
-
getRelatedFeature
ReturnsEStructuralFeature
the node relates to.- Parameters:
node
- the node to return feature for, may benull
- Returns:
- the feature or
null
if the node doesn't relate to any feature
-
getParentCollectionFeature
ReturnsEStructuralFeature
of the collection containing the object related to the given comparison node.- Parameters:
node
- the node related to the collection element, may be benull
- Returns:
- the parent collection feature or
null
if the node doesn't relate to any collection element
-
isFeatureExcludedFromComparison
boolean isFeatureExcludedFromComparison(org.eclipse.emf.ecore.EStructuralFeature feature, AbstractComparedEmfObjects<?> comparedContextObjects) Tells whether the feature is excluded from the comparison process.- Parameters:
feature
- the feature to check, cannot benull
comparedContextObjects
- the triple of compared objects, cannot benull
- Returns:
true
if the feature is excluded,false
otherwise
-
runComparisonTreeReadonlyTask
Executes the given read-only BM task for a comparison tree of the specified session.- Parameters:
task
- the task to execute, cannot benull
- Returns:
- the result returned by
IBmTask.execute(IBmTransaction, IProgressMonitor)
method
-
hasExtendedComparisonSettings
Checks if the provided symlink has an extended comparison settings associated with it. Extended settings are being supplied with external comparison configuration.- Parameters:
symlink
- The target symlink, can benull
- Returns:
- True if the object pointed with the symlink has an extended comparison settings
-
adoptMainSideFeature
org.eclipse.emf.ecore.EStructuralFeature adoptMainSideFeature(org.eclipse.emf.ecore.EStructuralFeature mainSideFeature) Converts, if possible, the main side feature into a other supported by the other side object. Returns the given main side feature if no convert was found.- Parameters:
mainSideFeature
- the main side feature to convert, cannot benull
- Returns:
- the converted feature applicable for other side object or given main side feature
if no convert was found, never
null
-
getComparedObjectsCorrespondences
Collection<ObjectsTriple<String>> getComparedObjectsCorrespondences()Returns a collection of correspondences between compared objects.- Returns:
- general list of correspondences in the form of pairs (main symlink, other symlink), never
null
-
getNodesWithChangedMergeSettings
Collection<Long> getNodesWithChangedMergeSettings()Returns a comparison tree node with serializable merge settings.- Returns:
- Collection of node BM identifiers, never
null
-
getSerializableNodeMergeSettings
Returns container of serializable merge settings of the given node.- Parameters:
node
- the node to get container for, cannot benull
- Returns:
- the container of serializable merge settings, never
null
-
hasPotentialMergeProblems
boolean hasPotentialMergeProblems(long nodeId) Tells whether the node may break the configuration if it is merged.- Parameters:
nodeId
- the node Id to check- Returns:
true
if the node may break the configuration,false
otherwise
-
getPotentialMergeProblemsDescriptions
List<PotentialMergeProblemDescription> getPotentialMergeProblemsDescriptions(long nodeId, ComparisonContext comparisonContext) Returns human-readable descriptions of merge problems of the specified node.- Parameters:
node
- the node to get merge problems descriptions for, cannot benull
comparisonContext
- the comparison context, cannot benull
- Returns:
- the list of descriptions, never
null
, can be empty if the node doesn't bring any merge problems
-
getPotentialMergeProblemsSourceNodes
Collection<Long> getPotentialMergeProblemsSourceNodes()Returns collection of nodes that cause potential merge problems.- Returns:
- the collection of such nodes, can be empty, never
null
-
isFailedOnMergeUsingExternalTool
boolean isFailedOnMergeUsingExternalTool(long nodeId) Tells whether the merge using external tool failed for the specified node.- Parameters:
nodeId
- the node id to check- Returns:
true
if the merge using external tool failed,false
otherwise
-