@OpenApiAll public class AnyToAnyModelTransformation extends java.lang.Object implements ModelTransformation
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<Element,java.util.Collection<Element>> |
mTransformationMap |
Constructor and Description |
---|
AnyToAnyModelTransformation() |
Modifier and Type | Method and Description |
---|---|
protected void |
afterTransformation()
Method invoked after all custom transformations.
|
protected void |
changeDiagramType(DiagramPresentationElement dpe,
DiagramType createDiagramType) |
protected java.util.ArrayList<Element> |
collectInnerElements(java.util.Collection<Element> objects,
boolean update) |
protected Element |
copyElementInto(Element source,
Element parent)
Copies and pastes given element.
|
protected com.nomagic.magicdraw.commands.MacroCommand |
copyElements(java.util.List<Element> objects)
Copies elements
|
protected java.util.List<? extends java.lang.Class> |
createDefaultDoNotCopyTypes() |
protected java.util.List<? extends java.lang.Class> |
createDefaultDoNotReconnectTypes() |
protected java.util.List<java.lang.String> |
createDefaultDoNotSettableProperties() |
protected java.util.List<java.lang.Class> |
createDefaultMappedTypes() |
protected com.nomagic.magicdraw.modeltransformations.impl.any_to_any.ElementUpdater |
createElementUpdater() |
protected void |
customTransformationForElement(Element original,
java.util.Collection<Element> mapped)
Custom transformations should override this method to add additional functionality.
|
protected void |
customTransformations() |
java.util.Collection<Element> |
getMappedElements(Element original)
Returns transformed elements for given original element.
|
java.util.List |
getNotSettableProperties() |
protected java.util.Map<BaseElement,BaseElement> |
getOneToOneMap() |
protected java.util.Collection<Element> |
getOriginalElement(Element mapped)
Returns original elements which are mapped to given mapped element.
|
<T extends Element> |
getOriginalElement(Element mapped,
java.lang.Class<T> type)
Returns original elements which are mapped to given mapped element.
|
protected java.util.Collection<Element> |
getOriginalElements() |
protected ProgressStatus |
getProgressStatus() |
PropertyManager |
getPropertyManager() |
protected java.util.Collection<Element> |
getRemovedByCustomTransformation() |
<T extends Element> |
getTarget(Element original,
java.lang.Class<T> type)
Returns transformed element that's transformation source is 'original' element and it's type is specified in 'type'
|
Package |
getTransformationsPackage() |
protected com.nomagic.magicdraw.modeltransformations.impl.any_to_any.TypeMapper |
getTypeMapper() |
void |
invokeCustomTransformation(java.util.Collection<? extends Element> original)
Invokes custom transformation for collection.
|
void |
invokeCustomTransformation(Element original)
Invokes custom transformation for element.
|
protected boolean |
isAlreadyVisited(Element element) |
protected boolean |
isElementCopied(Element element) |
protected boolean |
isMappableElement(Element element) |
protected boolean |
isSkipElement(Element element)
Check if element should be skipped
|
boolean |
isTransformationInPlace() |
boolean |
isTypeMapSet() |
protected void |
markAsAlreadyVisited(Element element) |
protected void |
processMappedElements(Element original,
java.util.Collection<Element> mappedElements,
java.util.Collection<Element> originalMappedElements) |
protected void |
processMappingResult(Element original,
java.util.Collection<Element> mappedElements,
java.util.Collection<Element> originalMappedElements) |
(package private) void |
reportROElement(Element me) |
void |
setTask(Task task)
Sets task for transformation.
|
protected void |
setTransformationMapValue(Element original,
java.util.Collection<Element> mappedElements) |
protected void |
sortOriginalElements(java.util.List<Element> objects)
Sorts elements before invoking custom transformation
|
Package |
transform(java.util.Collection selectedObjects,
ModelTransformationInfo info,
com.nomagic.magicdraw.modeltransformations.TypeMapProfile typeMap,
PropertyManager propertyManager,
Package destination)
Performs transformation on specific set of objects
|
protected com.nomagic.magicdraw.commands.MacroCommand |
updateDiagrams()
Updates diagram with newly added elements during transformation update phase.
|
void |
updateTransform(Package transformationPackage,
com.nomagic.magicdraw.modeltransformations.TypeMapProfile typeMap,
PropertyManager propertyManager,
boolean syncDestination)
Updates transformation on specific set of objects
|
protected java.util.List<? extends java.lang.Class> createDefaultDoNotCopyTypes()
protected java.util.List<? extends java.lang.Class> createDefaultDoNotReconnectTypes()
protected java.util.List<java.lang.String> createDefaultDoNotSettableProperties()
protected java.util.List<java.lang.Class> createDefaultMappedTypes()
@CheckForNull public Package transform(@CheckForNull java.util.Collection selectedObjects, @CheckForNull ModelTransformationInfo info, com.nomagic.magicdraw.modeltransformations.TypeMapProfile typeMap, PropertyManager propertyManager, Package destination) throws ReadOnlyElementException
ModelTransformation
transform
in interface ModelTransformation
selectedObjects
- set of objects to transforminfo
- model transformation infotypeMap
- type map profile to use for transformation, null for nonepropertyManager
- transformation propertiesdestination
- destination model packages, null for transformation in placeReadOnlyElementException
- in case target model elements are read-onlyprotected void afterTransformation() throws ReadOnlyElementException
ReadOnlyElementException
- in case of errorprotected void customTransformations()
protected boolean isSkipElement(Element element)
element
- elementpublic void invokeCustomTransformation(java.util.Collection<? extends Element> original)
original
- original elementsinvokeCustomTransformation(Element)
public void invokeCustomTransformation(Element original)
original
- original element for which custom transformation is invoked.protected void processMappingResult(Element original, java.util.Collection<Element> mappedElements, java.util.Collection<Element> originalMappedElements)
protected void processMappedElements(Element original, java.util.Collection<Element> mappedElements, java.util.Collection<Element> originalMappedElements)
protected void setTransformationMapValue(Element original, java.util.Collection<Element> mappedElements)
protected void customTransformationForElement(Element original, java.util.Collection<Element> mapped) throws ReadOnlyElementException
original
- original element.mapped
- collection of current mapped elements. Custom transformation can modify this collection. In case custom transformation needs to remove current mapping, it should remove element from this collection. In case it needs to map more elements it should add new elements to this collection.ReadOnlyElementException
- in case of errorpublic java.util.Collection<Element> getMappedElements(Element original)
original
- original element.public void updateTransform(Package transformationPackage, com.nomagic.magicdraw.modeltransformations.TypeMapProfile typeMap, PropertyManager propertyManager, boolean syncDestination) throws ReadOnlyElementException
ModelTransformation
updateTransform
in interface ModelTransformation
transformationPackage
- package containing transformation linkstypeMap
- type map profile to use for transformation, null for nonepropertyManager
- transformation propertiessyncDestination
- true for destination overwriteReadOnlyElementException
- in case target model elements are read-onlyprotected java.util.Collection<Element> getOriginalElements()
public <T extends Element> java.util.Collection<T> getOriginalElement(Element mapped, java.lang.Class<T> type)
mapped
- original elements that are mapped to this element will be returnedtype
- only this type of elements will be returned.protected java.util.Collection<Element> getOriginalElement(Element mapped)
mapped
- mapped elementvoid reportROElement(Element me)
protected com.nomagic.magicdraw.commands.MacroCommand copyElements(java.util.List<Element> objects)
objects
- objectsprotected com.nomagic.magicdraw.modeltransformations.impl.any_to_any.ElementUpdater createElementUpdater()
protected java.util.Map<BaseElement,BaseElement> getOneToOneMap()
protected com.nomagic.magicdraw.modeltransformations.impl.any_to_any.TypeMapper getTypeMapper()
public <T extends Element> T getTarget(Element original, java.lang.Class<T> type)
original
- source model element.type
- type of returned element.protected com.nomagic.magicdraw.commands.MacroCommand updateDiagrams()
protected void sortOriginalElements(java.util.List<Element> objects)
objects
- objectsprotected java.util.ArrayList<Element> collectInnerElements(java.util.Collection<Element> objects, boolean update)
protected boolean isMappableElement(Element element)
element
- element to check.public Package getTransformationsPackage()
public boolean isTransformationInPlace()
public PropertyManager getPropertyManager()
protected Element copyElementInto(Element source, Element parent)
source
- element to copy.parent
- parent where place copied element.public void setTask(Task task)
ModelTransformation
setTask
in interface ModelTransformation
task
- transformation taskprotected ProgressStatus getProgressStatus()
protected boolean isElementCopied(Element element)
public boolean isTypeMapSet()
public java.util.List getNotSettableProperties()
protected void changeDiagramType(DiagramPresentationElement dpe, DiagramType createDiagramType)
protected java.util.Collection<Element> getRemovedByCustomTransformation()
protected void markAsAlreadyVisited(Element element)
protected boolean isAlreadyVisited(Element element)