Interface IModelObjectAdopter


  • public interface IModelObjectAdopter
    Adopter for model objects. May be used to adopt model object to use in V8 configuration extension project. Adopted model objects in extension projects may be used to set as checked or modify original model object properties when extension will be applied to the configuration in the 1C:Enterprise runtime.
    See Also:
    IModelObjectAdopterParticipant
    Restriction:
    This interface is not intended to be extended by clients.
    Restriction:
    This interface is not intended to be implemented by clients.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void addAdoptChangeListener​(IAdoptEventListener listener)
      Adds adopt process status listener.
      <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.
      void fireAdoptEvent​(Form form, AdoptStatus status)
      Trigger event on adopt process
      <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 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.
      void removeAdoptChangeListener​(IAdoptEventListener listener)
      Remove event listener
      <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.
    • Method Detail

      • adopt

        <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. 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.
        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
        Throws:
        IllegalArgumentException - if the provided source object cannot be adopted
      • adoptAndAttach

        <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
        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.

        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:
        IllegalArgumentException - if the provided source object cannot be adopted
        org.eclipse.core.runtime.CoreException - if the adoption or attachment error occurred
      • adoptAndAttach

        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
        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 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.

        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

        <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.

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

        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
        Throws:
        IllegalArgumentException - if the provided source object cannot be adopted
      • getSource

        <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. 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.

        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
        Throws:
        IllegalArgumentException - if the provided source object is not contained in extension project
      • isAdopted

        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.
        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
        Throws:
        IllegalArgumentException - if the provided source object cannot be adopted
      • isUpdatable

        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.
        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
        Throws:
        IllegalArgumentException - if the provided source object cannot be adopted
      • updateAdopted

        <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
        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.
        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:
        IllegalArgumentException - when:
        • the provided source object cannot be adopted
        • the provided source object can be adopted but it is not adopted yet
        • the provided source object cannot be updated after adoption
        org.eclipse.core.runtime.CoreException - if the update error occurred
      • addAdoptChangeListener

        void addAdoptChangeListener​(IAdoptEventListener listener)
        Adds adopt process status listener.
        Parameters:
        listener - event listener, never null
      • fireAdoptEvent

        void fireAdoptEvent​(Form form,
                            AdoptStatus status)
        Trigger event on adopt process
        Parameters:
        form - form to be adopted, never null
        status - adopt process status, never null
      • removeAdoptChangeListener

        void removeAdoptChangeListener​(IAdoptEventListener listener)
        Remove event listener
        Parameters:
        listener - the event listener to remove (not null)