Package com._1c.g5.v8.dt.md.copy
Class AttachingModelObjectCopier
- java.lang.Object
- 
- com._1c.g5.v8.dt.md.copy.ModelObjectCopier
- 
- com._1c.g5.v8.dt.md.copy.AttachingModelObjectCopier
 
 
- 
 public class AttachingModelObjectCopier extends ModelObjectCopier Model object copier that also attaches copied objects to the provided BM session. All created copy objects will be attached to that session. External properties will be copied as file system resources. Copier allows to copy metadata objects to different target classes, e.g. clients may copyDocumenttoCatalog, or even toCatalogAttributeand only matching attributes will be copied.AttachingModelObjectCopierinstances are stateful, they hold information about BM session to attach objects to.AttachingModelObjectCopiermay be used multiple times to copy and attach multiple objects to the same BM session.Clients may extend copier and customize copy and attach process. - See Also:
- ModelObjectCopier
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description classAttachingModelObjectCopier.SharedCopyContextThe shared context for copy process that holds information about copied objects, references, names, etc., and also is intended to be shared between copy invocations.- 
Nested classes/interfaces inherited from class com._1c.g5.v8.dt.md.copy.ModelObjectCopierModelObjectCopier.CopyContext
 
- 
 - 
Field SummaryFields Modifier and Type Field Description protected IBmEmfIndexProviderbmEmfIndexProviderprotected IBmModelbmModelprotected IBmModelManagerbmModelManagerprotected AttachingModelObjectCopier.SharedCopyContextcontextprotected IProjectFileSystemSupportProviderprojectFileSystemSupportProviderprotected org.eclipse.xtext.naming.IQualifiedNameProviderqualifiedNameProviderprotected IResourceLookupresourceLookupprotected ISymbolicNameServicesymbolicNameServiceprotected ITopObjectFqnGeneratortopObjectFqnGeneratorprotected IBmTransactiontransaction- 
Fields inherited from class com._1c.g5.v8.dt.md.copy.ModelObjectCopiereditingLanguageManager, modelFactory, PRODUCED_TYPES_FEATURE_NAME, runtimeVersionSupport, v8projectManager
 
- 
 - 
Constructor SummaryConstructors Constructor Description AttachingModelObjectCopier(IV8ProjectManager v8projectManager, IModelObjectFactory modelFactory, IRuntimeVersionSupport runtimeVersionSupport, IEditingLanguageManager editingLanguageManager, ITopObjectFqnGenerator topObjectFqnGenerator, org.eclipse.xtext.naming.IQualifiedNameProvider qualifiedNameProvider, IResourceLookup resourceLookup, IProjectFileSystemSupportProvider projectFileSystemSupportProvider, IBmModelManager bmModelManager, IBmEmfIndexManager bmEmfIndexManager, ISymbolicNameService symbolicNameService, IBmTransaction transaction, IBmModel bmModel)Constructor ofAttachingModelObjectCopier.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.eclipse.emf.ecore.EObjectattach(org.eclipse.emf.ecore.EObject copy, org.eclipse.emf.ecore.EObject parent, org.eclipse.emf.ecore.EReference reference)Attach the result model object copy using the providedparentobject reference.protected <T extends IBmObject>
 TattachExternalProperty(T externalProperty, org.eclipse.emf.ecore.EObject owner, org.eclipse.emf.ecore.EReference reference)Attach the given external property to the associated BM session.protected <T extends IBmObject>
 TattachModelObject(T original)Attach the given model object to the associated BM session.protected <T extends IBmObject>
 TattachModelObject(T original, boolean isTop)Attach the given model object to the associated BM session.protected voidcopyExternalPropertyReference(org.eclipse.emf.ecore.EObject fromObject, org.eclipse.emf.ecore.EReference fromReference, org.eclipse.emf.ecore.EObject toObject, org.eclipse.emf.ecore.EReference toReference, ModelObjectCopier.CopyContext context, boolean resolveProxies, boolean useOriginalReferences)Copy the model object external property reference feature.protected voidcopyExternalPropertyResource(ModelObjectCopier.CopyContext context, org.eclipse.core.resources.IProject projectFrom, org.eclipse.core.resources.IProject projectTo, IProjectFileSystemSupport projectFileSystemSupportTo, IProjectFileSystemSupport projectFileSystemSupportFrom, org.eclipse.emf.ecore.EObject owner, org.eclipse.emf.ecore.EReference reference, org.eclipse.emf.ecore.EObject externalProperty)Copies the provided external property resource file to the target file location and attaches it to the associated BM session.protected voidcopyReference(org.eclipse.emf.ecore.EObject fromObject, org.eclipse.emf.ecore.EReference fromReference, org.eclipse.emf.ecore.EObject toObject, org.eclipse.emf.ecore.EReference toReference, ModelObjectCopier.CopyContext context, boolean resolveProxies, boolean useOriginalReferences)Copy the model object non-containment reference feature.protected ObjectcopyReferenceAsProxy(org.eclipse.core.resources.IProject fromProject, org.eclipse.emf.ecore.EObject fromObject, org.eclipse.emf.ecore.EReference fromReference, org.eclipse.core.resources.IProject toProject, org.eclipse.emf.ecore.EObject toObject, org.eclipse.emf.ecore.EReference toReference, ModelObjectCopier.CopyContext context)Copy the model object non-containment reference feature as proxy in the associated BM session project.protected voidcopyReferenceField(org.eclipse.emf.ecore.EObject fromObject, org.eclipse.emf.ecore.EReference fromReference, org.eclipse.emf.ecore.EObject toObject, org.eclipse.emf.ecore.EReference toReference, ModelObjectCopier.CopyContext context, boolean resolveProxies, boolean useOriginalReferences)Copy the model object non-containment reference feature of theFieldtype.protected voidcopyReferenceFields(org.eclipse.emf.ecore.EObject fromObject, org.eclipse.emf.ecore.EReference fromReference, org.eclipse.emf.ecore.EObject toObject, org.eclipse.emf.ecore.EReference toReference, ModelObjectCopier.CopyContext context, boolean resolveProxies, boolean useOriginalReferences)Copy the model object non-containment reference feature of theFieldtype.protected voidcopyReferences(ModelObjectCopier.CopyContext context, org.eclipse.emf.ecore.EObject parent, boolean resolveProxies, boolean useOriginalReferences)Copy all references in the providedCopyContextcopies.protected voidcopyReferenceTypeDescription(TypeDescription typeDescription, org.eclipse.emf.ecore.EReference fromReference, org.eclipse.emf.ecore.EObject copyEObject, org.eclipse.emf.ecore.EReference toReference, ModelObjectCopier.CopyContext context, boolean resolveProxies, boolean useOriginalReferences)Copy the model object non-containment reference feature from the type description object.protected voidcopyResource(org.eclipse.core.resources.IFile fromFile, org.eclipse.core.resources.IFile toFile)Copies the provided resource file to the target file location.protected voidcopySourceAsReferenceType(org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EObject copyObject, org.eclipse.emf.ecore.EReference toReference, ModelObjectCopier.CopyContext context)Copy the source object as reference to source type in the terms of V8 metadata model.protected ModelObjectCopier.CopyContextcreateContext(org.eclipse.emf.ecore.EClass toClass)Creates copy context.protected ModelObjectCopier.CopyContextcreateContext(org.eclipse.emf.ecore.EObject parent, org.eclipse.emf.ecore.EReference reference)Creates copy context.protected org.eclipse.emf.ecore.EObjectcreateProxy(org.eclipse.core.resources.IProject sourceProject, org.eclipse.emf.ecore.EObject sourceParent, org.eclipse.emf.ecore.EObject source, org.eclipse.core.resources.IProject targetProject, org.eclipse.emf.ecore.EObject targetParent, org.eclipse.emf.ecore.EReference targetReference, ModelObjectCopier.CopyContext context)Create proxy of the source object in the target project.protected StringgenerateExternalPropertyFqn(IBmObject externalProperty, org.eclipse.emf.ecore.EObject owner, org.eclipse.emf.ecore.EReference reference)Generate and external property FQN.protected StringgenerateMdCopyName(MdObject sourceObject, MdObject targetObject, org.eclipse.emf.ecore.EObject targetParent, org.eclipse.emf.ecore.EReference reference, ModelObjectCopier.CopyContext copyContext)Generate copied model metadata object name.- 
Methods inherited from class com._1c.g5.v8.dt.md.copy.ModelObjectCopiercopy, copy, copy, copy, copyAccountingFlag, copyAttribute, copyAttributeValue, copyCollection, copyContainment, copyExternalDataSourceSubObjects, copyFeatureMap, copyHelp, copyMdName, copyReferences, copyReferenceSubsystem, createCopy, getName, getTarget, getTarget, isChanged, isExternalProperty, isFormReference, isGraphicalSchemeReference, isHtmlDocumentTemplateReference, isNotAnnotatedExternalResource, isRightsReference, isStyleReference, nameExists, shouldCopyAttribute, shouldCopyContainment, shouldCopyExternalPropertyReference, shouldCopyReference
 
- 
 
- 
- 
- 
Field Detail- 
topObjectFqnGeneratorprotected final ITopObjectFqnGenerator topObjectFqnGenerator 
 - 
qualifiedNameProviderprotected final org.eclipse.xtext.naming.IQualifiedNameProvider qualifiedNameProvider 
 - 
resourceLookupprotected final IResourceLookup resourceLookup 
 - 
projectFileSystemSupportProviderprotected final IProjectFileSystemSupportProvider projectFileSystemSupportProvider 
 - 
bmModelManagerprotected final IBmModelManager bmModelManager 
 - 
bmEmfIndexProviderprotected final IBmEmfIndexProvider bmEmfIndexProvider 
 - 
transactionprotected final IBmTransaction transaction 
 - 
bmModelprotected final IBmModel bmModel 
 - 
symbolicNameServiceprotected final ISymbolicNameService symbolicNameService 
 - 
contextprotected final AttachingModelObjectCopier.SharedCopyContext context 
 
- 
 - 
Constructor Detail- 
AttachingModelObjectCopierpublic AttachingModelObjectCopier(IV8ProjectManager v8projectManager, IModelObjectFactory modelFactory, IRuntimeVersionSupport runtimeVersionSupport, IEditingLanguageManager editingLanguageManager, ITopObjectFqnGenerator topObjectFqnGenerator, org.eclipse.xtext.naming.IQualifiedNameProvider qualifiedNameProvider, IResourceLookup resourceLookup, IProjectFileSystemSupportProvider projectFileSystemSupportProvider, IBmModelManager bmModelManager, IBmEmfIndexManager bmEmfIndexManager, ISymbolicNameService symbolicNameService, IBmTransaction transaction, IBmModel bmModel) Constructor ofAttachingModelObjectCopier.- Parameters:
- v8projectManager- the V8 project manager, cannot be- null
- modelFactory- the model object factory, cannot be- null
- runtimeVersionSupport- the 1C:Enterprise runtime version support, cannot be- null
- editingLanguageManager- the editing language manager, cannot be- null
- topObjectFqnGenerator- the top object FQN generator, cannot be- null
- qualifiedNameProvider- the qualified name provider, cannot be- null
- resourceLookup- the resource lookup, cannot be- null
- projectFileSystemSupportProvider- the project filesystem support provider, cannot be- null
- bmModelManager- the BM model manager, cannot be- null
- bmEmfIndexManager- the BM model EMF index manager, cannot be- null
- transaction- the transaction to perform copying within, cannot be- null
- bmModel- the target BM model, cannot be- null
- symbolicNameService- symbolic name service for getting- URI, can't be- null
 
 
- 
 - 
Method Detail- 
attachprotected org.eclipse.emf.ecore.EObject attach(org.eclipse.emf.ecore.EObject copy, org.eclipse.emf.ecore.EObject parent, org.eclipse.emf.ecore.EReference reference)Attach the result model object copy using the providedparentobject reference. Returns attached object. Method is called after source object copy and before its references copy.Attaching copier implementation also attaches result object copy to the BM session. - Overrides:
- attachin class- ModelObjectCopier
- Parameters:
- copy- the model object copy to attach, cannot be- null
- parent- the target parent, cannot be- null
- reference- the parent reference, cannot be- null
- Returns:
- the attached object, never null
 
 - 
copyReferencesprotected void copyReferences(ModelObjectCopier.CopyContext context, org.eclipse.emf.ecore.EObject parent, boolean resolveProxies, boolean useOriginalReferences) Copy all references in the providedCopyContextcopies.Attaching copier implementation copies references as superclass implementation and also copies referenced external property filesystem resources. - Overrides:
- copyReferencesin class- ModelObjectCopier
- Parameters:
- context- the copy context, cannot be- null
- parent- the parent, can be- null
- resolveProxies- whether proxies should be resolved while copying
- useOriginalReferences- whether non-copied references should be used while copying
 
 - 
copyReferenceprotected void copyReference(org.eclipse.emf.ecore.EObject fromObject, org.eclipse.emf.ecore.EReference fromReference, org.eclipse.emf.ecore.EObject toObject, org.eclipse.emf.ecore.EReference toReference, ModelObjectCopier.CopyContext context, boolean resolveProxies, boolean useOriginalReferences)Description copied from class:ModelObjectCopierCopy the model object non-containment reference feature.- Overrides:
- copyReferencein class- ModelObjectCopier
- Parameters:
- fromObject- the object to copy reference feature from, cannot be- null
- fromReference- the reference feature to copy, cannot be- null
- toObject- the object to copy reference feature to, cannot be- null
- toReference- the reference feature to copy, cannot be- null
- context- the copy context, cannot be- null
- resolveProxies- whether proxies should be resolved while copying
- useOriginalReferences- whether non-copied references should be used while copying
 
 - 
copyExternalPropertyReferenceprotected void copyExternalPropertyReference(org.eclipse.emf.ecore.EObject fromObject, org.eclipse.emf.ecore.EReference fromReference, org.eclipse.emf.ecore.EObject toObject, org.eclipse.emf.ecore.EReference toReference, ModelObjectCopier.CopyContext context, boolean resolveProxies, boolean useOriginalReferences)Description copied from class:ModelObjectCopierCopy the model object external property reference feature.- Overrides:
- copyExternalPropertyReferencein class- ModelObjectCopier
- Parameters:
- fromObject- the object to copy external property from, cannot be- null
- fromReference- the external property to copy, cannot be- null
- toObject- the object to copy external property to, cannot be- null
- toReference- the external property to copy to, cannot be- null
- context- the copy context, cannot be- null
- resolveProxies- whether proxies should be resolved while copying
- useOriginalReferences- whether non-copied references should be used while copying
 
 - 
generateMdCopyNameprotected String generateMdCopyName(MdObject sourceObject, MdObject targetObject, org.eclipse.emf.ecore.EObject targetParent, org.eclipse.emf.ecore.EReference reference, ModelObjectCopier.CopyContext copyContext) Description copied from class:ModelObjectCopierGenerate copied model metadata object name.- Overrides:
- generateMdCopyNamein class- ModelObjectCopier
- Parameters:
- sourceObject- the source object to copy, cannot be- null
- targetObject- the target object to copy, cannot be- null
- targetParent- the target parent to copy to or- nullif none
- reference- the parent reference to copy to or- nullif none
- Returns:
- the copied model metadata object name, never null
 
 - 
copyReferenceTypeDescriptionprotected void copyReferenceTypeDescription(TypeDescription typeDescription, org.eclipse.emf.ecore.EReference fromReference, org.eclipse.emf.ecore.EObject copyEObject, org.eclipse.emf.ecore.EReference toReference, ModelObjectCopier.CopyContext context, boolean resolveProxies, boolean useOriginalReferences) Description copied from class:ModelObjectCopierCopy the model object non-containment reference feature from the type description object.- Overrides:
- copyReferenceTypeDescriptionin class- ModelObjectCopier
- Parameters:
- typeDescription- the object to copy reference feature from, cannot be- null
- fromReference- the reference feature to copy, cannot be- null
- toReference- the reference feature to copy, cannot be- null
- context- the copy context, cannot be- null
- resolveProxies- whether proxies should be resolved while copying
- useOriginalReferences- whether non-copied references should be used while copying
 
 - 
copyReferenceFieldsprotected void copyReferenceFields(org.eclipse.emf.ecore.EObject fromObject, org.eclipse.emf.ecore.EReference fromReference, org.eclipse.emf.ecore.EObject toObject, org.eclipse.emf.ecore.EReference toReference, ModelObjectCopier.CopyContext context, boolean resolveProxies, boolean useOriginalReferences)Description copied from class:ModelObjectCopierCopy the model object non-containment reference feature of theFieldtype.- Overrides:
- copyReferenceFieldsin class- ModelObjectCopier
- Parameters:
- fromObject- the object to copy reference feature from, cannot be- null
- fromReference- the reference feature to copy, cannot be- null
- toObject- the object to copy reference feature to, cannot be- null
- toReference- the reference feature to copy, cannot be- null
- context- the copy context, cannot be- null
- resolveProxies- whether proxies should be resolved while copying
- useOriginalReferences- whether non-copied references should be used while copying
 
 - 
copyReferenceFieldprotected void copyReferenceField(org.eclipse.emf.ecore.EObject fromObject, org.eclipse.emf.ecore.EReference fromReference, org.eclipse.emf.ecore.EObject toObject, org.eclipse.emf.ecore.EReference toReference, ModelObjectCopier.CopyContext context, boolean resolveProxies, boolean useOriginalReferences)Description copied from class:ModelObjectCopierCopy the model object non-containment reference feature of theFieldtype.- Overrides:
- copyReferenceFieldin class- ModelObjectCopier
- Parameters:
- fromObject- the object to copy reference feature from, cannot be- null
- fromReference- the reference feature to copy, cannot be- null
- toObject- the object to copy reference feature to, cannot be- null
- toReference- the reference feature to copy, cannot be- null
- context- the copy context, cannot be- null
- resolveProxies- whether proxies should be resolved while copying
- useOriginalReferences- whether non-copied references should be used while copying
 
 - 
copySourceAsReferenceTypeprotected void copySourceAsReferenceType(org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EObject copyObject, org.eclipse.emf.ecore.EReference toReference, ModelObjectCopier.CopyContext context)Description copied from class:ModelObjectCopierCopy the source object as reference to source type in the terms of V8 metadata model. If cannot copy then do nothing.- Overrides:
- copySourceAsReferenceTypein class- ModelObjectCopier
- Parameters:
- eObject- the original object, cannot be- null
- copyObject- the copied object, cannot be- null
- toReference- the type description reference to copy source as type to, cannot be- null
- context- the copy context, cannot be- null
 
 - 
createContextprotected ModelObjectCopier.CopyContext createContext(org.eclipse.emf.ecore.EClass toClass) Description copied from class:ModelObjectCopierCreates copy context. Subclasses may override and provide more specific copy context.- Overrides:
- createContextin class- ModelObjectCopier
- Parameters:
- toClass- the result model class, cannot be- null
- Returns:
- the created copy context, never null
 
 - 
createContextprotected ModelObjectCopier.CopyContext createContext(org.eclipse.emf.ecore.EObject parent, org.eclipse.emf.ecore.EReference reference) Description copied from class:ModelObjectCopierCreates copy context. Subclasses may override and provide more specific copy context.- Overrides:
- createContextin class- ModelObjectCopier
- Parameters:
- parent- the target parent, cannot be- null
- reference- the reference parent, cannot be- null
- Returns:
- the created copy context, never null
 
 - 
attachExternalPropertyprotected <T extends IBmObject> T attachExternalProperty(T externalProperty, org.eclipse.emf.ecore.EObject owner, org.eclipse.emf.ecore.EReference reference) Attach the given external property to the associated BM session.- Parameters:
- externalProperty- the external property value, cannot be- null
- owner- the external property owner, cannot be- null
- reference- the external property reference, cannot be- null
- Returns:
- the attached external property, never null
 
 - 
attachModelObjectprotected <T extends IBmObject> T attachModelObject(T original) Attach the given model object to the associated BM session.- Parameters:
- original- the original model object, cannot be- null
- Returns:
- the attached model object, never null
 
 - 
attachModelObjectprotected <T extends IBmObject> T attachModelObject(T original, boolean isTop) Attach the given model object to the associated BM session.- Parameters:
- original- the original model object, cannot be- null
- isTop- whether the object is top object
- Returns:
- the attached model object, never null
 
 - 
createProxyprotected org.eclipse.emf.ecore.EObject createProxy(org.eclipse.core.resources.IProject sourceProject, org.eclipse.emf.ecore.EObject sourceParent, org.eclipse.emf.ecore.EObject source, org.eclipse.core.resources.IProject targetProject, org.eclipse.emf.ecore.EObject targetParent, org.eclipse.emf.ecore.EReference targetReference, ModelObjectCopier.CopyContext context)Create proxy of the source object in the target project. The proxy will have the same URI but with the providedprojectinstead of original and the providedtargetParentURI part instead ofsourceParentpart.- Parameters:
- sourceProject- the source object project, cannot be- null
- sourceParent- the source object parent, cannot be- null
- source- the source object, cannot be- null
- targetProject- the target project to create proxy in, cannot be- null
- targetParent- the target proxy object parent, cannot be- null
- targetReference- the target proxy reference, cannot be- null
- context- the copy context, cannot be- null
- Returns:
- the created proxy, never null
 
 - 
copyExternalPropertyResourceprotected void copyExternalPropertyResource(ModelObjectCopier.CopyContext context, org.eclipse.core.resources.IProject projectFrom, org.eclipse.core.resources.IProject projectTo, IProjectFileSystemSupport projectFileSystemSupportTo, IProjectFileSystemSupport projectFileSystemSupportFrom, org.eclipse.emf.ecore.EObject owner, org.eclipse.emf.ecore.EReference reference, org.eclipse.emf.ecore.EObject externalProperty) Copies the provided external property resource file to the target file location and attaches it to the associated BM session.- Parameters:
- context- the copy context, cannot be- null
- projectFrom- the project to copy resource from, cannot be- null
- projectTo- the project to copy resource to, cannot be- null
- projectFileSystemSupportTo- the project filesystem support to copy resource from, cannot be- null
- projectFileSystemSupportFrom- the project filesystem support to copy resource to, cannot be- null
- owner- the external property owner, cannot be- null
- reference- the external property reference feature, cannot be- null
- externalProperty- the external property, cannot be- null
 
 - 
copyReferenceAsProxyprotected Object copyReferenceAsProxy(org.eclipse.core.resources.IProject fromProject, org.eclipse.emf.ecore.EObject fromObject, org.eclipse.emf.ecore.EReference fromReference, org.eclipse.core.resources.IProject toProject, org.eclipse.emf.ecore.EObject toObject, org.eclipse.emf.ecore.EReference toReference, ModelObjectCopier.CopyContext context) Copy the model object non-containment reference feature as proxy in the associated BM session project.- Parameters:
- fromProject- the original object project, cannot be- null
- fromObject- the object to copy reference feature from, cannot be- null
- fromReference- the reference feature to copy, cannot be- null
- toProject- the project to create proxy in, cannot be- null
- toObject- the object to copy reference feature to, cannot be- null
- toReference- the reference feature to copy, cannot be- null
- context- the copy context, cannot be- null
- resolveProxies- whether proxies should be resolved while copying
- useOriginalReferences- whether non-copied references should be used while copying
- Returns:
- the result of the copied reference: EObjectelement or a collection ofEObjectelements, nevernull
 
 - 
copyResourceprotected void copyResource(org.eclipse.core.resources.IFile fromFile, org.eclipse.core.resources.IFile toFile)Copies the provided resource file to the target file location. If target file is already exist it will be replaced with the provided file copy.- Parameters:
- fromFile- the source file to copy, cannot be- null
- toFile- the target file location, cannot be- null
 
 - 
generateExternalPropertyFqnprotected String generateExternalPropertyFqn(IBmObject externalProperty, org.eclipse.emf.ecore.EObject owner, org.eclipse.emf.ecore.EReference reference) Generate and external property FQN.- Parameters:
- externalProperty- the external property object, cannot be- null
- owner- the external property owner, cannot be- null
- reference- the reference to external property, cannot be- null
- Returns:
- the generated external property FQN, never null
 
 
- 
 
-