Package com.nomagic.magicdraw.uml
Class ConvertElementInfo
java.lang.Object
com.nomagic.magicdraw.uml.ConvertElementInfo
- All Implemented Interfaces:
Comparable<ConvertElementInfo>
@OpenApiAll
public class ConvertElementInfo
extends Object
implements 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:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Validates whether source should be disposed after conversion. -
Constructor Summary
ConstructorDescriptionConvertElementInfo
(Class<? extends Element> elementType) Constructs this info.ConvertElementInfo
(Class<? extends Element> elementType, boolean canInfoBeLost) Constructs this info.ConvertElementInfo
(Class<? extends Element> elementType, Class<? extends PresentationElement> symbolType) Constructs this info.ConvertElementInfo
(String name, Class<? extends Element> elementType, boolean createSymbol) Constructs this info.ConvertElementInfo
(String name, Class<? extends Element> elementType, Class<? extends PresentationElement> symbolType) Constructs this info. -
Method Summary
Modifier and TypeMethodDescriptionboolean
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
boolean
Gets dispose source validator.Gets element ID suffix.Gets type of the element to which to convert.Gets human-readable format of the conversion.getName()
Gets name of conversion.Map<org.eclipse.emf.ecore.EObject,
org.eclipse.emf.ecore.EObject> Class<? extends PresentationElement>
Type of the symbol to which to convert.int
hashCode()
boolean
Gets can change element name flag value.boolean
isConvertingSourceEditable
(Element source) Indicates if source element is editableboolean
Gets convert only incoming references flag value.boolean
boolean
Gets create symbol flag value.boolean
Indicates if source should be disposed after conversion.boolean
Gets preserve element ID flag value.boolean
If the method returns true then convert should remove a value from the source element collection.boolean
isReplaceSourcePresentationElement
(PresentationElement sourcePresentationElement) Check if source presentation element may be replaced.void
setAdditionalStereotypes
(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
(String elementIDSuffix) Sets element ID suffix.void
setPendingMapping
(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 Details
-
ConvertElementInfo
public ConvertElementInfo(@CheckForNull String name, Class<? extends Element> elementType, @CheckForNull 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(Class<? extends Element> elementType, 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 String name, 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
Constructs this info.- Parameters:
elementType
- type to which to convert.
-
ConvertElementInfo
Constructs this info.- Parameters:
elementType
- type to which to convert.canInfoBeLost
- indicates if info can be lost by conversion.
-
-
Method Details
-
getName
Gets name of conversion.- Returns:
- name of conversion.
-
getElementType
Gets type of the element to which to convert.- Returns:
- type of the element to which to convert.
-
getSymbolType
Type of the symbol to which to convert.- Returns:
- type of the symbol to which to convert.
-
getHumanName
Gets human-readable format of the conversion.- Returns:
- human-readable format of the conversion.
-
compareTo
- Specified by:
compareTo
in interfaceComparable<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
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
Indicates if element can be converted.- Parameters:
element
- element to convert.- Returns:
- true if element can be converted, false otherwise.
-
isConvertingSourceEditable
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
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.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
-
hashCode
public int hashCode() -
getCategory
- Returns:
- category of info used for grouping
-
setCategory
Set category of info used for grouping of targets in UI.- Parameters:
category
- category
-
getElementIDSuffix
Gets element ID suffix.- Returns:
- element ID suffix.
-
setElementIDSuffix
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
Set stereotypes to apply to converted element after conversion- Parameters:
stereotypes
- stereotypes
-
getAdditionalStereotypes
- Returns:
- some stereotypes to apply to converted element after conversion
-
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 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(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
-
isReplaceSourcePresentationElement
Check if source presentation element may be replaced. Default implementation checks is symbol is readonly- Parameters:
sourcePresentationElement
- presentation element to check- Returns:
- true if presentation element may be replaced
-