Package com.nomagic.magicdraw.uml
Class ConvertElementInfo
- java.lang.Object
-
- com.nomagic.magicdraw.uml.ConvertElementInfo
-
- All Implemented Interfaces:
java.lang.Comparable<ConvertElementInfo>
@OpenApiAll public class ConvertElementInfo extends java.lang.Object implements java.lang.Comparable<ConvertElementInfo>
Holds information which controls the process of element conversion, for example allows to define target element type and preferred symbol type.- See Also:
Refactoring
,Element
,PresentationElement
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ConvertElementInfo.DisposeSourceValidator
Validates whether source should be disposed after conversion.
-
Constructor Summary
Constructors Constructor Description ConvertElementInfo(java.lang.Class<? extends Element> elementType)
Constructs this info.ConvertElementInfo(java.lang.Class<? extends Element> elementType, boolean canInfoBeLost)
Constructs this info.ConvertElementInfo(java.lang.Class<? extends Element> elementType, java.lang.Class<? extends PresentationElement> symbolType)
Constructs this info.ConvertElementInfo(java.lang.String name, java.lang.Class<? extends Element> elementType, boolean createSymbol)
Constructs this info.ConvertElementInfo(java.lang.String name, java.lang.Class<? extends Element> elementType, java.lang.Class<? extends PresentationElement> symbolType)
Constructs this info.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
canChangeElement(Element element)
Indicates if element can be changed by conversion.boolean
canConvert(Element element)
Indicates if element can be converted.boolean
canInfoBeLost(Element source)
Indicates if info can be lost for a given source element.int
compareTo(ConvertElementInfo o)
boolean
equals(java.lang.Object o)
java.util.Collection<Stereotype>
getAdditionalStereotypes()
ConvertElementInfoCategory
getCategory()
ConvertElementInfo.DisposeSourceValidator
getDisposeSourceValidator()
Gets dispose source validator.java.lang.String
getElementIDSuffix()
Gets element ID suffix.java.lang.Class<? extends Element>
getElementType()
Gets type of the element to which to convert.java.lang.String
getHumanName()
Gets human-readable format of the conversion.java.lang.String
getName()
Gets name of conversion.java.util.Map<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EObject>
getPendingMapping()
java.lang.Class<? extends PresentationElement>
getSymbolType()
Type of the symbol to which to convert.int
hashCode()
boolean
isCanChangeElementName()
Gets can change element name flag value.boolean
isConvertingSourceEditable(Element source)
Indicates if source element is editableboolean
isConvertOnlyIncomingReferences()
Gets convert only incoming references flag value.boolean
isConvertRelatedElements()
boolean
isCreateSymbol()
Gets create symbol flag value.boolean
isDisposeSource()
Indicates if source should be disposed after conversion.boolean
isPreserveElementID()
Gets preserve element ID flag value.boolean
isRemoveFromCollections()
If the method returns true then convert should remove a value from the source element collection.void
setAdditionalStereotypes(java.util.Collection<Stereotype> stereotypes)
Set stereotypes to apply to converted element after conversionvoid
setCanChangeElementName(boolean canChangeElementName)
Sets can change element name flag value.void
setCanInfoBeLost(boolean canInfoBeLost)
Sets info can be lost flag value.void
setCategory(ConvertElementInfoCategory category)
Set category of info used for grouping of targets in UI.void
setConvertOnlyIncomingReferences(boolean convertOnlyIncomingReferences)
Sets convert only incoming references flag value.void
setConvertRelatedElements(boolean convertRelatedElements)
Set flag for related elements convertingvoid
setCreateSymbol(boolean createSymbol)
Sets create symbol flag value.void
setDisposeSourceValidator(ConvertElementInfo.DisposeSourceValidator disposeSourceValidator)
Sets dispose source validator.void
setElementIDSuffix(java.lang.String elementIDSuffix)
Sets element ID suffix.void
setPendingMapping(java.util.Map<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EObject> pendingMapping)
Sets mapping for elements which will be converted latervoid
setPreserveElementID(boolean preserveElementID)
Deprecated.it is not recommended to use this setting as preserving ids can break model consistency if some situations
-
-
-
Constructor Detail
-
ConvertElementInfo
public ConvertElementInfo(@CheckForNull java.lang.String name, java.lang.Class<? extends Element> elementType, @CheckForNull java.lang.Class<? extends PresentationElement> symbolType)
Constructs this info.- Parameters:
name
- name of conversion.elementType
- type to which to convert.symbolType
- preferred symbol type to which to convert.
-
ConvertElementInfo
public ConvertElementInfo(java.lang.Class<? extends Element> elementType, java.lang.Class<? extends PresentationElement> symbolType)
Constructs this info.- Parameters:
elementType
- type to which to convert.symbolType
- preferred symbol type to which to convert.
-
ConvertElementInfo
public ConvertElementInfo(@CheckForNull java.lang.String name, java.lang.Class<? extends Element> elementType, boolean createSymbol)
Constructs this info.- Parameters:
name
- name of conversion.elementType
- type to which to convert.createSymbol
- indicates if symbol should be created with this conversion.
-
ConvertElementInfo
public ConvertElementInfo(java.lang.Class<? extends Element> elementType)
Constructs this info.- Parameters:
elementType
- type to which to convert.
-
ConvertElementInfo
public ConvertElementInfo(java.lang.Class<? extends Element> elementType, boolean canInfoBeLost)
Constructs this info.- Parameters:
elementType
- type to which to convert.canInfoBeLost
- indicates if info can be lost by conversion.
-
-
Method Detail
-
getName
@CheckForNull public java.lang.String getName()
Gets name of conversion.- Returns:
- name of conversion.
-
getElementType
public java.lang.Class<? extends Element> getElementType()
Gets type of the element to which to convert.- Returns:
- type of the element to which to convert.
-
getSymbolType
@CheckForNull public java.lang.Class<? extends PresentationElement> getSymbolType()
Type of the symbol to which to convert.- Returns:
- type of the symbol to which to convert.
-
getHumanName
public java.lang.String getHumanName()
Gets human-readable format of the conversion.- Returns:
- human-readable format of the conversion.
-
compareTo
public int compareTo(@Nonnull ConvertElementInfo o)
- Specified by:
compareTo
in interfacejava.lang.Comparable<ConvertElementInfo>
-
isCreateSymbol
public boolean isCreateSymbol()
Gets create symbol flag value.- Returns:
- create symbol flag value.
-
setCreateSymbol
public void setCreateSymbol(boolean createSymbol)
Sets create symbol flag value.- Parameters:
createSymbol
- create symbol flag value.
-
canInfoBeLost
public boolean canInfoBeLost(Element source)
Indicates if info can be lost for a given source element.- Parameters:
source
- element being converted.- Returns:
- true if info can be lost, false otherwise.
-
setCanInfoBeLost
public void setCanInfoBeLost(boolean canInfoBeLost)
Sets info can be lost flag value.- Parameters:
canInfoBeLost
- info can be lost flag value.
-
canConvert
public boolean canConvert(Element element)
Indicates if element can be converted.- Parameters:
element
- element to convert.- Returns:
- true if element can be converted, false otherwise.
-
isConvertingSourceEditable
public boolean isConvertingSourceEditable(Element source)
Indicates if source element is editable- Parameters:
source
- source to convert- Returns:
- true if element is editable and can be converted, false otherwise.
-
isConvertOnlyIncomingReferences
public boolean isConvertOnlyIncomingReferences()
Gets convert only incoming references flag value.- Returns:
- convert only incoming references flag value.
-
setConvertOnlyIncomingReferences
public void setConvertOnlyIncomingReferences(boolean convertOnlyIncomingReferences)
Sets convert only incoming references flag value.- Parameters:
convertOnlyIncomingReferences
- convert only incoming references flag value.
-
isDisposeSource
public boolean isDisposeSource()
Indicates if source should be disposed after conversion.- Returns:
- true if source should be disposed, false otherwise.
-
isCanChangeElementName
public boolean isCanChangeElementName()
Gets can change element name flag value.- Returns:
- can change element name flag value.
-
setCanChangeElementName
public void setCanChangeElementName(boolean canChangeElementName)
Sets can change element name flag value.- Parameters:
canChangeElementName
- can change element name flag value.
-
canChangeElement
public boolean canChangeElement(Element element)
Indicates if element can be changed by conversion.- Parameters:
element
- element being converted.- Returns:
- true if element can be changed by conversion.
-
isPreserveElementID
public boolean isPreserveElementID()
Gets preserve element ID flag value.- Returns:
- preserve element ID flag value
-
setPreserveElementID
@Deprecated public void setPreserveElementID(boolean preserveElementID)
Deprecated.it is not recommended to use this setting as preserving ids can break model consistency if some situationsSets preserve element ID flag value.- Parameters:
preserveElementID
- preserve element ID flag value
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
getCategory
public ConvertElementInfoCategory getCategory()
- Returns:
- category of info used for grouping
-
setCategory
public void setCategory(ConvertElementInfoCategory category)
Set category of info used for grouping of targets in UI.- Parameters:
category
- category
-
getElementIDSuffix
public java.lang.String getElementIDSuffix()
Gets element ID suffix.- Returns:
- element ID suffix.
-
setElementIDSuffix
public void setElementIDSuffix(java.lang.String elementIDSuffix)
Sets element ID suffix.- Parameters:
elementIDSuffix
- suffix to set.
-
isRemoveFromCollections
public boolean isRemoveFromCollections()
If the method returns true then convert should remove a value from the source element collection. Default implementation does not remove the collections.- Returns:
- false.
-
setAdditionalStereotypes
public void setAdditionalStereotypes(@Nonnull java.util.Collection<Stereotype> stereotypes)
Set stereotypes to apply to converted element after conversion- Parameters:
stereotypes
- stereotypes
-
getAdditionalStereotypes
public java.util.Collection<Stereotype> getAdditionalStereotypes()
- Returns:
- some stereotypes to apply to converted element after conversion
-
getDisposeSourceValidator
public ConvertElementInfo.DisposeSourceValidator getDisposeSourceValidator()
Gets dispose source validator.- Returns:
- dispose source validator.
-
setDisposeSourceValidator
public void setDisposeSourceValidator(ConvertElementInfo.DisposeSourceValidator disposeSourceValidator)
Sets dispose source validator.- Parameters:
disposeSourceValidator
- dispose source validator to set.
-
isConvertRelatedElements
public boolean isConvertRelatedElements()
- Returns:
- true if related elements should be converted also. Default is true
-
setConvertRelatedElements
public void setConvertRelatedElements(boolean convertRelatedElements)
Set flag for related elements converting- Parameters:
convertRelatedElements
- convert related elements
-
getPendingMapping
@CheckForNull public java.util.Map<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EObject> getPendingMapping()
- Returns:
- mapping for other elements that will be converted later
-
setPendingMapping
public void setPendingMapping(java.util.Map<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EObject> pendingMapping)
Sets mapping for elements which will be converted later- Parameters:
pendingMapping
- mapping of elements will be done later
-
-