Class SolidResourceComparisonParticipant

java.lang.Object
com._1c.g5.v8.dt.internal.compare.SolidResourceComparisonParticipant
All Implemented Interfaces:
IComparisonParticipant

public class SolidResourceComparisonParticipant extends Object implements IComparisonParticipant
A comparison participant for comparing and merging objects as solid resources. Used for objects for which honest model comparison is not currently supported.
  • Constructor Details

    • SolidResourceComparisonParticipant

      public SolidResourceComparisonParticipant()
  • Method Details

    • supports

      public boolean supports(ComparisonNode node)
      Description copied from interface: IComparisonParticipant
      Indicates whether the participant supports comparison and merging of the specified node.
      Specified by:
      supports in interface IComparisonParticipant
      Parameters:
      node - the node, not null
      Returns:
      true if the participant supports comparison and merging, false otherwise
    • getModelPackage

      public org.eclipse.emf.ecore.EPackage getModelPackage()
      Description copied from interface: IComparisonParticipant
      Get EMF model package.
      Specified by:
      getModelPackage in interface IComparisonParticipant
      Returns:
      the EMF model packge. Never code null.
    • clear

      public void clear()
      Description copied from interface: IComparisonParticipant
      Clears the participant caches.
      Specified by:
      clear in interface IComparisonParticipant
    • compare

      public List<Long> compare(TopComparisonNode node, ComparisonContext comparisonContext, org.eclipse.core.runtime.IProgressMonitor monitor)
      Description copied from interface: IComparisonParticipant
      Compares objects contained in the specified model top node and returns a list of child nodes to be compared.
      Specified by:
      compare in interface IComparisonParticipant
      Parameters:
      node - the top node to run comparison for, not null
      comparisonContext - the comparison context, not null
      monitor - the progress monitor, can be null. 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
    • validateMerge

      public void validateMerge(IMergeSession mergeSession, ComparisonContext comparisonContext, ComparisonNode node, List<MergeValidationProblem> validationProblems)
      Description copied from interface: IComparisonParticipant
      Validates the process of merge of the specified model node.
      Specified by:
      validateMerge in interface IComparisonParticipant
      Parameters:
      mergeSession - the merge session, not null
      comparisonContext - the comparison context, not null
      node - the model node
      validationProblems - the list of collected validation problems to add new problem to
    • createMergeContext

      public MergeContext createMergeContext(TopComparisonNode node, IMergeSession mergeSession, ComparisonContext comparisonContext)
      Description copied from interface: IComparisonParticipant
      Creates merge context for an upcoming merge operation.
      Specified by:
      createMergeContext in interface IComparisonParticipant
      Parameters:
      node - the top node to be merged, not null
      mergeSession - the current merge session, not null
      comparisonContext - the comparison context, not null
      Returns:
    • merge

      public org.eclipse.core.runtime.IStatus merge(TopComparisonNode node, MergeContext context, org.eclipse.core.runtime.IProgressMonitor monitor)
      Description copied from interface: IComparisonParticipant
      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.
      Specified by:
      merge in interface IComparisonParticipant
      Parameters:
      node - the top node to run merge for, not null
      context - the current merge context, not null
      monitor - the progress monitor, not null
      Returns:
      the result of the merge operation
    • getPotentialCorrespondingNodes

      public List<ComparisonNode> getPotentialCorrespondingNodes(ComparisonNode node, ComparisonSide sourceSide)
      Description copied from interface: IComparisonParticipant
      Returns a list of candidate nodes for setting as corresponding to the specified node.
      Specified by:
      getPotentialCorrespondingNodes in interface IComparisonParticipant
      Parameters:
      node - the comparison result node to find potential correspondences for, not null
      sourceSide - the source side of the correspondence, not null
      Returns:
      a list of comparison result nodes, may be empty, never null
    • onChildrenMerged

      public void onChildrenMerged(TopComparisonNode node, MergeContext context)
      Description copied from interface: IComparisonParticipant
      Called when the child nodes of the specified top node have been merged.
      Specified by:
      onChildrenMerged in interface IComparisonParticipant
      Parameters:
      node - the top node, not null
      context - Current merge operation context, not null
    • breakCorrespondence

      public void breakCorrespondence(ComparisonContext comparisonContext, ComparisonNode node)
      Description copied from interface: IComparisonParticipant
      Breaks the correspondence for the specified node.
      Specified by:
      breakCorrespondence in interface IComparisonParticipant
      Parameters:
      comparisonContext - the comparison context, not null
      node - the node with the correspondence to break, not null
    • updateComparison

      public void updateComparison(ComparisonContext comparisonContext, ComparisonNode node, List<Long> newNodeIds)
      Description copied from interface: IComparisonParticipant
      Updates comparison for the given result node. Participants could introduce their own specific logic for managing internal states on comparison update.
      Specified by:
      updateComparison in interface IComparisonParticipant
      Parameters:
      comparisonContext - the comparison context, not null
      node - the node to update comparison for, not null
      newNodeIds - the list of created new node Ids to fill, not null
    • addNewTopObjectToComparison

      public TopComparisonNode addNewTopObjectToComparison(IComparisonSession comparisonSession, String mainSymlink, org.eclipse.emf.ecore.EClass eClass)
      Description copied from interface: IComparisonParticipant
      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.
      Specified by:
      addNewTopObjectToComparison in interface IComparisonParticipant
      Parameters:
      comparisonSession - the comparison session hosting the model, not null
      mainSymlink - the symlink for the top object to add, not null
      eClass - of the object ot add, not null
      Returns:
      The created result node for the object if supports. null otherwise.
    • combineOneSideNodes

      public void combineOneSideNodes(ComparisonContext comparisonContext, ComparisonNode mainNode, ComparisonNode otherNode, List<Long> newNodeIds)
      Description copied from interface: IComparisonParticipant
      Combines 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:
      combineOneSideNodes in interface IComparisonParticipant
      Parameters:
      comparisonContext - the comparison context, not null
      mainNode - the one-side MAIN node to be combined, not null
      otherNode - the one-side OTHER node to be combined, not null
      newNodeIds - the list of new node Ids to fill, not null
    • ableToBreakCorrespondence

      public boolean ableToBreakCorrespondence(ComparisonNode node)
      Description copied from interface: IComparisonParticipant
      Tells whether to able to break the correspondence for the specified node.
      Specified by:
      ableToBreakCorrespondence in interface IComparisonParticipant
      Parameters:
      node - the comparison node to check, not null
      Returns:
      true if it is possible to break the correspondence, false otherwise
    • retrieveComparedObjects

      public IComparedObjects<?> retrieveComparedObjects(ComparisonContext comparisonContext, ComparisonNode node)
      Description copied from interface: IComparisonParticipant
      Returns a compared EObjects triple for the specified model node.
      Specified by:
      retrieveComparedObjects in interface IComparisonParticipant
      Parameters:
      comparisonContext - the comparison context, not null
      node - the model node, cannot be null
      Returns:
      the compared objects triple, never null
    • prepareRenameOperations

      public List<IRenameOnMergeOperation> prepareRenameOperations(IMergeSession mergeSession, ComparisonContext context)
      Description copied from interface: IComparisonParticipant
      Gets a list of rename operations prepared by this participant.
      Specified by:
      prepareRenameOperations in interface IComparisonParticipant
      Parameters:
      mergeSession - the merge session, not null
      context - the comparison context, not null
      Returns:
      the list of rename operations, never null
    • adoptExternalProperty

      public boolean adoptExternalProperty(IComparisonSession session, ExternalPropertyComparisonData extPropData)
      Description copied from interface: IComparisonParticipant
      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.
      Specified by:
      adoptExternalProperty in interface IComparisonParticipant
      Parameters:
      session - the comparison session, not null
      extPropData - the data of the external property to be adopted, cannot be null
      Returns:
      true if adopting is possible, false otherwise
    • supportsPrioritizedMerging

      public boolean supportsPrioritizedMerging(ComparisonNode node, IComparisonSession session)
      Description copied from interface: IComparisonParticipant
      Tells whether the given node supports prioritized merging.
      Specified by:
      supportsPrioritizedMerging in interface IComparisonParticipant
      Parameters:
      node - the node to check, cannot be null
      session - the comparison session, cannot be null
      Returns:
      true if the node supports prioritized merging, false otherwise
    • supportsCustomMerging

      public boolean supportsCustomMerging(ComparisonNode node, IComparisonSession session)
      Description copied from interface: IComparisonParticipant
      Tells whether the given node supports custom merging.
      Specified by:
      supportsCustomMerging in interface IComparisonParticipant
      Parameters:
      node - the node to check, cannot be null
      session - the comparison session, cannot be null
      Returns:
      true if the node supports custom merging, false otherwise
    • supportsMergingUsingExternalTool

      public boolean supportsMergingUsingExternalTool(ComparisonNode node, IComparisonSession session)
      Description copied from interface: IComparisonParticipant
      Tells whether the given node supports merging using external tool.
      Specified by:
      supportsMergingUsingExternalTool in interface IComparisonParticipant
      Parameters:
      node - the comparison node to check, cannot be null
      session - the comparison session, cannot be null
      Returns:
      true if the node supports merging using external tool, false otherwise
    • breakMainSideCorrespondence

      public void breakMainSideCorrespondence(IComparisonSession session, ComparisonNode node)
      Description copied from interface: IComparisonParticipant
      Breaks the main side correspondence represented by the specified model node.
      Specified by:
      breakMainSideCorrespondence in interface IComparisonParticipant
      Parameters:
      session - the comparison session hosting the model, can not be null
      node - the node with the correspondence to break, can not be null
    • isExcludedFromComparison

      public boolean isExcludedFromComparison(org.eclipse.emf.ecore.EStructuralFeature feature, AbstractComparedEmfObjects<?> comparedContextObjects, IComparisonSession session)
      Description copied from interface: IComparisonParticipant
      Checks whether the feature must be excluded from the comparison.
      Specified by:
      isExcludedFromComparison in interface IComparisonParticipant
      Parameters:
      feature - the feature to check, cannot be null
      comparedContextObjects - the triple of compared objects, cannot be null
      session - the comparison session, cannot be null
      Returns:
      true if the feature must be excluded, false otherwise
    • getForcedDDRebuildScope

      public Map<String,IBmObject> getForcedDDRebuildScope(TopComparisonNode topNode, MergeContext context)
      Description copied from interface: IComparisonParticipant
      In case if the merge process changes the top object it should supply information about affected DDs.
      Specified by:
      getForcedDDRebuildScope in interface IComparisonParticipant
      Parameters:
      topNode - The top node of the comparison model representing the merged object, not null
      context - Current merge operation context, not null
      Returns:
      The map of the affected DD segments and corresponding objects, may be empty, never null
    • getDefaultMergeRule

      public MergeRule getDefaultMergeRule(ComparisonNode node, IComparisonSession session)
      Description copied from interface: IComparisonParticipant
      Returns the default merge rule for the given node.
      Specified by:
      getDefaultMergeRule in interface IComparisonParticipant
      Parameters:
      node - the node to get default merge rule for, can not be null
      session - the comparison session, can not be null
      Returns:
      the default merge rule or null if it wasn't specified
    • adoptMainSideFeature

      public org.eclipse.emf.ecore.EStructuralFeature adoptMainSideFeature(org.eclipse.emf.ecore.EStructuralFeature mainSideFeature, IComparisonSession session)
      Description copied from interface: IComparisonParticipant
      Converts, if possible, the main side feature into a other supported by the other side object.
      Specified by:
      adoptMainSideFeature in interface IComparisonParticipant
      Parameters:
      mainSideFeature - the main side feature to convert, cannot be null
      session - the comparison session, cannot be null
      Returns:
      the converted feature applicable for other side object or null
    • getDefaultMustBeMerged

      public Boolean getDefaultMustBeMerged(ComparisonNode node, IComparisonSession session)
      Description copied from interface: IComparisonParticipant
      Returns the default must be merged value for the given node.
      Specified by:
      getDefaultMustBeMerged in interface IComparisonParticipant
      Parameters:
      node - the node to get default must be merged value for, can not be null
      session - the comparison session, can not be null
      Returns:
      the default must be merged value or null if it wasn't specified
    • saveCustomSettings

      public void saveCustomSettings(ComparisonNode node, SerializableMergeSettings container, IComparisonSession session)
      Description copied from interface: IComparisonParticipant
      Saves custom settings for the specified node into the given merge settings container. Does nothing if the node doesn't have any custom settings.
      Specified by:
      saveCustomSettings in interface IComparisonParticipant
      Parameters:
      node - the comparison node to save custom settings for, cannot be null
      container - the container of serializable settings, cannot be null
      session - the comparison session, cannot be null
    • restoreCustomSettings

      public void restoreCustomSettings(ComparisonNode node, SerializableMergeSettings container, IComparisonSession session)
      Description copied from interface: IComparisonParticipant
      Restores custom settings for the specified node from the given merge settings container.
      Specified by:
      restoreCustomSettings in interface IComparisonParticipant
      Parameters:
      node - the comparison node to restore custom settings for, cannot be null
      container - the container of serializable settings, cannot be null
      session - the comparison session, cannot be null
    • isCandidateForPotentialMergeProblems

      public boolean isCandidateForPotentialMergeProblems(ComparisonNode node, IComparisonSession session)
      Description copied from interface: IComparisonParticipant
      Tells whether the given node may break the configuration if it is merged.
      Specified by:
      isCandidateForPotentialMergeProblems in interface IComparisonParticipant
      Parameters:
      node - the node to check, cannot be null
      session - the comparison session, cannot be null
      Returns:
      true if the node may break the configuration, false otherwise
    • getPotentialMergeProblemsDescriptions

      public List<PotentialMergeProblemDescription> getPotentialMergeProblemsDescriptions(ComparisonNode node, ComparisonContext comparisonContext)
      Description copied from interface: IComparisonParticipant
      Returns human-readable descriptions of potential merge problems if the the specified node is merged.
      Specified by:
      getPotentialMergeProblemsDescriptions in interface IComparisonParticipant
      Parameters:
      node - the node to get merge problems descriptions for, cannot be null
      comparisonContext - the comparison context, cannot be null
      Returns:
      the list of descriptions, never null, can be empty if the node doesn't bring any merge problems
    • mergeUsingExternalTool

      public ExternalMergeToolResult mergeUsingExternalTool(ComparisonNode node, ComparisonContext comparisonContext, org.eclipse.core.runtime.IProgressMonitor monitor)
      Description copied from interface: IComparisonParticipant
      Merges nodes using an external tool that are supported by this participant.
      Specified by:
      mergeUsingExternalTool in interface IComparisonParticipant
      Parameters:
      node - the comparison node, cannot be null
      comparisonContext - the comparison context, cannot be null
      monitor - the progress monitor, cannot be null
      Returns:
      the external merge tool result or null if no nodes were merged