Package com._1c.g5.v8.dt.compare.core
Interface IComparisonParticipant
-
- All Known Implementing Classes:
AbstractEmfBasedComparisonParticipant
,AbstractMdAwareComparisonParticipant
public interface IComparisonParticipant
An object responsible for comparison and merge of a specific kind of comparison objects.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
ableToBreakCorrespondence(ComparisonNode node)
Checks if this participant is able to break a correspondence stored in the specified node.TopComparisonNode
addNewTopObjectToComparison(IComparisonSession comparisonSession, String mainSymlink, org.eclipse.emf.ecore.EClass eClass)
Adds a new node to the comparison for the top object.boolean
adoptExternalProperty(IComparisonSession session, ExternalPropertyComparisonData extPropData)
Adopts the given external property if it is supported by the participant instance.org.eclipse.emf.ecore.EStructuralFeature
adoptMainSideFeature(org.eclipse.emf.ecore.EStructuralFeature mainSideFeature, IComparisonSession session)
Converts, if possible, the main side feature into a other supported by the other side object.boolean
breakCorrespondence(ComparisonContext comparisonContext, ComparisonNode node)
Asks the participant to break correspondence represented by the specified model node.boolean
breakMainSideCorrespondence(IComparisonSession comparisonSession, ComparisonNode node)
Asks the participant to break main side correspondence represented by the specified model node.void
clear()
Clears the participant caches.boolean
combineOneSideNodes(ComparisonContext comparisonContext, ComparisonNode mainNode, ComparisonNode otherNode, List<Long> newNodeIds)
Asks the participant to combine the specified two one-side nodes.List<Long>
compare(TopComparisonNode node, ComparisonContext comparisonContext, org.eclipse.core.runtime.IProgressMonitor monitor)
Compares objects contained in the specified model top node and returns a list of child nodes to be compared.MergeContext
createMergeContext(TopComparisonNode node, IMergeSession mergeSession, ComparisonContext comparisonContext)
Creates merge context for an upcoming merge operation.MergeRule
getDefaultMergeRule(ComparisonNode node, IComparisonSession session)
Returns the default merge rule for the given node.Boolean
getDefaultMustBeMerged(ComparisonNode node, IComparisonSession session)
Returns the default must be merged value for the given node.Map<String,IBmObject>
getForcedDDRebuildScope(TopComparisonNode topNode, MergeContext context)
In case if the merge process changes the top object it should supply information about affected DDs.org.eclipse.emf.ecore.EPackage
getModelPackage()
Get EMF model package.List<ComparisonNode>
getPotentialCorrespondingNodes(ComparisonNode node, ComparisonSide sourceSide)
Returns a list of candidate nodes for setting as corresponding to the specified node.List<PotentialMergeProblemDescription>
getPotentialMergeProblemsDescriptions(ComparisonNode node, ComparisonContext comparisonContext)
Returns human-readable descriptions of potential merge problems if the the specified node is merged.boolean
isCandidateForPotentialMergeProblems(ComparisonNode node, IComparisonSession session)
Tells whether the given node may break the configuration if it is merged.boolean
isExcludedFromComparison(org.eclipse.emf.ecore.EStructuralFeature feature, AbstractComparedEmfObjects<?> comparedContextObjects, IComparisonSession session)
Checks whether the feature must be excluded from the comparison.org.eclipse.core.runtime.IStatus
merge(TopComparisonNode node, MergeContext context, org.eclipse.core.runtime.IProgressMonitor monitor)
Merges the differences in the specified top node in the specified merge session.ExternalMergeToolResult
mergeUsingExternalTool(ComparisonNode node, ComparisonContext comparisonContext, org.eclipse.core.runtime.IProgressMonitor monitor)
Merges nodes using an external tool that are supported by this participant.void
onChildrenMerged(TopComparisonNode topNode, MergeContext context)
Called when the child nodes of the specified top node have been merged.List<IRenameOnMergeOperation>
prepareRenameOperations(IMergeSession mergeSession, ComparisonContext context)
Gets a list of rename operations prepared by this participant.void
restoreCustomSettings(ComparisonNode node, SerializableMergeSettings container, IComparisonSession session)
Restores custom settings for the specified node from the given merge settings container.IComparedObjects<?>
retrieveComparedObjects(ComparisonContext comparisonContext, ComparisonNode node)
Returns a comparedEObject
s triple for the specified model node.void
saveCustomSettings(ComparisonNode node, SerializableMergeSettings container, IComparisonSession session)
Saves custom settings for the specified node into the given merge settings container.boolean
supports(ComparisonNode node)
Indicates whether the participant supports comparison and merging of the specified node.boolean
supportsCustomMerging(ComparisonNode node, IComparisonSession session)
Tells whether the given node supports custom merging.boolean
supportsMergingUsingExternalTool(ComparisonNode node, IComparisonSession session)
Tells whether the given node supports merging using external tool.boolean
supportsPrioritizedMerging(ComparisonNode node, IComparisonSession session)
Tells whether the given node supports prioritized merging.boolean
updateComparison(ComparisonContext comparisonContext, ComparisonNode node, List<Long> newNodeIds)
Updates comparison for the given result node.void
validateMerge(IMergeSession mergeSession, ComparisonContext comparisonContext, ComparisonNode node, List<MergeValidationProblem> validationProblems)
Validates the process of merge of the specified model node.
-
-
-
Method Detail
-
supports
boolean supports(ComparisonNode node)
Indicates whether the participant supports comparison and merging of the specified node.- Parameters:
node
- the node, notnull
- Returns:
true
if the participant supports comparison and merging,false
otherwise
-
getModelPackage
org.eclipse.emf.ecore.EPackage getModelPackage()
Get EMF model package.- Returns:
- the EMF model packge. Never code
null
.
-
compare
List<Long> compare(TopComparisonNode node, ComparisonContext comparisonContext, org.eclipse.core.runtime.IProgressMonitor monitor)
Compares objects contained in the specified model top node and returns a list of child nodes to be compared.- Parameters:
node
- the top node to run comparison for, notnull
comparisonContext
- the comparison context, notnull
monitor
- the progress monitor, can benull
. The clients are not supposed to report work to the monitor, except for the top object matching phase- Returns:
- a list of model node identifiers, never
null
-
merge
org.eclipse.core.runtime.IStatus merge(TopComparisonNode node, MergeContext context, org.eclipse.core.runtime.IProgressMonitor monitor)
Merges the differences in the specified top node in the specified merge session. This may include deletion of the main object if the other object is absent, or, conversely, import ("copying") of the other object if the main object is absent.- Parameters:
node
- the top node to run merge for, notnull
context
- the current merge context, notnull
monitor
- the progress monitor, notnull
- Returns:
- the result of the merge operation
-
createMergeContext
MergeContext createMergeContext(TopComparisonNode node, IMergeSession mergeSession, ComparisonContext comparisonContext)
Creates merge context for an upcoming merge operation.- Parameters:
node
- the top node to be merged, notnull
mergeSession
- the current merge session, notnull
comparisonContext
- the comparison context, notnull
- Returns:
-
onChildrenMerged
void onChildrenMerged(TopComparisonNode topNode, MergeContext context)
Called when the child nodes of the specified top node have been merged.- Parameters:
topNode
- the top node, notnull
context
- Current merge operation context, notnull
-
getForcedDDRebuildScope
Map<String,IBmObject> getForcedDDRebuildScope(TopComparisonNode topNode, MergeContext context)
In case if the merge process changes the top object it should supply information about affected DDs.- Parameters:
topNode
- The top node of the comparison model representing the merged object, nevernull
context
- Current merge operation context, notnull
- Returns:
- The map of the affected DD segments and corresponding objects, could be
null
or empty
-
getPotentialCorrespondingNodes
List<ComparisonNode> getPotentialCorrespondingNodes(ComparisonNode node, ComparisonSide sourceSide)
Returns a list of candidate nodes for setting as corresponding to the specified node.- Parameters:
node
- the comparison result node to find potential correspondences for, notnull
sourceSide
- the source side of the correspondence, notnull
- Returns:
- a list of comparison result nodes or
null
if this kind of nodes is not supported by this participant
-
breakCorrespondence
boolean breakCorrespondence(ComparisonContext comparisonContext, ComparisonNode node)
Asks the participant to break correspondence represented by the specified model node. The participant may refuse to break correspondence if it does not support this kind of node.- Parameters:
comparisonContext
- the comparison context, notnull
node
- the node with the correspondence to break, notnull
- Returns:
true
if the participant supported the operation, andfalse
otherwise
-
updateComparison
boolean updateComparison(ComparisonContext comparisonContext, ComparisonNode node, List<Long> newNodeIds)
Updates comparison for the given result node. Participants could introduce their own specific logic for managing internal states on comparison update.- Parameters:
comparisonContext
- the comparison context, notnull
node
- the node to update comparison for, notnull
newNodeIds
- the list of created new node Ids to fill, notnull
- Returns:
true
if the participant supported the operation, andfalse
otherwise
-
addNewTopObjectToComparison
TopComparisonNode addNewTopObjectToComparison(IComparisonSession comparisonSession, String mainSymlink, org.eclipse.emf.ecore.EClass eClass)
Adds a new node to the comparison for the top object. Participants could introduce their own specific logic for managing internal states on comparison update.- Parameters:
comparisonSession
- the comparison session hosting the model, notnull
mainSymlink
- the symlink for the top object to add, notnull
eClass
- of the object ot add, notnull
- Returns:
- The created result node for the object if supports.
null
otherwise.
-
combineOneSideNodes
boolean combineOneSideNodes(ComparisonContext comparisonContext, ComparisonNode mainNode, ComparisonNode otherNode, List<Long> newNodeIds)
Asks the participant to combine the specified two one-side nodes. The participant may refuse to do it if it does not support this kind of nodes. The participant fills array of new node Ids created while combining the specified nodes. These node Ids must be scheduled for comparison in the external code.- Parameters:
comparisonContext
- the comparison context, notnull
mainNode
- the one-side MAIN node to be combined, notnull
otherNode
- the one-side OTHER node to be combined, notnull
newNodeIds
- the list of new node Ids to fill, notnull
- Returns:
true
if the participant supported the operation, andfalse
otherwise
-
ableToBreakCorrespondence
boolean ableToBreakCorrespondence(ComparisonNode node)
Checks if this participant is able to break a correspondence stored in the specified node.- Parameters:
node
- the node to check if its correspondence can be broken by this participant, notnull
- Returns:
true
if this participant is able to break the correspondence, andfalse
otherwise
-
retrieveComparedObjects
IComparedObjects<?> retrieveComparedObjects(ComparisonContext comparisonContext, ComparisonNode node)
Returns a comparedEObject
s triple for the specified model node.- Parameters:
comparisonContext
- the comparison context, notnull
node
- the model node, cannot benull
- Returns:
- the compared objects triple, never
null
-
prepareRenameOperations
List<IRenameOnMergeOperation> prepareRenameOperations(IMergeSession mergeSession, ComparisonContext context)
Gets a list of rename operations prepared by this participant.- Parameters:
mergeSession
- the merge session, notnull
context
- the comparison context, notnull
- Returns:
- the list of rename operations, never
null
-
validateMerge
void validateMerge(IMergeSession mergeSession, ComparisonContext comparisonContext, ComparisonNode node, List<MergeValidationProblem> validationProblems)
Validates the process of merge of the specified model node.- Parameters:
mergeSession
- the merge session, notnull
comparisonContext
- the comparison context, notnull
node
- the model nodevalidationProblems
- the list of collected validation problems to add new problem to
-
clear
void clear()
Clears the participant caches.
-
adoptExternalProperty
boolean adoptExternalProperty(IComparisonSession session, ExternalPropertyComparisonData extPropData)
Adopts the given external property if it is supported by the participant instance. If adopting is possible, the method fills the provided comparison data container by its own data to be used for adoption.- Parameters:
session
- the comparison session, notnull
extPropData
- the data of the external property to be adopted, cannot benull
- Returns:
true
if adopting is possible,false
otherwise
-
supportsPrioritizedMerging
boolean supportsPrioritizedMerging(ComparisonNode node, IComparisonSession session)
Tells whether the given node supports prioritized merging.- Parameters:
node
- the node to check, cannot benull
session
- the comparison session, cannot benull
- Returns:
true
if the node supports prioritized merging,false
otherwise
-
supportsCustomMerging
boolean supportsCustomMerging(ComparisonNode node, IComparisonSession session)
Tells whether the given node supports custom merging.- Parameters:
node
- the node to check, cannot benull
session
- the comparison session, cannot benull
- Returns:
true
if the node supports custom merging,false
otherwise
-
supportsMergingUsingExternalTool
boolean supportsMergingUsingExternalTool(ComparisonNode node, IComparisonSession session)
Tells whether the given node supports merging using external tool.- Parameters:
node
- the comparison node to check, cannot benull
session
- the comparison session, cannot benull
- Returns:
true
if the node supports merging using external tool,false
otherwise
-
breakMainSideCorrespondence
boolean breakMainSideCorrespondence(IComparisonSession comparisonSession, ComparisonNode node)
Asks the participant to break main side correspondence represented by the specified model node. The participant may refuse to break main side correspondence if it does not support this kind of node.- Parameters:
comparisonSession
- the comparison session hosting the model, can not benull
node
- the node with the correspondence to break, can not benull
- Returns:
true
if the participant supported the operation andfalse
otherwise
-
isExcludedFromComparison
boolean isExcludedFromComparison(org.eclipse.emf.ecore.EStructuralFeature feature, AbstractComparedEmfObjects<?> comparedContextObjects, IComparisonSession session)
Checks whether the feature must be excluded from the comparison.- Parameters:
feature
- the feature to check, cannot benull
comparedContextObjects
- the triple of compared objects, cannot benull
session
- the comparison session, cannot benull
- Returns:
true
if the feature must be excluded,false
otherwise
-
getDefaultMergeRule
MergeRule getDefaultMergeRule(ComparisonNode node, IComparisonSession session)
Returns the default merge rule for the given node.- Parameters:
node
- the node to get default merge rule for, can not benull
session
- the comparison session, can not benull
- Returns:
- the default merge rule or
null
if it wasn't specified
-
adoptMainSideFeature
org.eclipse.emf.ecore.EStructuralFeature adoptMainSideFeature(org.eclipse.emf.ecore.EStructuralFeature mainSideFeature, IComparisonSession session)
Converts, if possible, the main side feature into a other supported by the other side object.- Parameters:
mainSideFeature
- the main side feature to convert, cannot benull
session
- the comparison session, cannot benull
- Returns:
- the converted feature applicable for other side object or
null
-
getDefaultMustBeMerged
Boolean getDefaultMustBeMerged(ComparisonNode node, IComparisonSession session)
Returns the default must be merged value for the given node.- Parameters:
node
- the node to get default must be merged value for, can not benull
session
- the comparison session, can not benull
- Returns:
- the default must be merged value or
null
if it wasn't specified
-
saveCustomSettings
void saveCustomSettings(ComparisonNode node, SerializableMergeSettings container, IComparisonSession session)
Saves custom settings for the specified node into the given merge settings container. Does nothing if the node doesn't have any custom settings.- Parameters:
node
- the comparison node to save custom settings for, cannot benull
container
- the container of serializable settings, cannot benull
session
- the comparison session, cannot benull
-
restoreCustomSettings
void restoreCustomSettings(ComparisonNode node, SerializableMergeSettings container, IComparisonSession session)
Restores custom settings for the specified node from the given merge settings container.- Parameters:
node
- the comparison node to restore custom settings for, cannot benull
container
- the container of serializable settings, cannot benull
session
- the comparison session, cannot benull
-
isCandidateForPotentialMergeProblems
boolean isCandidateForPotentialMergeProblems(ComparisonNode node, IComparisonSession session)
Tells whether the given node may break the configuration if it is merged.- Parameters:
node
- the node to check, cannot benull
session
- the comparison session, cannot benull
- Returns:
true
if the node may break the configuration,false
otherwise
-
getPotentialMergeProblemsDescriptions
List<PotentialMergeProblemDescription> getPotentialMergeProblemsDescriptions(ComparisonNode node, ComparisonContext comparisonContext)
Returns human-readable descriptions of potential merge problems if the the specified node is merged.- 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
-
mergeUsingExternalTool
ExternalMergeToolResult mergeUsingExternalTool(ComparisonNode node, ComparisonContext comparisonContext, org.eclipse.core.runtime.IProgressMonitor monitor)
Merges nodes using an external tool that are supported by this participant.- Parameters:
node
- the comparison node, cannot benull
comparisonContext
- the comparison context, cannot benull
monitor
- the progress monitor, cannot benull
- Returns:
- the external merge tool result or
null
if no nodes were merged
-
-