Class DtProjectDataSource

java.lang.Object
com._1c.g5.v8.dt.internal.compare.datasource.DtProjectDataSource
All Implemented Interfaces:
IComparisonDataSource
Direct Known Subclasses:
ActiveDtProjectDataSource, LibraryComparisonDataSource, OverlayComparisonDataSource

public class DtProjectDataSource extends Object implements IComparisonDataSource
A comparison data source for any supported type of the project
  • Field Details

    • symbolicNameService

      protected ISymbolicNameService symbolicNameService
      the symbolic name service
  • Constructor Details

  • Method Details

    • beginTransaction

      public IComparisonDataSourceTransaction beginTransaction()
      Description copied from interface: IComparisonDataSource
      Begins the data source operation transaction.
      Specified by:
      beginTransaction in interface IComparisonDataSource
      Returns:
      The newly started transaction. Cannot be null
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • fileExists

      public boolean fileExists(Path path)
      Description copied from interface: IComparisonDataSource
      Checks whether a file for the specified path exists.
      Specified by:
      fileExists in interface IComparisonDataSource
      Parameters:
      path - the specified path to check the existence for, cannot be null
      Returns:
      true if the file exists, false otherwise
    • getBmModel

      public IBmModel getBmModel()
      Description copied from interface: IComparisonDataSource
      Gets the BM model associated with the source
      Specified by:
      getBmModel in interface IComparisonDataSource
      Returns:
      The BM model instance. May not be null
    • getCollectionSymlinks

      public List<String> getCollectionSymlinks(org.eclipse.emf.ecore.EObject context, org.eclipse.emf.ecore.EReference collectionReference, org.eclipse.xtext.scoping.IScopeProvider scopeProvider)
      Description copied from interface: IComparisonDataSource
      Returns a list of symbolic links for objects owned by this data source and referenced by the specified multi-reference from the specified context object.
      Specified by:
      getCollectionSymlinks in interface IComparisonDataSource
      Parameters:
      context - the referencing object, not null
      collectionReference - the referencing feature, not null, must be multi-reference
      scopeProvider - the scope provider
      Returns:
      a list of symbolic links, never null
    • getDistributionDescription

      public DistributionDescription getDistributionDescription()
      Description copied from interface: IComparisonDataSource
      Returns the distribution support information for this data source.
      Specified by:
      getDistributionDescription in interface IComparisonDataSource
      Returns:
      the distribution support information or null if no information for this data source was specified
    • getDtProject

      public IDtProject getDtProject()
      Description copied from interface: IComparisonDataSource
      Gets the IDtProject instance associated with this data source and related to the project being represented by this source
      Specified by:
      getDtProject in interface IComparisonDataSource
      Returns:
      The IDtProject instance. May not be null
    • getFileListRecursively

      public List<Path> getFileListRecursively(Path path)
      Description copied from interface: IComparisonDataSource
      Returns the file list for given folder path and all its subfolders.
      Specified by:
      getFileListRecursively in interface IComparisonDataSource
      Parameters:
      path - the relative folder path to get the file list for, can not be null
      Returns:
      the list of relative file paths, never null
    • getFileStream

      public InputStream getFileStream(Path path)
      Description copied from interface: IComparisonDataSource
      Returns a file stream for the specified path.
      Specified by:
      getFileStream in interface IComparisonDataSource
      Parameters:
      path - the string with the path
      Returns:
      the input stream
    • getModelEditingSupport

      public IModelEditingSupport getModelEditingSupport()
      Description copied from interface: IComparisonDataSource
      Returns the model editing support provider for this data source.
      Specified by:
      getModelEditingSupport in interface IComparisonDataSource
      Returns:
      the model editing support provider or null if no provider for this data source was specified
    • getPath

      public String getPath(String symlink, org.eclipse.emf.ecore.EClass eClass)
      Returns the file path for the specified top-level MD object
      Specified by:
      getPath in interface IComparisonDataSource
      Parameters:
      symlink - the symlink of the top-level MD object
      eClass - TODO
      Returns:
      a string with the relative path of the MD object, may be null
    • getProjectName

      public String getProjectName()
      Description copied from interface: IComparisonDataSource
      Returns project name for this data source.
      Specified by:
      getProjectName in interface IComparisonDataSource
      Returns:
      the project name, never null
    • getProjectNature

      public String getProjectNature()
      Description copied from interface: IComparisonDataSource
      Returns the stored project nature.
      Specified by:
      getProjectNature in interface IComparisonDataSource
      Returns:
      the stored project nature, may be ICoreConstants.V8_CONFIGURATION_NATURE or ICoreConstants.V8_EXTENSION_NATURE or ICoreConstants.V8_EXTERNAL_OBJECTS_NATURE or null if the data source does not store V8 project
    • getSymlink

      public String getSymlink(org.eclipse.emf.ecore.EObject context, org.eclipse.emf.ecore.EReference reference, org.eclipse.emf.ecore.EObject eObject, org.eclipse.xtext.scoping.IScopeProvider scopeProvider)
      Description copied from interface: IComparisonDataSource
      Returns a symbolic link for an object owned by this data source.
      Specified by:
      getSymlink in interface IComparisonDataSource
      Parameters:
      context - the referencing object, not null
      reference - the reference feature, not null
      eObject - the referenced object, not null
      scopeProvider - the scope provider
      Returns:
      the symbolic link, never null
    • getSymlink

      public String getSymlink(org.eclipse.emf.ecore.EObject context, org.eclipse.emf.ecore.EReference reference, org.eclipse.xtext.scoping.IScopeProvider scopeProvider)
      Description copied from interface: IComparisonDataSource
      Returns a symbolic link for an object owned by this data source, as defined by a single reference from a context object.
      Specified by:
      getSymlink in interface IComparisonDataSource
      Parameters:
      context - the referencing object, not null
      reference - the referencing feature, not null, must be single reference
      scopeProvider - the scope provider
      Returns:
      the symbolic link, never null
    • getSymlinksOfTopObjects

      public Map<org.eclipse.emf.ecore.EClass,List<String>> getSymlinksOfTopObjects(org.eclipse.xtext.scoping.IScopeProvider scopeProvider, List<org.eclipse.emf.ecore.EClass> eClasses)
      Description copied from interface: IComparisonDataSource
      Gets all top level object symlinks for a given set of EClass'es. If this data source is associated with Configuration-aware project, the order of the returned instances will be the same as in the corresponding collection of the Configuration.
      Specified by:
      getSymlinksOfTopObjects in interface IComparisonDataSource
      Parameters:
      scopeProvider - the scope provider for symbolic links, cannot be null
      eClasses - the given set of EClass'es, may be null
      Returns:
      all top level object symlinks for a given set of EClass'es, never null
    • getTargetRuntimeVersion

      public Version getTargetRuntimeVersion()
      Description copied from interface: IComparisonDataSource
      Gets the target runtime version for the project behind this source
      Specified by:
      getTargetRuntimeVersion in interface IComparisonDataSource
      Returns:
      The version of the target 1C runtime. Cannot be null
    • getTopLevelObject

      public org.eclipse.emf.ecore.EObject getTopLevelObject(String symlink, org.eclipse.emf.ecore.EClass eClass)
      Description copied from interface: IComparisonDataSource
      Returns a top-level MD object by the specified symbolic link.
      Specified by:
      getTopLevelObject in interface IComparisonDataSource
      Parameters:
      symlink - the symbolic link (FQN) of the MD object, not null; an exception will be thrown for an invalid or a non-top object argument
      eClass - The EClass that defines the context of the symlink resolution, may be null
      Returns:
      the object, never null
    • getType

      public DataSourceType getType()
      Description copied from interface: IComparisonDataSource
      Gets the type of the data source.
      Specified by:
      getType in interface IComparisonDataSource
      Returns:
      The type of the data source. May not be null
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • isOverlayOf

      public boolean isOverlayOf(IComparisonDataSource comparisonDataSource)
      Description copied from interface: IComparisonDataSource
      Checks if this data source overlays the provided source. Used to syncrhonize the data in case of underlying data source data changes
      Specified by:
      isOverlayOf in interface IComparisonDataSource
      Returns:
    • prepareTopObjectInfos

      public void prepareTopObjectInfos(List<TopObjectInfo> topObjectInfos)
      Description copied from interface: IComparisonDataSource
      Prepares information for the specified top objects. Deletes top object info if the referenced top object doesn't exist in the data source.
      Specified by:
      prepareTopObjectInfos in interface IComparisonDataSource
      Parameters:
      topObjectInfos - the list of top object information containers, cannot be null
    • startIfNecessary

      public final void startIfNecessary(org.eclipse.core.runtime.IProgressMonitor progressMonitor)
      Description copied from interface: IComparisonDataSource
      Starts the data source in the flow of the comparison session creation. Implementation should take care about multiple attempts of start request being submitted to the data source
      Specified by:
      startIfNecessary in interface IComparisonDataSource
      Parameters:
      progressMonitor - Progress monitor of a start sequence. May not be null
    • stop

      public final void stop()
      Description copied from interface: IComparisonDataSource
      Stops the data source in the flow of the comprison session closure. Should be failure-proof to not hinder othe sources sequential stops
      Specified by:
      stop in interface IComparisonDataSource
    • synchronize

      public void synchronize(org.eclipse.core.runtime.IProgressMonitor progressMonitor)
      Description copied from interface: IComparisonDataSource
      Synchronizes the data source with external changes being made to this source. Until this method call the data source should store any change tasks without applying
      Specified by:
      synchronize in interface IComparisonDataSource
      Parameters:
      progressMonitor - Progress monitor of a update/synchronization sequence. May not be null
    • topObjectExists

      public boolean topObjectExists(String symlink, org.eclipse.emf.ecore.EClass eClass)
      Description copied from interface: IComparisonDataSource
      Checks if the referenced top object exists in the data source. The implementation of this method should be as quick as possible.
      Specified by:
      topObjectExists in interface IComparisonDataSource
      Parameters:
      symlink - The symlink to check existence for.
      eClass - The eClass of expected object.
      Returns:
      True if the data source is able to retrieve referenced object; false otherwise.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getObjectById

      public org.eclipse.emf.ecore.EObject getObjectById(long id)
      Description copied from interface: IComparisonDataSource
      Returns an object by the specified Id.
      Specified by:
      getObjectById in interface IComparisonDataSource
      Parameters:
      id - the Id
      Returns:
      the object found or null
    • getTopObjectIdByFqn

      public long getTopObjectIdByFqn(String fqn)
      Description copied from interface: IComparisonDataSource
      Gets top-level object Id by FQN.
      Specified by:
      getTopObjectIdByFqn in interface IComparisonDataSource
      Parameters:
      fqn - the FQN to get Id by, may not be null
      Returns:
      the Id or -1L if there is no object with the specified FQN
    • getSourceProvider

      public IExtendedProjectSourceProvider getSourceProvider()
      Gets the associated source provider
      Returns:
      IExtendedProjectSourceProvider provider. May not be null
    • onStart

      protected void onStart(org.eclipse.core.runtime.IProgressMonitor progressMonitor)
      Prepares the data of the source (like import, etc)
      Parameters:
      progressMonitor - The progress monitor to control the process. May not be null
    • onStop

      protected void onStop()
      Clears all the data for the source (like internal model, etc)
      Parameters:
      progressMonitor - The progress monitor to control the process. May not be null
    • setBmModel

      protected final void setBmModel(IBmModel bmModel)
      Sets the BM model associated with the data source. Should be called during the start sequence of the data source