Class ModelObjectAdopter

java.lang.Object
com._1c.g5.v8.dt.internal.md.extension.adopt.ModelObjectAdopter
All Implemented Interfaces:
IModelObjectAdopter

public class ModelObjectAdopter extends Object implements IModelObjectAdopter
Implementation of IModelObjectAdopter. Uses all registered IModelObjectAdopterParticipant.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    <T extends org.eclipse.emf.ecore.EObject>
    T
    adopt(T source, Version version, org.eclipse.core.runtime.IProgressMonitor monitor)
    Adopt model object from V8 configuration project to use in V8 configuration extension project.
    List<org.eclipse.emf.ecore.EObject>
    adoptAndAttach(List<org.eclipse.emf.ecore.EObject> source, IExtensionProject target, org.eclipse.core.runtime.IProgressMonitor monitor)
    Adopt a list of model objects from V8 configuration project to use in V8 configuration extension project and attach them to the target V8 extension project configuration and its BM model.
    <T extends org.eclipse.emf.ecore.EObject>
    T
    adoptAndAttach(T source, IExtensionProject target, org.eclipse.core.runtime.IProgressMonitor monitor)
    Adopt model object from V8 configuration project to use in V8 configuration extension project and attach it to the target V8 extension project configuration and its BM model.
    <T extends org.eclipse.emf.ecore.EObject>
    T
    getAdopted(T source, IExtensionProject target)
    Returns adopted object for the provided model source object from V8 configuration project, that is contained in the target V8 configuration extension project.
    <T extends org.eclipse.emf.ecore.EObject>
    T
    getSource(T adopted)
    Returns source native object for the provided model adopted object from V8 configuration extension project.
    boolean
    isAdoptable(org.eclipse.emf.ecore.EObject object)
    Returns whether the provided model object may be adopted by this adopter.
    boolean
    isAdopted(org.eclipse.emf.ecore.EObject source, IExtensionProject target)
    Returns whether the given source object is already adopted to the target V8 configuration extension project.
    boolean
    isUpdatable(org.eclipse.emf.ecore.EObject source, IExtensionProject target)
    Returns whether the given source object may be updated after adoption to the target V8 configuration extension project.
    <T extends org.eclipse.emf.ecore.EObject>
    T
    updateAdopted(T source, IExtensionProject target, org.eclipse.core.runtime.IProgressMonitor monitor)
    Updates according adopted model object for the provided source object in the target V8 configuration extension project.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ModelObjectAdopter

      public ModelObjectAdopter()
  • Method Details

    • adopt

      public <T extends org.eclipse.emf.ecore.EObject> T adopt(T source, Version version, org.eclipse.core.runtime.IProgressMonitor monitor)
      Description copied from interface: IModelObjectAdopter
      Adopt model object from V8 configuration project to use in V8 configuration extension project. Returned object is not attached to BM model even if the source object is attached. Original source object remains unchanged during adoption.

      The provided source object will be adopted by by itself, without children or parents or related objects.

      Clients may adopt objects and attach it manually:

      1. Adopt object from parent V8 configuration project, that client want to use in extension project.
      2. Attach it to the required V8 configuration extension project manually.
      Specified by:
      adopt in interface IModelObjectAdopter
      Parameters:
      source - the model object to adopt, cannot be null
      version - the version of the 1C:Enterprise runtime, cannot be null
      monitor - the progress monitor to report progress and check cancellation status, or null if progress reporting is not desired
      Returns:
      an adopted object, never null
    • adoptAndAttach

      public <T extends org.eclipse.emf.ecore.EObject> T adoptAndAttach(T source, IExtensionProject target, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
      Description copied from interface: IModelObjectAdopter
      Adopt model object from V8 configuration project to use in V8 configuration extension project and attach it to the target V8 extension project configuration and its BM model. Original source object remains unchanged during adoption.

      If the provided source object is top object of the V8 configuration (Catalog or Document for example), then it will be attached to the target project by itself, without children. If the provided source object is not a top object of the V8 configuration (Attribute or Command for example), then it will be adopted with all its parents up to the top object (if they are not adopted yet).

      Also, some model object adoption may cause other related model objects adoption: for example Catalog Attribute with reference type to other model object will cause this related object adoption and attachment.

      Examples of model object adoption scenarios:

      • If clients adopts Catalog to the target extension project, only this Catalog will be adopted the target extension configuration without any children.
      • If clients adopts Catalog Attribute with primitive type to the target extension project, then this Attribute parent Catalog will be adopted with this Attribute as children.
      • If clients adopts Catalog Attribute with reference type to some Document to the target extension project, then this Document will be adopted adn this Attribute parent Catalog will be adopted with this Attribute as children.

      Returns the adopted object, attached to the target project.

      Specified by:
      adoptAndAttach in interface IModelObjectAdopter
      Parameters:
      source - the model object to adopt, cannot be null
      target - the target V8 extension configuration project, cannot be null
      monitor - the progress monitor to report progress and check cancellation status, or null if progress reporting is not desired
      Returns:
      an adopted object, never null
      Throws:
      org.eclipse.core.runtime.CoreException - if the adoption or attachment error occurred
    • adoptAndAttach

      public List<org.eclipse.emf.ecore.EObject> adoptAndAttach(List<org.eclipse.emf.ecore.EObject> source, IExtensionProject target, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
      Description copied from interface: IModelObjectAdopter
      Adopt a list of model objects from V8 configuration project to use in V8 configuration extension project and attach them to the target V8 extension project configuration and its BM model. Original source objects remains unchanged during adoption. See IModelObjectAdopter.adoptAndAttach(EObject, IExtensionProject, IProgressMonitor) for examples of model object adoption process.

      Returns a list of adopted objects in the same order, attached to the target project.

      Specified by:
      adoptAndAttach in interface IModelObjectAdopter
      Parameters:
      source - a list of model objects to adopt, cannot be null
      target - the target V8 extension configuration project, cannot be null
      monitor - the progress monitor to report progress and check cancellation status, or null if progress reporting is not desired
      Returns:
      a list of adopted objects in the same order, never null
      Throws:
      org.eclipse.core.runtime.CoreException - if the adoption or attachment error occurred
    • getAdopted

      public <T extends org.eclipse.emf.ecore.EObject> T getAdopted(T source, IExtensionProject target)
      Description copied from interface: IModelObjectAdopter
      Returns adopted object for the provided model source object from V8 configuration project, that is contained in the target V8 configuration extension project.

      May return null if the provided object is not adopted yet to the target project.

      Specified by:
      getAdopted in interface IModelObjectAdopter
      Parameters:
      source - the model object to get adopted for, cannot be null
      target - the target V8 extension configuration project, cannot be null
      Returns:
      the adopted object for the provided model source object that is contained in the target project, or null if not adopted yet
    • getSource

      public <T extends org.eclipse.emf.ecore.EObject> T getSource(T adopted)
      Description copied from interface: IModelObjectAdopter
      Returns source native object for the provided model adopted object from V8 configuration extension project. Result source object will belong to parent configuration project.

      May return null if the provided object extension project has no parent or source object not found in parent project.

      Specified by:
      getSource in interface IModelObjectAdopter
      Parameters:
      adopted - the model object to get source for, cannot be null
      Returns:
      source object for the provided model adopted object from V8 configuration extension project or null if not found
    • isAdopted

      public boolean isAdopted(org.eclipse.emf.ecore.EObject source, IExtensionProject target)
      Description copied from interface: IModelObjectAdopter
      Returns whether the given source object is already adopted to the target V8 configuration extension project.
      Specified by:
      isAdopted in interface IModelObjectAdopter
      Parameters:
      source - the model object to check, cannot be null
      target - the target V8 extension configuration project, cannot be null
      Returns:
      whether the given source object is already adopted to the target V8 configuration extension project
    • isUpdatable

      public boolean isUpdatable(org.eclipse.emf.ecore.EObject source, IExtensionProject target)
      Description copied from interface: IModelObjectAdopter
      Returns whether the given source object may be updated after adoption to the target V8 configuration extension project.
      Specified by:
      isUpdatable in interface IModelObjectAdopter
      Parameters:
      source - the model object to check, cannot be null
      target - the target V8 extension configuration, cannot be null
      Returns:
      whether the given source object may be updated after adoption to the target V8 configuration extension project
    • updateAdopted

      public <T extends org.eclipse.emf.ecore.EObject> T updateAdopted(T source, IExtensionProject target, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
      Description copied from interface: IModelObjectAdopter
      Updates according adopted model object for the provided source object in the target V8 configuration extension project. Adopted object will be updated according to the provided source object state. Original source object remains unchanged during adopted object update.
      Specified by:
      updateAdopted in interface IModelObjectAdopter
      Parameters:
      source - the model object to update adopted object for, cannot be null
      target - the target V8 extension configuration project, cannot be null
      monitor - the progress monitor to report progress and check cancellation status, or null if progress reporting is not desired
      Returns:
      returns the updated according adopted model object, never null
      Throws:
      org.eclipse.core.runtime.CoreException - if the update error occurred
    • isAdoptable

      public boolean isAdoptable(org.eclipse.emf.ecore.EObject object)
      Returns whether the provided model object may be adopted by this adopter. Internal bundle-scoped API method.
      Parameters:
      object - the model object to check adopting ability, cannot be null
      Returns:
      whether the provided model object may be adopted by this adopter. Internal API method