Class DcsComparisonParticipant
java.lang.Object
com._1c.g5.v8.dt.compare.participant.AbstractEmfBasedComparisonParticipant
com._1c.g5.v8.dt.md.compare.participant.AbstractMdAwareComparisonParticipant
com._1c.g5.v8.dt.internal.dcs.compare.DcsComparisonParticipant
- All Implemented Interfaces:
IComparisonParticipant,ISymlinkTranslationContributor
public class DcsComparisonParticipant
extends AbstractMdAwareComparisonParticipant
implements ISymlinkTranslationContributor
The DCS comparison participant.
-
Nested Class Summary
Nested classes/interfaces inherited from class com._1c.g5.v8.dt.compare.participant.AbstractEmfBasedComparisonParticipant
AbstractEmfBasedComparisonParticipant.BmIdsWrapper, AbstractEmfBasedComparisonParticipant.EObjectClassFeatures -
Field Summary
Fields inherited from class com._1c.g5.v8.dt.md.compare.participant.AbstractMdAwareComparisonParticipant
bmModelManager, INVALID_SYMLINK_PATTERN, LOGGING, qualifiedNameProvider, SYMLINK_SEPARATORFields inherited from class com._1c.g5.v8.dt.compare.participant.AbstractEmfBasedComparisonParticipant
LOG_TYPES, pictureManager, projectFileSystemSupportProvider, qualifiedNameFilePathConverter, scopeProvider, topObjectFqnGenerator -
Constructor Summary
ConstructorsConstructorDescriptionCreates an instance of the participant.DcsComparisonParticipant(org.eclipse.xtext.scoping.IScopeProvider scopeProvider) Creates an instance of the participant with the specified scope provider. -
Method Summary
Modifier and TypeMethodDescriptionbooleanTells whether to able to break the correspondence for the specified node.addNewTopObjectToComparison(IComparisonSession comparisonSession, String mainSymlink, org.eclipse.emf.ecore.EClass eClass) Adds a new node to the comparison for the top object.booleanadoptExternalProperty(IComparisonSession session, ExternalPropertyComparisonData extPropData) Adopts the given external property if it is supported by the participant instance.protected booleanareDifferentEClassObjectsMergeable(org.eclipse.emf.ecore.EObject main, org.eclipse.emf.ecore.EObject other, ComparisonContext comparisonContext) voidbreakCorrespondence(ComparisonContext comparisonContext, ComparisonNode node) Breaks the correspondence for the specified node.voidbreakMainSideCorrespondence(IComparisonSession session, ComparisonNode node) Breaks the main side correspondence represented by the specified model node.voidcombineOneSideNodes(ComparisonContext comparisonContext, ComparisonNode mainNode, ComparisonNode otherNode, List<Long> newNodeIds) Combines the specified two one-side nodes.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.protected org.eclipse.emf.ecore.EObjectcreateImportedEObject(org.eclipse.emf.ecore.EObject otherObject, IMergeSession mergeSession) createMergeContext(TopComparisonNode node, IMergeSession mergeSession, ComparisonContext comparisonContext) Creates merge context for an upcoming merge operation.protected IEmfObjectMatchergetCustomMatcher(TopComparisonNode topNode, org.eclipse.emf.ecore.EReference reference, ComparisonContext comparisonContext) Returns a custom matcher for the specified reference.getDefaultMustBeMerged(ComparisonNode node, IComparisonSession session) Returns the default must be merged value for the given node.getMatchingSymlinks(ComparisonNode node, org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EReference reference, ComparisonSide sourceSide, String symlink, ComparisonContext comparisonContext, IMergeSession mergeSession) Returns a "matching symlinks" object for the specified symbolic link in the specified context.getMatchingSymlinksToTopObject(ComparisonContext comparisonContext, String symlink, ComparisonSide side, IMergeSession mergeSession) Returns matched symlinks to the top object with the given symlink on a given comparison side.org.eclipse.emf.ecore.EPackageGet EMF model package.getMultiReferenceSymlinks(org.eclipse.emf.ecore.EObject contextObject, org.eclipse.emf.ecore.EReference reference, IComparisonSession session, ComparisonSide side) Returns list of symbolic links for objects referenced by the specified multi-reference feature from the specified context object.protected StringgetMultiReferenceValueSymlink(org.eclipse.emf.ecore.EObject contextObject, org.eclipse.emf.ecore.EReference reference, org.eclipse.emf.ecore.EObject eObject, IComparisonSession session, ComparisonSide side) Returns symbolic link of the specified target object lying into collection of referencing objects specified by the given multi-reference feature.getPotentialCorrespondingNodes(ComparisonNode node, ComparisonSide sourceSide) Returns a list of candidate nodes for setting as corresponding to the specified node.protected booleanisFeatureWithCustomMerge(org.eclipse.emf.ecore.EStructuralFeature feature) protected booleanisUnmatchableContainment(org.eclipse.emf.ecore.EReference reference) Checks whether the specified containment feature cannot be matched by an identity-based matcher.org.eclipse.core.runtime.IStatusmerge(TopComparisonNode node, MergeContext context, org.eclipse.core.runtime.IProgressMonitor monitor) Merges the differences in the specified top node in the specified merge session.retrieveComparedObjects(ComparisonContext comparisonContext, ComparisonNode node) Returns a comparedEObjects triple for the specified model node.booleansupports(ComparisonNode node) Indicates whether the participant supports comparison and merging of the specified node.voidupdateComparison(ComparisonContext comparisonContext, ComparisonNode node, List<Long> newNodeIds) Updates comparison for the given result node.voidvalidateMerge(IMergeSession mergeSession, ComparisonContext comparisonContext, ComparisonNode node, List<MergeValidationProblem> validationProblems) Validates the process of merge of the specified model node.Methods inherited from class com._1c.g5.v8.dt.md.compare.participant.AbstractMdAwareComparisonParticipant
compareEmfObject, extractTopLink, getDefaultMergeRule, getExternalPropertyQualifyingType, getExternalPropertySymlink, hasConflictChangesInCollection, isBmIdMayChangeOnMerge, isFeatureTakenFromPreferredSide, supportsPrioritizedMergingMethods inherited from class com._1c.g5.v8.dt.compare.participant.AbstractEmfBasedComparisonParticipant
adaptOtherReference, adoptEClassToImport, adoptMainSideFeature, assertEClassesMatch, calculateCompareValueFlags, checkForOneSideConflict, clear, compareEmfContainment, compareOneSideObject, comparePictureResource, compareReference, compareValue, createClassFeaturesInstance, createResourceForImportedObject, deletePictureResourceFile, findChildNodeByFeature, findChildNodeByMatchedId, getClassFeatures, getClassFeatures, getFeaturesToCompareForOneSideObject, getFeatureTypeDescription, getForcedDDRebuildScope, getNodeFactory, getOtherSideFeature, getPictureResourcePath, getPotentialMergeProblemsDescriptions, getQualifiedName, getSingleReferenceSymlink, getTopNode, importEmfObject, importPictureResourceFile, isCandidateForPotentialMergeProblems, isExcludedFromComparison, matchEmfObjects, mergeEmfProperties, mergeEmfReference, mergeOtherContainment, mergeUsingExternalTool, needCreateOneSideNode, onChildrenMerged, prepareRenameOperations, removeObjectFromContainerOnMerge, removeObjectFromListOnMerge, restoreCustomSettings, saveCustomSettings, setObjectToContainerOnMerge, skipFeatureOnImportEmfObject, supportsCustomMerging, supportsMergingUsingExternalTool, translateReferencesInImportedObject, updatePictureResourceFile, wrapOtherReference
-
Constructor Details
-
DcsComparisonParticipant
public DcsComparisonParticipant()Creates an instance of the participant. -
DcsComparisonParticipant
public DcsComparisonParticipant(org.eclipse.xtext.scoping.IScopeProvider scopeProvider) Creates an instance of the participant with the specified scope provider.- Parameters:
scopeProvider- the scope provider for Dcs objects, can not benull
-
-
Method Details
-
adoptExternalProperty
public boolean adoptExternalProperty(IComparisonSession session, ExternalPropertyComparisonData extPropData) Description copied from interface:IComparisonParticipantAdopts 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.- Specified by:
adoptExternalPropertyin interfaceIComparisonParticipant- Parameters:
session- the comparison session, notnullextPropData- the data of the external property to be adopted, cannot benull- Returns:
trueif adopting is possible,falseotherwise
-
supports
Description copied from interface:IComparisonParticipantIndicates whether the participant supports comparison and merging of the specified node.- Specified by:
supportsin interfaceIComparisonParticipant- Parameters:
node- the node, notnull- Returns:
trueif the participant supports comparison and merging,falseotherwise
-
getModelPackage
public org.eclipse.emf.ecore.EPackage getModelPackage()Description copied from interface:IComparisonParticipantGet EMF model package.- Specified by:
getModelPackagein interfaceIComparisonParticipant- Returns:
- the EMF model packge. Never code
null.
-
compare
public List<Long> compare(TopComparisonNode node, ComparisonContext comparisonContext, org.eclipse.core.runtime.IProgressMonitor monitor) Description copied from interface:IComparisonParticipantCompares objects contained in the specified model top node and returns a list of child nodes to be compared.- Specified by:
comparein interfaceIComparisonParticipant- Parameters:
node- the top node to run comparison for, notnullcomparisonContext- the comparison context, notnullmonitor- 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
-
createMergeContext
public MergeContext createMergeContext(TopComparisonNode node, IMergeSession mergeSession, ComparisonContext comparisonContext) Description copied from interface:IComparisonParticipantCreates merge context for an upcoming merge operation.- Specified by:
createMergeContextin interfaceIComparisonParticipant- Parameters:
node- the top node to be merged, notnullmergeSession- the current merge session, notnullcomparisonContext- the comparison context, notnull- Returns:
-
merge
public org.eclipse.core.runtime.IStatus merge(TopComparisonNode node, MergeContext context, org.eclipse.core.runtime.IProgressMonitor monitor) Description copied from interface:IComparisonParticipantMerges 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.- Specified by:
mergein interfaceIComparisonParticipant- Parameters:
node- the top node to run merge for, notnullcontext- the current merge context, notnullmonitor- the progress monitor, notnull- Returns:
- the result of the merge operation
-
getPotentialCorrespondingNodes
public List<ComparisonNode> getPotentialCorrespondingNodes(ComparisonNode node, ComparisonSide sourceSide) Description copied from interface:IComparisonParticipantReturns a list of candidate nodes for setting as corresponding to the specified node.- Specified by:
getPotentialCorrespondingNodesin interfaceIComparisonParticipant- Parameters:
node- the comparison result node to find potential correspondences for, notnullsourceSide- the source side of the correspondence, notnull- Returns:
- a list of comparison result nodes, may be empty, never
null
-
breakCorrespondence
Description copied from interface:IComparisonParticipantBreaks the correspondence for the specified node.- Specified by:
breakCorrespondencein interfaceIComparisonParticipant- Parameters:
comparisonContext- the comparison context, notnullnode- the node with the correspondence to break, notnull
-
updateComparison
public void updateComparison(ComparisonContext comparisonContext, ComparisonNode node, List<Long> newNodeIds) Description copied from interface:IComparisonParticipantUpdates comparison for the given result node. Participants could introduce their own specific logic for managing internal states on comparison update.- Specified by:
updateComparisonin interfaceIComparisonParticipant- Parameters:
comparisonContext- the comparison context, notnullnode- the node to update comparison for, notnullnewNodeIds- the list of created new node Ids to fill, notnull
-
addNewTopObjectToComparison
public TopComparisonNode addNewTopObjectToComparison(IComparisonSession comparisonSession, String mainSymlink, org.eclipse.emf.ecore.EClass eClass) Description copied from interface:IComparisonParticipantAdds a new node to the comparison for the top object. Participants could introduce their own specific logic for managing internal states on comparison update.- Specified by:
addNewTopObjectToComparisonin interfaceIComparisonParticipant- Parameters:
comparisonSession- the comparison session hosting the model, notnullmainSymlink- the symlink for the top object to add, notnulleClass- of the object ot add, notnull- Returns:
- The created result node for the object if supports.
nullotherwise.
-
combineOneSideNodes
public void combineOneSideNodes(ComparisonContext comparisonContext, ComparisonNode mainNode, ComparisonNode otherNode, List<Long> newNodeIds) Description copied from interface:IComparisonParticipantCombines the specified two one-side 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.- Specified by:
combineOneSideNodesin interfaceIComparisonParticipant- Parameters:
comparisonContext- the comparison context, notnullmainNode- the one-side MAIN node to be combined, notnullotherNode- the one-side OTHER node to be combined, notnullnewNodeIds- the list of new node Ids to fill, notnull
-
ableToBreakCorrespondence
Description copied from interface:IComparisonParticipantTells whether to able to break the correspondence for the specified node.- Specified by:
ableToBreakCorrespondencein interfaceIComparisonParticipant- Parameters:
node- the comparison node to check, notnull- Returns:
trueif it is possible to break the correspondence,falseotherwise
-
retrieveComparedObjects
public ComparedDcsObjects retrieveComparedObjects(ComparisonContext comparisonContext, ComparisonNode node) Description copied from interface:IComparisonParticipantReturns a comparedEObjects triple for the specified model node.- Specified by:
retrieveComparedObjectsin interfaceIComparisonParticipant- Parameters:
comparisonContext- the comparison context, notnullnode- the model node, cannot benull- Returns:
- the compared objects triple, never
null
-
validateMerge
public void validateMerge(IMergeSession mergeSession, ComparisonContext comparisonContext, ComparisonNode node, List<MergeValidationProblem> validationProblems) Description copied from interface:IComparisonParticipantValidates the process of merge of the specified model node.- Specified by:
validateMergein interfaceIComparisonParticipant- Parameters:
mergeSession- the merge session, notnullcomparisonContext- the comparison context, notnullnode- the model nodevalidationProblems- the list of collected validation problems to add new problem to
-
breakMainSideCorrespondence
Description copied from interface:IComparisonParticipantBreaks the main side correspondence represented by the specified model node.- Specified by:
breakMainSideCorrespondencein interfaceIComparisonParticipant- Parameters:
session- the comparison session hosting the model, can not benullnode- the node with the correspondence to break, can not benull
-
getMatchingSymlinks
public IMatchingSymlinks getMatchingSymlinks(ComparisonNode node, org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EReference reference, ComparisonSide sourceSide, String symlink, ComparisonContext comparisonContext, IMergeSession mergeSession) Description copied from interface:ISymlinkTranslationContributorReturns a "matching symlinks" object for the specified symbolic link in the specified context.- Specified by:
getMatchingSymlinksin interfaceISymlinkTranslationContributor- Parameters:
node- the comparison result node hosting theeObject- the referencing EObjectreference- the referencesourceSide- the side of the symbolic linksymlink- the symbolic link for which to get matching symlinksmergeSession- the merge session. If notnull, the resulting matching symlinks must contain an accordingly translated other symlink in case when the other object will be imported during the merge session- Returns:
- a matching symbolic links object or
nullif the context is not supported by the contributor
-
getMatchingSymlinksToTopObject
public IMatchingSymlinks getMatchingSymlinksToTopObject(ComparisonContext comparisonContext, String symlink, ComparisonSide side, IMergeSession mergeSession) Description copied from interface:ISymlinkTranslationContributorReturns matched symlinks to the top object with the given symlink on a given comparison side.- Specified by:
getMatchingSymlinksToTopObjectin interfaceISymlinkTranslationContributor- Parameters:
comparisonContext- the comparison context, cannot benullsymlink- the top object symlink to be matched, cannot benullside- the comparison side where the top object lies, cannot benullmergeSession- the merge session, can benullif no merge process run- Returns:
- the triple of matched symlinks or
nullif no matched symlinks found
-
getDefaultMustBeMerged
Description copied from interface:IComparisonParticipantReturns the default must be merged value for the given node.- Specified by:
getDefaultMustBeMergedin interfaceIComparisonParticipant- Parameters:
node- the node to get default must be merged value for, can not benullsession- the comparison session, can not benull- Returns:
- the default must be merged value or
nullif it wasn't specified
-
areDifferentEClassObjectsMergeable
protected boolean areDifferentEClassObjectsMergeable(org.eclipse.emf.ecore.EObject main, org.eclipse.emf.ecore.EObject other, ComparisonContext comparisonContext) - Overrides:
areDifferentEClassObjectsMergeablein classAbstractMdAwareComparisonParticipant
-
createImportedEObject
protected org.eclipse.emf.ecore.EObject createImportedEObject(org.eclipse.emf.ecore.EObject otherObject, IMergeSession mergeSession) - Specified by:
createImportedEObjectin classAbstractEmfBasedComparisonParticipant
-
isFeatureWithCustomMerge
protected boolean isFeatureWithCustomMerge(org.eclipse.emf.ecore.EStructuralFeature feature) - Specified by:
isFeatureWithCustomMergein classAbstractEmfBasedComparisonParticipant
-
getCustomMatcher
protected IEmfObjectMatcher getCustomMatcher(TopComparisonNode topNode, org.eclipse.emf.ecore.EReference reference, ComparisonContext comparisonContext) Description copied from class:AbstractEmfBasedComparisonParticipantReturns a custom matcher for the specified reference.- Overrides:
getCustomMatcherin classAbstractMdAwareComparisonParticipant- Parameters:
topNode- the top nodereference- the reference to get a custom matcher forcomparisonContext- the current comparison context, cannot benull- Returns:
- a custom matcher or
nullif no custom matcher can be found
-
isUnmatchableContainment
protected boolean isUnmatchableContainment(org.eclipse.emf.ecore.EReference reference) Description copied from class:AbstractEmfBasedComparisonParticipantChecks whether the specified containment feature cannot be matched by an identity-based matcher.- Overrides:
isUnmatchableContainmentin classAbstractEmfBasedComparisonParticipant- Parameters:
reference- the containment feature to check- Returns:
trueif the feature cannot be matched by an identity matcher
-
getMultiReferenceSymlinks
protected List<String> getMultiReferenceSymlinks(org.eclipse.emf.ecore.EObject contextObject, org.eclipse.emf.ecore.EReference reference, IComparisonSession session, ComparisonSide side) Description copied from class:AbstractEmfBasedComparisonParticipantReturns list of symbolic links for objects referenced by the specified multi-reference feature from the specified context object.- Overrides:
getMultiReferenceSymlinksin classAbstractEmfBasedComparisonParticipant- Parameters:
contextObject- the context object owning the feature, cannot benullreference- the multi-reference feature, cannot benullsession- the comparison session, cannot benullside- the comparison side where the context object lies, cannot benull- Returns:
- list of symbolic links, may be empty, never
null
-
getMultiReferenceValueSymlink
protected String getMultiReferenceValueSymlink(org.eclipse.emf.ecore.EObject contextObject, org.eclipse.emf.ecore.EReference reference, org.eclipse.emf.ecore.EObject eObject, IComparisonSession session, ComparisonSide side) Description copied from class:AbstractEmfBasedComparisonParticipantReturns symbolic link of the specified target object lying into collection of referencing objects specified by the given multi-reference feature.- Overrides:
getMultiReferenceValueSymlinkin classAbstractEmfBasedComparisonParticipant- Parameters:
contextObject- the context object owning the multi-reference feature, cannot benullreference- the multi-reference feature, cannot benulleObject- the object to get symbolic link for, cannot benullsession- the comparison session, cannot benullside- the comparison side where the context object lies, cannot benull- Returns:
- symbolic link or
nullin case the target object cannot be indentified by a symbolic name in the specified context object
-