Package com._1c.g5.v8.dt.md.copy
Class ModelObjectCopier
- java.lang.Object
-
- com._1c.g5.v8.dt.md.copy.ModelObjectCopier
-
- Direct Known Subclasses:
AttachingModelObjectCopier
public class ModelObjectCopier extends Object
Model object copier allows to copy model objects. Copier allows to copy metadata objects to different target classes, e.g. clients may copyDocument
toCatalog
, or even toCatalogAttribute
and only matching attributes will be copied.ModelObjectCopier
instances are stateless, may be used multiple times to copy multiple objects and by multiple threads.Clients may extend copier and customize copy and attach process.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ModelObjectCopier.CopyContext
Copy process context that holds information about copied objects, references, external properties names, etc.
-
Field Summary
Fields Modifier and Type Field Description protected IEditingLanguageManager
editingLanguageManager
protected IModelObjectFactory
modelFactory
protected static String
PRODUCED_TYPES_FEATURE_NAME
Model objects produced types feature name.protected IRuntimeVersionSupport
runtimeVersionSupport
protected IV8ProjectManager
v8projectManager
-
Constructor Summary
Constructors Constructor Description ModelObjectCopier(IV8ProjectManager v8projectManager, IModelObjectFactory modelFactory, IRuntimeVersionSupport runtimeVersionSupport, IEditingLanguageManager editingLanguageManager)
Constructor ofModelObjectCopier
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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 providedparent
object reference.org.eclipse.emf.ecore.EObject
copy(org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EClass toClass)
Copies the given model object and returns a copy of the providedtoClass
type.protected org.eclipse.emf.ecore.EObject
copy(org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EClass toClass, org.eclipse.emf.ecore.EObject targetParent, org.eclipse.emf.ecore.EReference reference, ModelObjectCopier.CopyContext context)
Copies the given model object and returns a copy of the providedtoClass
type.org.eclipse.emf.ecore.EObject
copy(org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EObject parent, org.eclipse.emf.ecore.EReference reference)
Copies the given model object in appropriate class for the providedparent
object and reference type.<T extends org.eclipse.emf.ecore.EObject>
Tcopy(T eObject)
Copies the given model object and returns a copy of the same type.protected void
copyAccountingFlag(org.eclipse.emf.ecore.EObject fromObject, org.eclipse.emf.ecore.EReference fromReference, org.eclipse.emf.ecore.EObject toObject, org.eclipse.emf.ecore.EReference toReference, org.eclipse.emf.ecore.EObject fromAccountingFlag, ModelObjectCopier.CopyContext context, boolean resolveProxies, boolean useOriginalReferences)
Copy reference to the accounting flag getting fromAccountingRegisterResource
protected void
copyAttribute(org.eclipse.emf.ecore.EObject fromObject, org.eclipse.emf.ecore.EAttribute fromAttribute, org.eclipse.emf.ecore.EObject toObject, org.eclipse.emf.ecore.EAttribute toAttribute, org.eclipse.emf.ecore.EObject targetParent, org.eclipse.emf.ecore.EReference reference, ModelObjectCopier.CopyContext context)
Copy the provided model object attribute.protected void
copyAttributeValue(org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EAttribute eAttribute, Object value, org.eclipse.emf.ecore.EStructuralFeature.Setting setting)
Copy the provided model object attribute value.protected <T> Collection<T>
copyCollection(Collection<? extends T> eObjects, org.eclipse.emf.ecore.EClass toClass, org.eclipse.emf.ecore.EObject targetParent, org.eclipse.emf.ecore.EReference targetReference, ModelObjectCopier.CopyContext context)
Copy the collection of model objects to the providedtoClass
ant target parent reference.protected void
copyContainment(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)
Copy the model object containment reference feature.protected void
copyExternalDataSourceSubObjects(org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EObject copyObject, org.eclipse.emf.ecore.EReference toReference, org.eclipse.emf.ecore.EReference fromReference, ModelObjectCopier.CopyContext context)
Copies sub objects ofExternalDataSource
s andCube
sprotected 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)
Copy the model object external property reference feature.protected void
copyFeatureMap(org.eclipse.emf.ecore.util.FeatureMap featureMap, ModelObjectCopier.CopyContext context)
Copy the model object feature map.protected void
copyHelp(org.eclipse.emf.ecore.EObject fromObject, org.eclipse.emf.ecore.EReference fromHelpReference, org.eclipse.emf.ecore.EObject toObject, org.eclipse.emf.ecore.EReference toHelpReference, ModelObjectCopier.CopyContext context)
Copy the model objectHelp
.protected void
copyMdName(org.eclipse.emf.ecore.EObject fromObject, org.eclipse.emf.ecore.EAttribute fromAttribute, org.eclipse.emf.ecore.EObject toObject, org.eclipse.emf.ecore.EAttribute toAttribute, org.eclipse.emf.ecore.EObject targetParent, org.eclipse.emf.ecore.EReference reference, ModelObjectCopier.CopyContext context)
Copy the metadata model object name.protected 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)
Copy the model object non-containment reference feature.protected 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)
Copy the model object non-containment reference feature of theField
type.protected 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)
Copy the model object non-containment reference feature of theField
type.protected void
copyReferences(ModelObjectCopier.CopyContext context, org.eclipse.emf.ecore.EObject parent, boolean resolveProxies, boolean useOriginalReferences)
Copy all references in the providedCopyContext
copies.protected void
copyReferences(org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EObject copyObject, ModelObjectCopier.CopyContext context, org.eclipse.emf.ecore.EObject parent, boolean resolveProxies, boolean useOriginalReferences)
Copy all references of the provided copy object.protected void
copyReferenceSubsystem(Subsystem subsystem, org.eclipse.emf.ecore.EReference fromReference, org.eclipse.emf.ecore.EObject toObject, org.eclipse.emf.ecore.EReference toReference, ModelObjectCopier.CopyContext context, org.eclipse.emf.ecore.EObject parent, boolean resolveProxies, boolean useOriginalReferences)
Copy the model object non-containment reference feature from the subsystem object.protected 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)
Copy the model object non-containment reference feature from the type description object.protected void
copySourceAsReferenceType(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.CopyContext
createContext(org.eclipse.emf.ecore.EClass toClass)
Creates copy context.protected ModelObjectCopier.CopyContext
createContext(org.eclipse.emf.ecore.EObject parent, org.eclipse.emf.ecore.EReference reference)
Creates copy context.protected org.eclipse.emf.ecore.EObject
createCopy(org.eclipse.emf.ecore.EObject sourceObject, org.eclipse.emf.ecore.EClass targetClass, org.eclipse.emf.ecore.EObject targetParent)
Create copy object of the provided source object, target class and parent.protected String
generateMdCopyName(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.protected String
getName(org.eclipse.emf.ecore.EObject object)
Returns the name of the provided object ornull
if it cannot be obtained.protected org.eclipse.emf.ecore.EStructuralFeature
getTarget(org.eclipse.emf.ecore.EStructuralFeature eStructuralFeature)
Returns the target feature used to populate a copy instance from the given source feature.protected org.eclipse.emf.ecore.EStructuralFeature.Setting
getTarget(org.eclipse.emf.ecore.EStructuralFeature eStructuralFeature, org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EObject copyObject)
Returns a setting for the feature and copy instance to be populated with the original object source feature value.protected boolean
isChanged(org.eclipse.emf.ecore.EObject fromObject, org.eclipse.emf.ecore.EStructuralFeature fromFeature, org.eclipse.emf.ecore.EObject toObject, org.eclipse.emf.ecore.EStructuralFeature toFeature)
Returns whether feature value was changed and is needed to copy.protected boolean
isExternalProperty(org.eclipse.emf.ecore.EReference reference)
Returns whether the provided reference is external property.protected boolean
isFormReference(org.eclipse.emf.ecore.EReference reference)
Returns whether the provided reference is referenced to form.protected boolean
isGraphicalSchemeReference(org.eclipse.emf.ecore.EObject original, org.eclipse.emf.ecore.EObject externalProperty)
Returns whether the provided reference is referenced to graphical scheme.protected boolean
isHtmlDocumentTemplateReference(org.eclipse.emf.ecore.EObject context, org.eclipse.emf.ecore.EReference reference)
Returns whether the provided reference is referenced to template.protected boolean
isNotAnnotatedExternalResource(org.eclipse.emf.ecore.EObject fromObject, org.eclipse.emf.ecore.EObject toObject)
Returns whether objects is external resource not annotated in model.protected boolean
isRightsReference(org.eclipse.emf.ecore.EReference reference)
Returns whether the provided reference is referenced to rights.protected boolean
isStyleReference(org.eclipse.emf.ecore.EReference reference)
Returns whether the provided reference is referenced to style.protected boolean
nameExists(String nameCandidate, Collection<String> existingNames, ModelObjectCopier.CopyContext copyContext, org.eclipse.emf.ecore.EClass eClass)
Returns whether the name candidate already exists in the provided existing name collection or in the provided copy context.protected boolean
shouldCopyAttribute(org.eclipse.emf.ecore.EAttribute fromAttribute, org.eclipse.emf.ecore.EObject fromObject, org.eclipse.emf.ecore.EAttribute toAttribute, org.eclipse.emf.ecore.EObject toObject, ModelObjectCopier.CopyContext context)
Returns whether need to copy the provided attribute.protected boolean
shouldCopyContainment(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)
Returns whether need to copy the provided containment reference.protected boolean
shouldCopyExternalPropertyReference(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)
Returns whether need to copy the provided external property reference.protected boolean
shouldCopyReference(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)
Returns whether need to copy the provided non-containment reference.
-
-
-
Field Detail
-
PRODUCED_TYPES_FEATURE_NAME
protected static final String PRODUCED_TYPES_FEATURE_NAME
Model objects produced types feature name. Value is "producedTypes".- See Also:
- Constant Field Values
-
v8projectManager
protected final IV8ProjectManager v8projectManager
-
modelFactory
protected final IModelObjectFactory modelFactory
-
runtimeVersionSupport
protected final IRuntimeVersionSupport runtimeVersionSupport
-
editingLanguageManager
protected final IEditingLanguageManager editingLanguageManager
-
-
Constructor Detail
-
ModelObjectCopier
@Inject public ModelObjectCopier(IV8ProjectManager v8projectManager, IModelObjectFactory modelFactory, IRuntimeVersionSupport runtimeVersionSupport, IEditingLanguageManager editingLanguageManager)
Constructor ofModelObjectCopier
.- Parameters:
v8projectManager
- the V8 project manager, cannot benull
modelFactory
- the model object factory, cannot benull
runtimeVersionSupport
- the 1C:Enterprise runtime version support, cannot benull
editingLanguageManager
- the editing language manager, cannot benull
-
-
Method Detail
-
copy
public <T extends org.eclipse.emf.ecore.EObject> T copy(T eObject)
Copies the given model object and returns a copy of the same type.- Parameters:
eObject
- the model object to copy, cannot benull
- Returns:
- a copy of the same type, never
null
-
copy
public org.eclipse.emf.ecore.EObject copy(org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EClass toClass)
Copies the given model object and returns a copy of the providedtoClass
type. Copies only matched features.This method allows to copy metadata objects to different target classes, e.g. clients may copy
Document
toCatalog
, or even toCatalogAttribute
and only matching attributes will be copied.- Parameters:
eObject
- the model object to copy, cannot benull
toClass
- the result model class, cannot benull
- Returns:
- a copy of the provided type, never
null
-
copy
public org.eclipse.emf.ecore.EObject copy(org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EObject parent, org.eclipse.emf.ecore.EReference reference)
Copies the given model object in appropriate class for the providedparent
object and reference type.This method allows to copy metadata objects to different target classes, e.g. clients may copy
Document
toCatalog
, or even toCatalogAttribute
and only matching attributes will be copied.- Parameters:
eObject
- the model object to copy, cannot benull
parent
- the target parent, cannot benull
reference
- the reference parent, cannot benull
- Returns:
- a copy of the appropriate type, never
null
-
attach
protected 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 providedparent
object reference. Returns attached object. Method is called after source object copy and before its references copy.- Parameters:
copy
- the model object copy to attach, cannot benull
parent
- the target parent, cannot benull
reference
- the parent reference, cannot benull
- Returns:
- the attached object, never
null
-
copy
protected org.eclipse.emf.ecore.EObject copy(org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EClass toClass, org.eclipse.emf.ecore.EObject targetParent, org.eclipse.emf.ecore.EReference reference, ModelObjectCopier.CopyContext context)
Copies the given model object and returns a copy of the providedtoClass
type. Copies only matched features.- Parameters:
eObject
- the model object to copy, cannot benull
toClass
- the result model class, cannot benull
targetParent
- the target parent to copy to ornull
if nonereference
- the parent reference to copy to ornull
if nonecontext
- the copy context, cannot benull
- Returns:
- a copy of the provided type, never
null
-
copyAttribute
protected void copyAttribute(org.eclipse.emf.ecore.EObject fromObject, org.eclipse.emf.ecore.EAttribute fromAttribute, org.eclipse.emf.ecore.EObject toObject, org.eclipse.emf.ecore.EAttribute toAttribute, org.eclipse.emf.ecore.EObject targetParent, org.eclipse.emf.ecore.EReference reference, ModelObjectCopier.CopyContext context)
Copy the provided model object attribute.- Parameters:
fromObject
- the object to copy attribute from, cannot benull
fromAttribute
- the attribute to copy value from, cannot benull
fromObject
- the object to copy attribute to, cannot benull
fromAttribute
- the attribute to copy value to, cannot benull
targetParent
- the target parent to copy to ornull
if nonereference
- the parent reference to copy to ornull
if nonecontext
- the copy context, cannot benull
-
copyAttributeValue
protected void copyAttributeValue(org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EAttribute eAttribute, Object value, org.eclipse.emf.ecore.EStructuralFeature.Setting setting)
Copy the provided model object attribute value.- Parameters:
eObject
- the object to copy attribute to, cannot benull
eAttribute
- the attribute to copy value to, cannot benull
value
- the value to copy, cannot benull
setting
- the feature setting, cannot benull
-
copyCollection
protected <T> Collection<T> copyCollection(Collection<? extends T> eObjects, org.eclipse.emf.ecore.EClass toClass, org.eclipse.emf.ecore.EObject targetParent, org.eclipse.emf.ecore.EReference targetReference, ModelObjectCopier.CopyContext context)
Copy the collection of model objects to the providedtoClass
ant target parent reference.- Parameters:
eObjects
- the objects to copy, cannot benull
toClass
- the result model class, cannot benull
targetParent
- the target parent, cannot benull
targetReference
- the reference parent, cannot benull
context
- the copy context, cannot benull
- Returns:
- a copied collection, never
null
-
copyContainment
protected void copyContainment(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)
Copy the model object containment reference feature.- Parameters:
fromObject
- the object to copy containment reference feature from, cannot benull
fromReference
- the containment reference feature to copy, cannot benull
toObject
- the object to copy containment reference feature to, cannot benull
toReference
- the containment reference feature to copy, cannot benull
context
- the copy context, cannot benull
-
copyExternalPropertyReference
protected 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)
Copy the model object external property reference feature.- Parameters:
fromObject
- the object to copy external property from, cannot benull
fromReference
- the external property to copy, cannot benull
toObject
- the object to copy external property to, cannot benull
toReference
- the external property to copy to, cannot benull
context
- the copy context, cannot benull
resolveProxies
- whether proxies should be resolved while copyinguseOriginalReferences
- whether non-copied references should be used while copying
-
copyFeatureMap
protected void copyFeatureMap(org.eclipse.emf.ecore.util.FeatureMap featureMap, ModelObjectCopier.CopyContext context)
Copy the model object feature map.- Parameters:
featureMap
- the feature map to copy, cannot benull
context
- the copy context, cannot benull
-
copyHelp
protected void copyHelp(org.eclipse.emf.ecore.EObject fromObject, org.eclipse.emf.ecore.EReference fromHelpReference, org.eclipse.emf.ecore.EObject toObject, org.eclipse.emf.ecore.EReference toHelpReference, ModelObjectCopier.CopyContext context)
Copy the model objectHelp
.- Parameters:
fromObject
- the object to copy help from, cannot benull
fromHelpReference
- the help reference to copy, cannot benull
toObject
- the object to copy help to, cannot benull
toHelpReference
- the help reference to copy to, cannot benull
context
- the copy context, cannot benull
-
copyMdName
protected void copyMdName(org.eclipse.emf.ecore.EObject fromObject, org.eclipse.emf.ecore.EAttribute fromAttribute, org.eclipse.emf.ecore.EObject toObject, org.eclipse.emf.ecore.EAttribute toAttribute, org.eclipse.emf.ecore.EObject targetParent, org.eclipse.emf.ecore.EReference reference, ModelObjectCopier.CopyContext context)
Copy the metadata model object name.- Parameters:
fromObject
- the object to copy name from, cannot benull
fromAttribute
- the name attribute to copy, cannot benull
toObject
- the object to copy name to, cannot benull
toAttribute
- the name attribute to copy to, cannot benull
targetParent
- the target parent to copy to ornull
if nonereference
- the parent reference to copy to ornull
if nonecontext
- the copy context, cannot benull
-
copyReference
protected 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)
Copy the model object non-containment reference feature.- Parameters:
fromObject
- the object to copy reference feature from, cannot benull
fromReference
- the reference feature to copy, cannot benull
toObject
- the object to copy reference feature to, cannot benull
toReference
- the reference feature to copy, cannot benull
context
- the copy context, cannot benull
resolveProxies
- whether proxies should be resolved while copyinguseOriginalReferences
- whether non-copied references should be used while copying
-
copyReferenceFields
protected 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)
Copy the model object non-containment reference feature of theField
type.- Parameters:
fromObject
- the object to copy reference feature from, cannot benull
fromReference
- the reference feature to copy, cannot benull
toObject
- the object to copy reference feature to, cannot benull
toReference
- the reference feature to copy, cannot benull
context
- the copy context, cannot benull
resolveProxies
- whether proxies should be resolved while copyinguseOriginalReferences
- whether non-copied references should be used while copying
-
copyReferenceField
protected 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)
Copy the model object non-containment reference feature of theField
type.- Parameters:
fromObject
- the object to copy reference feature from, cannot benull
fromReference
- the reference feature to copy, cannot benull
toObject
- the object to copy reference feature to, cannot benull
toReference
- the reference feature to copy, cannot benull
context
- the copy context, cannot benull
resolveProxies
- whether proxies should be resolved while copyinguseOriginalReferences
- whether non-copied references should be used while copying
-
copyReferences
protected void copyReferences(ModelObjectCopier.CopyContext context, org.eclipse.emf.ecore.EObject parent, boolean resolveProxies, boolean useOriginalReferences)
Copy all references in the providedCopyContext
copies.- Parameters:
context
- the copy context, cannot benull
parent
- the parent, can benull
resolveProxies
- whether proxies should be resolved while copyinguseOriginalReferences
- whether non-copied references should be used while copying
-
copyReferences
protected void copyReferences(org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EObject copyObject, ModelObjectCopier.CopyContext context, org.eclipse.emf.ecore.EObject parent, boolean resolveProxies, boolean useOriginalReferences)
Copy all references of the provided copy object.- Parameters:
eObject
- the original object, cannot benull
copyObject
- the copied object, cannot benull
context
- the copy context, cannot benull
parent
- the parent, can benull
resolveProxies
- whether proxies should be resolved while copyinguseOriginalReferences
- whether non-copied references should be used while copying
-
copyAccountingFlag
protected void copyAccountingFlag(org.eclipse.emf.ecore.EObject fromObject, org.eclipse.emf.ecore.EReference fromReference, org.eclipse.emf.ecore.EObject toObject, org.eclipse.emf.ecore.EReference toReference, org.eclipse.emf.ecore.EObject fromAccountingFlag, ModelObjectCopier.CopyContext context, boolean resolveProxies, boolean useOriginalReferences)
Copy reference to the accounting flag getting fromAccountingRegisterResource
- Parameters:
fromObject
- the object to copy reference feature from, cannot benull
fromReference
- the reference feature to copy, cannot benull
toObject
- the object to copy reference feature to, cannot benull
toReference
- the reference feature to copy, cannot benull
fromAccountingFlag
- original accounting flag of AccountRegister, cannot benull
context
- the copy context, cannot benull
resolveProxies
- whether proxies should be resolved while copyinguseOriginalReferences
- whether non-copied references should be used while copying
-
copyReferenceSubsystem
protected void copyReferenceSubsystem(Subsystem subsystem, org.eclipse.emf.ecore.EReference fromReference, org.eclipse.emf.ecore.EObject toObject, org.eclipse.emf.ecore.EReference toReference, ModelObjectCopier.CopyContext context, org.eclipse.emf.ecore.EObject parent, boolean resolveProxies, boolean useOriginalReferences)
Copy the model object non-containment reference feature from the subsystem object.- Parameters:
subsystem
- the object to copy reference feature from, cannot benull
fromReference
- the reference feature to copy, cannot benull
toObject
- the object to copy reference feature to, cannot benull
toReference
- the reference feature to copy, cannot benull
context
- the copy context, cannot benull
parent
- the parent, can benull
resolveProxies
- whether proxies should be resolved while copyinguseOriginalReferences
- whether non-copied references should be used while copying
-
copyReferenceTypeDescription
protected 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)
Copy the model object non-containment reference feature from the type description object.- Parameters:
typeDescription
- the object to copy reference feature from, cannot benull
fromReference
- the reference feature to copy, cannot benull
toObject
- the object to copy reference feature to, cannot benull
toReference
- the reference feature to copy, cannot benull
context
- the copy context, cannot benull
resolveProxies
- whether proxies should be resolved while copyinguseOriginalReferences
- whether non-copied references should be used while copying
-
copySourceAsReferenceType
protected void copySourceAsReferenceType(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. If cannot copy then do nothing.- Parameters:
eObject
- the original object, cannot benull
copyObject
- the copied object, cannot benull
toReference
- the type description reference to copy source as type to, cannot benull
context
- the copy context, cannot benull
-
createContext
protected ModelObjectCopier.CopyContext createContext(org.eclipse.emf.ecore.EClass toClass)
Creates copy context. Subclasses may override and provide more specific copy context.- Parameters:
toClass
- the result model class, cannot benull
- Returns:
- the created copy context, never
null
-
createContext
protected ModelObjectCopier.CopyContext createContext(org.eclipse.emf.ecore.EObject parent, org.eclipse.emf.ecore.EReference reference)
Creates copy context. Subclasses may override and provide more specific copy context.- Parameters:
parent
- the target parent, cannot benull
reference
- the reference parent, cannot benull
- Returns:
- the created copy context, never
null
-
createCopy
protected org.eclipse.emf.ecore.EObject createCopy(org.eclipse.emf.ecore.EObject sourceObject, org.eclipse.emf.ecore.EClass targetClass, org.eclipse.emf.ecore.EObject targetParent)
Create copy object of the provided source object, target class and parent.- Parameters:
sourceObject
- the source object to copy, cannot benull
targetClass
- the result model class, cannot benull
targetParent
- the result model parent, cannot benull
- Returns:
- the created model copy object, never
null
-
nameExists
protected boolean nameExists(String nameCandidate, Collection<String> existingNames, ModelObjectCopier.CopyContext copyContext, org.eclipse.emf.ecore.EClass eClass)
Returns whether the name candidate already exists in the provided existing name collection or in the provided copy context.- Parameters:
nameCandidate
- the name candidate to check, cannot benull
existingNames
- the existing name collection to check for, cannot benull
copyContext
- the copy context to check for, cannot benull
eClass
- the class of the candidate, cannot benull
- Returns:
- whether the name candidate already exists in the provided existing name collection or in the provided copy context
-
generateMdCopyName
protected String generateMdCopyName(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.- Parameters:
sourceObject
- the source object to copy, cannot benull
targetObject
- the target object to copy, cannot benull
targetParent
- the target parent to copy to ornull
if nonereference
- the parent reference to copy to ornull
if nonecontext
- the copy context, cannot benull
- Returns:
- the copied model metadata object name, never
null
-
getName
protected String getName(org.eclipse.emf.ecore.EObject object)
Returns the name of the provided object ornull
if it cannot be obtained.- Parameters:
object
- the model object to get name of, cannot benull
- Returns:
- the name of the provided object or
null
if it cannot be obtained
-
getTarget
protected org.eclipse.emf.ecore.EStructuralFeature getTarget(org.eclipse.emf.ecore.EStructuralFeature eStructuralFeature)
Returns the target feature used to populate a copy instance from the given source feature.- Parameters:
eStructuralFeature
- the source feature, cannot benull
- Returns:
- the target feature used to populate a copy instance, or
null
if none
-
getTarget
protected org.eclipse.emf.ecore.EStructuralFeature.Setting getTarget(org.eclipse.emf.ecore.EStructuralFeature eStructuralFeature, org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EObject copyObject)
Returns a setting for the feature and copy instance to be populated with the original object source feature value.- Parameters:
eStructuralFeature
- the source feature, cannot benull
eObject
- the original object, cannot benull
copyObject
- the copied object, cannot benull
- Returns:
- the target feature used to populate a copy instance.
-
isFormReference
protected boolean isFormReference(org.eclipse.emf.ecore.EReference reference)
Returns whether the provided reference is referenced to form.- Parameters:
reference
- the reference to check, cannot benull
- Returns:
- whether the provided reference is referenced to form.
-
isStyleReference
protected boolean isStyleReference(org.eclipse.emf.ecore.EReference reference)
Returns whether the provided reference is referenced to style.- Parameters:
reference
- the reference to check, cannot benull
- Returns:
- whether the provided reference is referenced to style.
-
isGraphicalSchemeReference
protected boolean isGraphicalSchemeReference(org.eclipse.emf.ecore.EObject original, org.eclipse.emf.ecore.EObject externalProperty)
Returns whether the provided reference is referenced to graphical scheme.- Parameters:
original
- original copying object, can't benull
externalProperty
- the external property, cannot benull
- Returns:
- whether the provided reference is referenced to graphical scheme.
-
isRightsReference
protected boolean isRightsReference(org.eclipse.emf.ecore.EReference reference)
Returns whether the provided reference is referenced to rights.- Parameters:
reference
- the reference to check, cannot benull
- Returns:
- whether the provided reference is referenced to rights.
-
isNotAnnotatedExternalResource
protected boolean isNotAnnotatedExternalResource(org.eclipse.emf.ecore.EObject fromObject, org.eclipse.emf.ecore.EObject toObject)
Returns whether objects is external resource not annotated in model.- Parameters:
fromObject
- the object to copy from, cannot benull
toObject
- the object to copy to, cannot benull
- Returns:
- whether objects is external resource not annotated in model.
-
isHtmlDocumentTemplateReference
protected boolean isHtmlDocumentTemplateReference(org.eclipse.emf.ecore.EObject context, org.eclipse.emf.ecore.EReference reference)
Returns whether the provided reference is referenced to template.- Parameters:
context
- the context object to check, cannot benull
reference
- the reference to check, cannot benull
- Returns:
- whether the provided reference is referenced to template.
-
isChanged
protected boolean isChanged(org.eclipse.emf.ecore.EObject fromObject, org.eclipse.emf.ecore.EStructuralFeature fromFeature, org.eclipse.emf.ecore.EObject toObject, org.eclipse.emf.ecore.EStructuralFeature toFeature)
Returns whether feature value was changed and is needed to copy.- Parameters:
fromObject
- the object to copy feature from, cannot benull
fromFeature
- the feature to copy, cannot benull
toObject
- the object to copy feature to, cannot benull
toFeature
- the feature to copy, cannot benull
- Returns:
- whether feature value was changed and is needed to copy
-
isExternalProperty
protected boolean isExternalProperty(org.eclipse.emf.ecore.EReference reference)
Returns whether the provided reference is external property.- Parameters:
reference
- the reference to check, cannot benull
- Returns:
- whether the provided reference is external property
-
shouldCopyAttribute
protected boolean shouldCopyAttribute(org.eclipse.emf.ecore.EAttribute fromAttribute, org.eclipse.emf.ecore.EObject fromObject, org.eclipse.emf.ecore.EAttribute toAttribute, org.eclipse.emf.ecore.EObject toObject, ModelObjectCopier.CopyContext context)
Returns whether need to copy the provided attribute. Default implementation copy allows to copy all attributes except metadata UUID.- Parameters:
fromObject
- the object to copy attribute from, cannot benull
fromAttribute
- the attribute to copy value from, cannot benull
fromObject
- the object to copy attribute to, cannot benull
fromAttribute
- the attribute to copy value to, cannot benull
context
- the copy context, cannot benull
- Returns:
- whether need to copy the provided attribute
-
shouldCopyContainment
protected boolean shouldCopyContainment(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)
Returns whether need to copy the provided containment reference. Default implementation allows to copy all non-transient containment references exceptproducedTypes
reference.- Parameters:
fromObject
- the object to copy containment reference feature from, cannot benull
fromReference
- the containment reference feature to copy, cannot benull
toObject
- the object to copy containment reference feature to, cannot benull
toReference
- the containment reference feature to copy, cannot benull
context
- the copy context, cannot benull
- Returns:
- whether need to copy the provided containment reference
-
shouldCopyReference
protected boolean shouldCopyReference(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)
Returns whether need to copy the provided non-containment reference. Default implementation allows to copy all non-transient references and external properties references.- Parameters:
fromObject
- the object to copy non-containment reference feature from, cannot benull
fromReference
- the non-containment reference feature to copy, cannot benull
toObject
- the object to copy non-containment reference feature to, cannot benull
toReference
- the non-containment reference feature to copy, cannot benull
context
- the copy context, cannot benull
- Returns:
- whether need to copy the provided non-containment reference
-
shouldCopyExternalPropertyReference
protected boolean shouldCopyExternalPropertyReference(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)
Returns whether need to copy the provided external property reference. Default implementation always returnstrue
.- Parameters:
fromObject
- the object to copy external property reference feature from, cannot benull
fromReference
- the external property reference feature to copy, cannot benull
toObject
- the object to copy external property reference feature to, cannot benull
toReference
- the external property reference feature to copy, cannot benull
context
- the copy context, cannot benull
- Returns:
- whether need to copy the provided external property reference
-
copyExternalDataSourceSubObjects
protected void copyExternalDataSourceSubObjects(org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EObject copyObject, org.eclipse.emf.ecore.EReference toReference, org.eclipse.emf.ecore.EReference fromReference, ModelObjectCopier.CopyContext context)
Copies sub objects ofExternalDataSource
s andCube
s- Parameters:
eObject
- the object to copy sub objects from, cannot benull
copyObject
- the object to copy sub objects to, cannot benull
toReference
- the sub objects reference feature to copy, cannot benull
fromReference
- the sub objects reference feature to copy, cannot benull
context
- the copy context, cannot benull
-
-