Class ReportHelper
- java.lang.Object
-
- java.util.Observable
-
- com.nomagic.magicreport.engine.Tool
-
- com.nomagic.magicdraw.magicreport.helper.ReportHelper
-
- All Implemented Interfaces:
com.nomagic.magicreport.engine.ITool
,com.nomagic.magicreport.IVariable
,java.io.Serializable
,java.lang.Cloneable
@OpenApiAll public class ReportHelper extends com.nomagic.magicreport.engine.Tool
Contains utilities functions for template report. Context name of this class is "report". Public functions of this class are able to access via template by using$report
For example:<code> #foreach ($rel in $report.getRelationships($package)) $rel.name #end </code>
- Since:
- Jun 13, 2007e
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ICON_PROPERTY_RETINASCALING
-
Constructor Summary
Constructors Constructor Description ReportHelper()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.util.Collection<Element>
collectRelationships(Element element)
Gets direct relationships of specified element.java.util.Collection<Element>
collectRelationships(Element element, boolean includeIndirect)
Gets relationships of specified element.java.util.Collection<Element>
collectRelationships(Element element, boolean includeIndirect, boolean isRecursive)
Gets relationships of specified element.boolean
containsStereotype(Element element, java.lang.String stereotypeName)
Returns true if element contains a stereotype (include all derived stereotype) for the specified stereotype name.boolean
containsStereotype(Element element, java.lang.String stereotypeName, boolean includeDerived)
Returns true if element contains a stereotype for the specified stereotype name.java.lang.String
createValueSpecificationText(ValueSpecification specification)
Create text represents the ValueSpecification element.void
ensureLoad(Diagram diagram)
java.util.Collection<Element>
filter(java.util.Collection<Element> elementList, java.lang.String propertyName, java.util.Collection<?> propertyValue)
Return the collection from the element list filtered by specified property name.java.util.Collection<BaseElement>
filterClassName(java.util.Collection<BaseElement> elementList, java.util.Collection<java.lang.String> shortNameForClassTypes)
Return the collection from the element list filtered by short name for class types.java.util.Collection<Diagram>
filterDiagram(java.util.Collection<Diagram> diagramList, java.util.Collection<java.lang.String> digramTypes)
Return the collection from the diagram list filtered by types.java.util.Collection<BaseElement>
filterElement(java.util.Collection<BaseElement> elementList, java.util.Collection<java.lang.String> humanTypes)
Return the collection from the element list filtered by human types.java.util.List<Element>
filterElementByElementFilters(java.util.List<Element> elements, java.util.List<com.nomagic.magicdraw.ui.ElementFilter> elementFilters)
java.util.Collection<BaseElement>
filterElementByStereotypeName(java.util.Collection<BaseElement> elementList, java.util.Collection<java.lang.String> stereotypesNames)
Return the collection from the element list filtered by stereotype.java.util.Collection<BaseElement>
filterElementType(java.util.Collection<BaseElement> elementList, java.util.Collection<java.lang.String> elementTypes)
Return the collection from the element list filtered by element types.java.util.List<Element>
filterVisibleElement(java.util.List<Element> elements)
java.util.List<Element>
filterVisibleElement(java.util.List<Element> elements, boolean includeAuxiliaryResources)
Element
findDiagramByName(java.lang.String elementName)
java.util.Collection<Element>
findElementByName(java.util.Collection<Element> source, java.lang.String regex)
Search and return the elements from name by regular expression.Element
findElementInCollection(java.util.Collection<? extends Element> col, java.lang.String elementName)
Search and return the element in the collection by element name.java.util.Collection<Element>
findRelationship(Package modelPackage)
Search and return a collection of relationship element inside package.java.util.Collection<Element>
findRelationship(Package modelPackage, boolean recursive)
Search and return a collection of relationship element inside package.java.lang.String
getActorNumber(Element element)
Return the actor ID of Actor.java.util.List<Class>
getAllCustomizationsByElement(Element element)
Get all customizations from specific element.java.util.List<Class>
getAllCustomizationsByElement(Element element, java.lang.Object aStereotype)
Get all customizations from specific stereotype on element.java.util.List<Class>
getAllCustomizationsByTarget(java.lang.Object targetElement)
Get all customizations from specific target element of customization element.java.util.List<FlowStep>
getAlternativeFlows(UseCase useCase)
Find and return all alternative flows from given use case.Stereotype
getAppliedStereotypeByName(Element element, java.lang.String stereotypeName)
Returns stereotype assigned to element.Stereotype
getAppliedStereotypeByString(Element element, java.lang.String stereotype)
Deprecated.java.io.File
getAttachedFile(Element element)
Get file from attached file.java.lang.Object
getAttachedImage(Element element)
java.lang.Object
getAttachedImage(Element element, java.lang.String cannotRenderImageMsg)
Get image from attached image.java.util.Collection
getBaseClassAssociations(Classifier classifier)
Gets the classifier associations.static java.util.List<Classifier>
getBaseClassifiers(Classifier classifier)
Return classifier based elements.java.util.Collection
getBaseClassInheritableAttributes(Classifier classifier)
Gets the classifier inheritable attributes.java.util.Collection
getBaseClassInheritableOperations(Classifier classifier)
Gets the classifier inheritable operations.java.util.Collection
getBaseClassPorts(Classifier classifier)
Gets the classifier port.java.util.Collection
getBaseRealizedInterfaces(BehavioredClassifier behavioredClassifier)
Gets the behavior classifier realized interfaces.java.util.Collection
getBaseRelations(Classifier classifier)
Gets the classifier relations.java.util.List<FlowStep>
getBasicFlows(UseCase useCase)
Find and return a list of basic flows from given use case.Element
getClientElement(Element element)
Gets relationship client.java.lang.String
getComment(Element element)
Returns documentation of given element.com.nomagic.magicreport.Image
getCustomImage(PresentationElement presentationElement)
Return original image of Image property from presentationElementcom.nomagic.magicreport.Image
getCustomImage(Element element)
Return original image of Image propertyElementImageHelper.ImageInformation
getCustomImageInformation(Element element)
Return a CustomImageHolder informationjava.lang.Object
getCustomizationProperty(Element element, java.lang.Object aStereotype, java.lang.String propertyName)
Return property value from Customization element of the specified stereotype, on the element.java.lang.String
getCustomizationPropertyString(Element element, java.lang.Object aStereotype, java.lang.String propertyName)
Return property value as string from Customization element of the specified stereotype, on the element.com.nomagic.magicdraw.ui.ElementFilter
getDefaultElementFilter()
java.util.Collection<Classifier>
getDerivedClassifiers(Classifier parentClassifier)
Returns classifier derived elements.java.util.Collection<Element>
getDiagramElements(DiagramPresentationElement diagram)
Gets presentation elements from this diagram.java.util.Collection<Element>
getDiagramElements(Diagram diagram)
Gets elements from this diagram.java.lang.String
getDiagramType(Diagram diagram)
Gets diagram type.java.lang.Object
getDSLProperty(Element element, java.lang.String propertyName)
Get DSL Property.Comment
getElementComment(Element element)
Returns comment annotated to this element.java.lang.String
getElementName(java.lang.Object element)
Gets name of the element.java.util.List<Property>
getElementProperties(Element element)
Get all properties from specific element.java.util.List<Property>
getElementProperties(Element element, java.lang.String mode)
Collects properties that appears in element's specification dialog tree at specific view mode (Standard/Expert/All)java.util.List<java.lang.String>
getElementPropertiesName(Element element)
Get name of all properties from specific element.java.util.List<java.lang.String>
getElementPropertiesNameWithMode(Element element)
Get name of all properties from specific element and current mode.java.util.List<java.lang.String>
getElementPropertiesNameWithMode(Element element, java.lang.String mode)
Get name of all properties from specific element and specific mode.java.lang.String
getElementURL(Element element)
Retrieve MagicDraw's element URL.java.util.List<FlowStep>
getExceptionalFlows(UseCase useCase)
Find and return a basic flow from given use case.com.nomagic.magicdraw.ui.ElementFilter
getExcludeAuxiliaryResourceFilter()
com.nomagic.magicdraw.ui.ElementFilter
getExcludeRelationshipElementFilter()
com.nomagic.magicreport.Image
getIconFor(BaseElement element)
Return image icon for element.com.nomagic.magicreport.Image
getIconFor(BaseElement element, boolean allowDuplicate)
Return image icon for element.com.nomagic.magicreport.Image
getIconFor(BaseElement element, boolean allowDuplicate, java.util.Map<java.lang.String,java.lang.String> iconProperty)
Return image icon for element.com.nomagic.magicreport.Image
getIconFor(BaseElement element, java.lang.String prefix, java.lang.String suffix, boolean hashCode)
Return image icon for element.com.nomagic.magicreport.Image
getIconFor(BaseElement element, java.lang.String prefix, java.lang.String suffix, boolean hashCode, boolean allowDuplicate)
Return image icon for element.com.nomagic.magicreport.Image
getIconFor(BaseElement element, java.lang.String prefix, java.lang.String suffix, boolean hashCode, boolean allowDuplicate, java.util.Map<java.lang.String,java.lang.String> iconProperty)
Return image icon for element.com.nomagic.magicreport.Image
getIconFor(BaseElement element, java.lang.String prefix, java.lang.String suffix, boolean hashCode, java.util.Map<java.lang.String,java.lang.String> iconProperty)
Return image icon for element.com.nomagic.magicreport.Image
getIconFor(BaseElement element, java.util.Map<java.lang.String,java.lang.String> iconProperty)
Return image icon for element.com.nomagic.magicreport.Image
getIconFor(java.lang.String type)
Return image icon for element.com.nomagic.magicreport.Image
getIconFor(java.lang.String type, java.lang.String prefix, java.lang.String suffix, boolean hashCode)
Return image icon for element.com.nomagic.magicreport.Image
getIconFor(java.lang.String type, java.lang.String prefix, java.lang.String suffix, boolean hashCode, java.util.Map<java.lang.String,java.lang.String> iconProperty)
Return image icon for element.com.nomagic.magicreport.Image
getIconFor(java.lang.String type, java.util.Map<java.lang.String,java.lang.String> iconProperty)
Return image icon for element.java.lang.String
getIconId(BaseElement element, java.lang.String prefix, java.lang.String suffix, boolean hashCode, boolean allowDuplicate, ResizableIcon icon)
java.lang.Object
getImageFor(Element element)
Create image from element.java.lang.Object
getImageFor(Element element, int dpi)
Create image from element.java.lang.Object
getImageFor(java.lang.Object object, boolean allowDuplicate)
Create image from object.java.lang.Object
getImageFor(java.lang.Object object, boolean allowDuplicate, java.lang.String cannotRenderImageMsg)
Create image from object.java.lang.Object
getImageFor(java.lang.Object object, boolean allowDuplicate, java.lang.String cannotRenderImageMsg, int dpi)
Create image from object.java.util.Collection<Element>
getIncludeUseCase(UseCase useCase)
Gets use case included element.java.util.Collection<Element>
getInnerElement(Element element)
Return a collection of inner element.java.lang.String
getInteractionMessageType(Message message)
Gets interaction message type.java.lang.Object
getMetaClass(Element element)
Get meta class of specific elementjava.util.Collection<Class>
getMetaClass(Stereotype stereotype)
Get stereotype meta class.java.util.List<Element>
getOwnedElementsIncludingAdditional(Element element, boolean includePureOwned)
Return owned elements of the given Element including additional owned elements defined in DSL specification by additionalContentProperty.java.util.List<Element>
getOwnedElementsIncludingAdditional(Element element, boolean includePureOwned, boolean excludeRelationship)
Return owned elements of the given Element including additional owned elements defined in DSL specification by additionalContentProperty.java.util.List<Element>
getOwnedElementsIncludingAdditional(Element element, boolean includePureOwned, boolean excludeRelationship, boolean excludeAuxiliaryResources)
Return owned elements of the given Element including additional owned elements defined in DSL specification by additionalContentProperty.java.util.List<Element>
getOwnedElementsIncludingAdditional(Element element, boolean includePureOwned, boolean excludeRelationship, boolean excludeAuxiliaryResources, boolean excludeInvisibleElement)
Return owned elements of the given Element including additional owned elements defined in DSL specification by additionalContentProperty.static java.lang.String
getPackageQualifiedName(NamedElement namedElement, java.lang.String separator)
Get a qualified name by consider only Package and given element.java.util.Collection<Element>
getPackages(boolean includeSmartPackage)
java.util.Collection<PresentationElement>
getPresentationDiagramElements(Diagram diagram)
Gets presentation element in the diagram.java.util.Collection<PresentationElement>
getPresentationDiagramElements(Diagram diagram, boolean includeNonManipulator)
Gets presentation element in the diagram.com.nomagic.magicdraw.magicreport.helper.Polygon
getPresentationElementBounds(PresentationElement element)
Gets the bounds of this element in the form of a Polygon object.java.util.List<com.nomagic.magicdraw.magicreport.helper.Polygon>
getPresentationElementBounds(Diagram diagram, Element element)
Gets the bounds of this element in the form of a Polygon object.java.util.List<java.awt.Rectangle>
getPresentationElementRectangle(Diagram diagram, Element element)
Gets the bounds of this element in the form of a Rectangle object.java.util.Collection<PresentationElement>
getPresentationElements(Diagram diagram)
Deprecated.java.lang.Object
getProperty(Element element, java.lang.String propertyName)
Get the element property value.java.util.Set<com.nomagic.magicdraw.propertygroup.PropertyGroup>
getPropertyGroupsByElement(Element element, boolean addAlwaysVisible)
Get set ofPropertyGroup
by specific element.java.util.Collection<com.nomagic.magicdraw.propertygroup.PropertyGroup>
getPropertyGroupsByStereotype(Class stereotype)
Get collection ofPropertyGroup
by specific stereotype.java.util.List<Property>
getQProperties(Element element, java.lang.String propertyName)
Get list of properties for element with DSL property groups, and each property group has its own property.Property
getQProperty(Element element, java.lang.String propertyName)
Get a property for element with DSL property groups, and each property group has its own property.static java.lang.String
getQualifiedName(NamedElement namedElement, java.lang.String separator)
Get a qualified name.java.lang.String
getQualifiedOwnerName(NamedElement obj)
Deprecated.result from this method is incorrect.Element
getRecievingOperationalNode(Element element)
Get needline association ends.java.util.Collection<Element>
getRelationship(Element element)
Gets direct relationships of specified element.java.util.Collection<Element>
getRelationship(Element element, boolean recursive)
Gets direct relationships of specified element.java.util.Collection<Element>
getRelationship(Element element, boolean recursive, boolean includeIndirect)
Gets relationships of specified element.java.util.Collection<Actor>
getRelativeActor(Element element)
Gets element relative actor.java.lang.String
getRepresentationText(BaseElement e)
static Node
getRootNodeOfContainmentTree(boolean startWithPrimaryModel)
Get root node from containment tree.Node
getRootNodeOfDiagramTree()
Get root node from diagram tree.Element
getSendingOperationalNode(Element element)
Get needline association ends.java.lang.Object
getSlotProperty(Element element, java.lang.String classifierName)
Get slot property by classifier name If there are more than one classifier matching with specified parameters, return only the property of first matching classifier.java.util.List<java.lang.Object>
getSlotValue(Element element, java.lang.String classifierName, java.lang.String definingFeatureName)
Get slot value by classifier name and definingFeature name.java.lang.Object
getStereotypeProperty(Element element, Stereotype stereotype, java.lang.String propertyName)
Gets stereotype property.java.lang.Object
getStereotypeProperty(Element element, Stereotype stereotype, java.lang.String propertyName, boolean checkMultiplicity)
Gets stereotype property.java.lang.Object
getStereotypeProperty(Element element, java.lang.String stereotypeName, java.lang.String propertyName)
Gets stereotype property.java.lang.Object
getStereotypeProperty(Element element, java.lang.String stereotypeName, java.lang.String propertyName, boolean checkMultiplicity)
Gets stereotype property.static java.lang.Object
getStereotypeProperty(Element element, java.lang.String profileName, java.lang.String stereotypeName, java.lang.String propertyName)
Get Stereotype Property.java.util.List<java.lang.Object>
getStereotypePropertyList(Element element, java.lang.String stereotypeName, java.lang.String propertyName)
Deprecated.value return from this method is improperly converted.static java.lang.String
getStereotypePropertyString(Element element, Stereotype stereotype, java.lang.String propertyName)
Gets stereotype property as String value.static java.lang.String
getStereotypePropertyString(Element element, Stereotype stereotype, java.lang.String propertyName, java.lang.String separator)
Gets stereotype property as String value.static java.lang.String
getStereotypePropertyString(Element element, java.lang.String stereotypeName, java.lang.String propertyName)
Gets stereotype property as String value.static java.lang.String
getStereotypePropertyString(Element element, java.lang.String profileName, java.lang.String stereotypeName, java.lang.String propertyName)
Gets stereotype property as String value.static java.lang.String
getStereotypePropertyString(Element element, java.lang.String profileName, java.lang.String stereotypeName, java.lang.String propertyName, java.lang.String separator)
Gets stereotype property as String value.java.lang.String
getStereotypePropertyStringValue(java.lang.Object o)
Deprecated.value return from this method is improperly converted.java.util.List<Stereotype>
getStereotypes(Element element)
Gets all stereotypes applied to element.Element
getSupplierElement(Element element)
Gets relationship supplier.java.io.File
getTemplateFile(Element element)
Get template file from element.java.io.File
getTemplateFile(java.lang.String templateFileName, java.lang.String templateLocation, java.lang.String extension, java.lang.Object marker)
Get Template file from template file name/path.java.lang.String
getUCOwnerNumber(Element element)
Return the use case number or use case ID of element.java.util.Collection<BaseElement>
getUsageElements(java.util.Map<BaseElement,java.util.List<com.nomagic.magicdraw.uml.DependencyType>> usagesMap, Element element)
Gets the element usages from usage map.java.lang.String
getUsageRepresentationText(BaseElement be, boolean addFullPath)
Formats the usage subject.java.util.Map<BaseElement,java.util.List<com.nomagic.magicdraw.uml.DependencyType>>
getUsages(java.lang.Object selectedObjects)
Returns Usage Map of MD and then use getUsageElements method for returning the usage of the specified element.java.util.Collection<Element>
getUseCaseAssociatedElement(Element obj)
Deprecated.java.lang.String
getUseCaseNumber(Element element)
Return the use case number or use case ID of element.java.util.Collection<BaseElement>
getUsedBy(Element element)
Return a list of element used by this element (except diagram).com.nomagic.magicdraw.ui.ElementFilter
getVisibleElementFilter()
static boolean
hasBaseClassifier(Classifier classifier, java.lang.String baseClassifier)
Checks if element has base classifier with given name.boolean
hasProperty(Element element, java.lang.String propertyName)
Returns true when a property with a given name is specified on this element, false otherwise.boolean
hasStereotype(Element element)
Checks if element has stereotypes.boolean
hasStereotype(Element element, java.lang.String stereotype)
Deprecated.boolean
isAssignableFrom(Element element, java.lang.String classTypeName)
A function for checking super type of the specific element.boolean
isAttachedFile(Element element)
Check if element is attached file.boolean
isAttachedImage(Element element)
Check if element is attached image.boolean
isDerivedClassifier(Classifier parent, Classifier child)
Checks if child is derived from parent by generalization.boolean
isEmpty(java.lang.Object obj)
Test and return true if object is null, empty string or empty collection.boolean
isEmpty(java.lang.Object obj, boolean isIgnoreSpace)
Test and return true if object is null, empty string or empty collection.boolean
isInvisibleElement(BaseElement element)
boolean
isInvisibleElement(BaseElement element, boolean isTypeFilter)
boolean
isInvisibleElement(BaseElement element, com.nomagic.magicdraw.ui.ElementFilter elementFilter)
boolean
isNamedElement(Element element)
Returns whether the element anNamedElement
.boolean
isNull(java.lang.Object obj)
Test and return true if object is null.boolean
isRelationship(Element element)
Test and return true if element is relationship.boolean
isTypeOf(Element element, java.lang.String typeName)
A function for checking super type of the specific element.boolean
isTypeOf(Element element, java.lang.String typeName, boolean checkClassTypeName)
A function for checking super type of the specific element.static java.lang.Object
parseObjectForPrinting(java.lang.Object value)
Parses Strings and Collections of Stringscom.nomagic.magicdraw.magicreport.helper.Hyperlink
serialize(Hyperlink hyperlink)
Convertcom.nomagic.magicdraw.hyperlinks.Hyperlink
toHyperlink
.void
setActiveValidationEnabled(boolean enable)
java.lang.String
trimString(java.lang.String s)
Deprecated.replaced with $s.trim()-
Methods inherited from class com.nomagic.magicreport.engine.Tool
clone, getContext, getProperties, getProperty, getProperty, notifyObservers, setContext, setProperties
-
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, setChanged
-
-
-
-
Field Detail
-
ICON_PROPERTY_RETINASCALING
public static final java.lang.String ICON_PROPERTY_RETINASCALING
- See Also:
- Constant Field Values
-
-
Method Detail
-
getDSLProperty
public java.lang.Object getDSLProperty(Element element, java.lang.String propertyName)
Get DSL Property.- Parameters:
element
- the element.propertyName
- the property name.- Returns:
- the property value.
-
getStereotypeProperty
public java.lang.Object getStereotypeProperty(Element element, java.lang.String stereotypeName, java.lang.String propertyName)
Gets stereotype property.- Parameters:
element
- the element.stereotypeName
- the stereotype name.propertyName
- the property name.- Returns:
- the property value.
- See Also:
getStereotypeProperty(Element, Stereotype, String)
,getStereotypeProperty(Element, String, String, String)
-
getStereotypeProperty
public java.lang.Object getStereotypeProperty(Element element, java.lang.String stereotypeName, java.lang.String propertyName, boolean checkMultiplicity)
Gets stereotype property.- Parameters:
element
- the element.stereotypeName
- the stereotype name.propertyName
- the property name.checkMultiplicity
- check multiplicity before return value- Returns:
- the property value.
- See Also:
getStereotypeProperty(Element, Stereotype, String)
,getStereotypeProperty(Element, String, String, String)
-
parseObjectForPrinting
public static java.lang.Object parseObjectForPrinting(java.lang.Object value)
Parses Strings and Collections of Strings
-
getStereotypeProperty
public java.lang.Object getStereotypeProperty(Element element, Stereotype stereotype, java.lang.String propertyName)
Gets stereotype property.- Parameters:
element
- the element.stereotype
- the stereotype.propertyName
- the property name.- Returns:
- the property value.
- See Also:
getStereotypeProperty(Element, String, String)
,getStereotypeProperty(Element, String, String, String)
-
getStereotypeProperty
public java.lang.Object getStereotypeProperty(Element element, Stereotype stereotype, java.lang.String propertyName, boolean checkMultiplicity)
Gets stereotype property.- Parameters:
element
- the element.stereotype
- the stereotype.propertyName
- the property name.checkMultiplicity
- check multiplicity before return value- Returns:
- the property value.
- See Also:
getStereotypeProperty(Element, String, String)
,getStereotypeProperty(Element, String, String, String)
-
getStereotypeProperty
public static java.lang.Object getStereotypeProperty(Element element, java.lang.String profileName, java.lang.String stereotypeName, java.lang.String propertyName)
Get Stereotype Property.- Parameters:
element
- the element.profileName
- profile namestereotypeName
- the stereotype name.propertyName
- the property name.- Returns:
- the property value.
-
getStereotypePropertyList
@Deprecated public java.util.List<java.lang.Object> getStereotypePropertyList(Element element, java.lang.String stereotypeName, java.lang.String propertyName)
Deprecated.value return from this method is improperly converted.Gets stereotype property value as list of strings.- Parameters:
element
- element with assigned stereotypestereotypeName
- stereotype namepropertyName
- name of the property- Returns:
- List of the property name.
-
getStereotypePropertyString
public static java.lang.String getStereotypePropertyString(Element element, java.lang.String stereotypeName, java.lang.String propertyName)
Gets stereotype property as String value.- Parameters:
element
- the element instancestereotypeName
- the stereotype namepropertyName
- the property name- Returns:
- the value as String
-
getStereotypePropertyString
public static java.lang.String getStereotypePropertyString(Element element, Stereotype stereotype, java.lang.String propertyName)
Gets stereotype property as String value.- Parameters:
element
- the element instancestereotype
- the stereotype instancepropertyName
- the property name- Returns:
- the value as String
-
getStereotypePropertyString
public static java.lang.String getStereotypePropertyString(Element element, Stereotype stereotype, java.lang.String propertyName, java.lang.String separator)
Gets stereotype property as String value.- Parameters:
element
- the element instancestereotype
- the stereotype instancepropertyName
- the property nameseparator
- when property value is list, the string will be added when convert list to string- Returns:
- the value as String
-
getStereotypePropertyString
public static java.lang.String getStereotypePropertyString(Element element, java.lang.String profileName, java.lang.String stereotypeName, java.lang.String propertyName)
Gets stereotype property as String value.- Parameters:
element
- the element instanceprofileName
- profile namestereotypeName
- the stereotype namepropertyName
- the property name- Returns:
- the value as String
-
getStereotypePropertyString
public static java.lang.String getStereotypePropertyString(Element element, java.lang.String profileName, java.lang.String stereotypeName, java.lang.String propertyName, java.lang.String separator)
Gets stereotype property as String value.- Parameters:
element
- the element instanceprofileName
- profile namestereotypeName
- the stereotype namepropertyName
- the property nameseparator
- when property value is list, the string will be added when convert list to string- Returns:
- the value as String
-
getStereotypePropertyStringValue
@Deprecated public java.lang.String getStereotypePropertyStringValue(java.lang.Object o)
Deprecated.value return from this method is improperly converted.Gets Stereotype Property As String value.- Parameters:
o
- the property- Returns:
- the value as String
-
getRepresentationText
public java.lang.String getRepresentationText(BaseElement e)
-
isNamedElement
public boolean isNamedElement(Element element)
Returns whether the element anNamedElement
.- Parameters:
element
- element to test- Returns:
- true if given element is
NamedElement
; otherwise false
-
getAppliedStereotypeByString
@CheckForNull @Deprecated public Stereotype getAppliedStereotypeByString(Element element, java.lang.String stereotype)
Deprecated.Returns stereotype assigned to element.- Parameters:
element
- elementstereotype
- name of stereotype- Returns:
- assigned stereotype with that name.
-
getAppliedStereotypeByName
@CheckForNull public Stereotype getAppliedStereotypeByName(Element element, java.lang.String stereotypeName)
Returns stereotype assigned to element.- Parameters:
element
- elementstereotypeName
- name of stereotype- Returns:
- assigned stereotype with that name.
-
hasStereotype
@Deprecated public boolean hasStereotype(Element element, java.lang.String stereotype)
Deprecated.Checks if element has assigned stereotype with given name.- Parameters:
element
- element to checkstereotype
- stereotype name to check- Returns:
- true if element has assigned stereotype with given name
-
containsStereotype
public boolean containsStereotype(Element element, java.lang.String stereotypeName)
Returns true if element contains a stereotype (include all derived stereotype) for the specified stereotype name.- Parameters:
element
- element to teststereotypeName
- stereotype name to be tested- Returns:
- true if element contains a stereotype for the specified stereotype name.
- See Also:
containsStereotype(Element, String, boolean)
-
containsStereotype
public boolean containsStereotype(Element element, java.lang.String stereotypeName, boolean includeDerived)
Returns true if element contains a stereotype for the specified stereotype name.- Parameters:
element
- element to teststereotypeName
- stereotype name to be testedincludeDerived
- true if search target include all derived stereotypes; otherwise false- Returns:
- true if element contains a stereotype for the specified stereotype name.
- See Also:
containsStereotype(Element, String)
-
hasProperty
public boolean hasProperty(Element element, java.lang.String propertyName)
Returns true when a property with a given name is specified on this element, false otherwise.- Parameters:
element
- element to testpropertyName
- property name- Returns:
- true when a property with a given name is specified on this element, false otherwise.
-
getProperty
public java.lang.Object getProperty(Element element, java.lang.String propertyName) throws com.nomagic.magicdraw.magicreport.helper.PropertyNotFoundException
Get the element property value.- Parameters:
element
- the object that will be gotten that data.propertyName
- the field of the element.- Returns:
- the data of that field in the element.
- Throws:
com.nomagic.magicdraw.magicreport.helper.PropertyNotFoundException
- when a request property name is not found on target element.
-
getStereotypes
public java.util.List<Stereotype> getStereotypes(Element element) throws java.lang.IllegalArgumentException
Gets all stereotypes applied to element. This method is replaced with $element.appliedStereotype.- Parameters:
element
- the element- Returns:
- the stereotype instances
- Throws:
java.lang.IllegalArgumentException
- fromStereotypesHelper.getStereotypes
-
hasStereotype
public boolean hasStereotype(Element element) throws java.lang.IllegalArgumentException
Checks if element has stereotypes.- Parameters:
element
- element to check- Returns:
- true if has
- Throws:
java.lang.IllegalArgumentException
- if element is null
-
findElementInCollection
@CheckForNull public Element findElementInCollection(java.util.Collection<? extends Element> col, java.lang.String elementName)
Search and return the element in the collection by element name.- Parameters:
col
- the collection of elementselementName
- the name of element- Returns:
- the element instance, If it does not find, it will return null.
-
findDiagramByName
public Element findDiagramByName(java.lang.String elementName)
-
findElementByName
public java.util.Collection<Element> findElementByName(java.util.Collection<Element> source, java.lang.String regex)
Search and return the elements from name by regular expression.- Parameters:
source
- sourceregex
- the regular expression to which name is to be matched- Returns:
- collection of matches element
-
getDerivedClassifiers
public java.util.Collection<Classifier> getDerivedClassifiers(Classifier parentClassifier)
Returns classifier derived elements.- Parameters:
parentClassifier
- the parent class- Returns:
- collection of derived elements (classifiers)
-
hasBaseClassifier
public static boolean hasBaseClassifier(Classifier classifier, java.lang.String baseClassifier)
Checks if element has base classifier with given name.- Parameters:
classifier
- the classifierbaseClassifier
- base classifier name- Returns:
- true if the element contains specific base classifiers.
-
getBaseClassifiers
public static java.util.List<Classifier> getBaseClassifiers(Classifier classifier)
Return classifier based elements. The list contains all base classifiers include all its derived classifiers.- Parameters:
classifier
- the classifier- Returns:
- collection of based elements (classifiers)
-
getComment
public java.lang.String getComment(Element element)
Returns documentation of given element.- Parameters:
element
- the element which will be gotten the name.- Returns:
- the document
-
getElementComment
@CheckForNull public Comment getElementComment(Element element)
Returns comment annotated to this element. If comment is attached to this element, returns null.- Parameters:
element
- the element which will be gotten the Comment.- Returns:
- Comment instance of this element.
-
getRelativeActor
public java.util.Collection<Actor> getRelativeActor(Element element)
Gets element relative actor.- Parameters:
element
- the element- Returns:
- the collection of Actor.
-
getUseCaseAssociatedElement
@CheckForNull @Deprecated public java.util.Collection<Element> getUseCaseAssociatedElement(Element obj)
Deprecated.Gets associated Element.- Parameters:
obj
- the element that we would like to find the other part- Returns:
- the other parts
-
getIncludeUseCase
@CheckForNull public java.util.Collection<Element> getIncludeUseCase(UseCase useCase)
Gets use case included element.- Parameters:
useCase
- the UseCase instance- Returns:
- the collection of included use case.
-
trimString
@Deprecated public java.lang.String trimString(java.lang.String s)
Deprecated.replaced with $s.trim()Trim string.- Parameters:
s
- the String- Returns:
- the trimmed String
-
createValueSpecificationText
public java.lang.String createValueSpecificationText(ValueSpecification specification)
Create text represents the ValueSpecification element.- Parameters:
specification
- The given ValueSpecification.- Returns:
- the String value for ValueSpecification
-
getPresentationElements
@Deprecated public java.util.Collection<PresentationElement> getPresentationElements(Diagram diagram)
Deprecated.Gets presentation element in the diagram. This method equivalent togetPresentationDiagramElements(Diagram)
.- Parameters:
diagram
- the diagram instance.- Returns:
- the collection of elements.
- See Also:
getPresentationDiagramElements(Diagram)
-
getPresentationDiagramElements
public java.util.Collection<PresentationElement> getPresentationDiagramElements(Diagram diagram)
Gets presentation element in the diagram. This method will return all presentation elements from diagram except non-manipulator symbols.- Parameters:
diagram
- the diagram instance.- Returns:
- the collection of elements.
- See Also:
getPresentationDiagramElements(Diagram, boolean)
-
getPresentationDiagramElements
public java.util.Collection<PresentationElement> getPresentationDiagramElements(Diagram diagram, boolean includeNonManipulator)
Gets presentation element in the diagram.- Parameters:
diagram
- the diagram instance.includeNonManipulator
- true for include all non-manipulator element.- Returns:
- the collection of elements.
- See Also:
getPresentationDiagramElements(Diagram)
-
getPresentationElementBounds
@CheckForNull public com.nomagic.magicdraw.magicreport.helper.Polygon getPresentationElementBounds(PresentationElement element)
Gets the bounds of this element in the form of a Polygon object. The bounds specify this component's coordinate to its diagram.- Parameters:
element
- the presentation element on diagram.- Returns:
- the bound of element as Polygon
-
getPresentationElementRectangle
public java.util.List<java.awt.Rectangle> getPresentationElementRectangle(Diagram diagram, Element element)
Gets the bounds of this element in the form of a Rectangle object. The bounds specify this component's coordinate to its diagram.- Parameters:
diagram
- the target diagram.element
- the presentation element on given diagram.- Returns:
- the bound of element as Rectangle. If element is not found in the diagram, it will return null.
-
getPresentationElementBounds
public java.util.List<com.nomagic.magicdraw.magicreport.helper.Polygon> getPresentationElementBounds(Diagram diagram, Element element)
Gets the bounds of this element in the form of a Polygon object. The bounds specify this component's coordinate to its diagram.- Parameters:
diagram
- the target diagram.element
- the presentation element on given diagram.- Returns:
- the bound of element as Polygon. If element is not found in the diagram, it will return null.
-
getDiagramType
public java.lang.String getDiagramType(Diagram diagram)
Gets diagram type.- Parameters:
diagram
- the diagram instance.- Returns:
- the type of diagram.
-
getMetaClass
public java.util.Collection<Class> getMetaClass(Stereotype stereotype)
Get stereotype meta class.- Parameters:
stereotype
- the stereotype- Returns:
- the collection of Meta Class
-
getMetaClass
public java.lang.Object getMetaClass(Element element)
Get meta class of specific element- Parameters:
element
- element- Returns:
- a Meta Class or Collection of Meta Class
-
getDiagramElements
public java.util.Collection<Element> getDiagramElements(Diagram diagram)
Gets elements from this diagram.- Parameters:
diagram
- the target diagram.- Returns:
- the collection of elements.
-
getDiagramElements
public java.util.Collection<Element> getDiagramElements(DiagramPresentationElement diagram)
Gets presentation elements from this diagram.- Parameters:
diagram
- the target diagram.- Returns:
- the collection of elements.
-
getQualifiedOwnerName
@Deprecated public java.lang.String getQualifiedOwnerName(NamedElement obj)
Deprecated.result from this method is incorrect. Use $element.owner.qualifiedNameGet qualified owner name.- Parameters:
obj
- the object instance- Returns:
- the qualified owner name
-
getQualifiedName
public static java.lang.String getQualifiedName(NamedElement namedElement, java.lang.String separator)
Get a qualified name. Qualified is a name which allows the NamedElement to be identified within a hierarchy of nested Namespaces. It is constructed from the names of the containing namespaces starting at the root of the hierarchy and ending with the name of the NamedElement itself.- Parameters:
namedElement
- NamedElementseparator
- separator symbol. If value is null or empty string, the '::' will be used.- Returns:
- a qualified name.
-
getPackageQualifiedName
public static java.lang.String getPackageQualifiedName(NamedElement namedElement, java.lang.String separator)
Get a qualified name by consider only Package and given element. Model and Profile will not be included on the qualified name.For example: The element hierarchy is
When template code is:Design : Model -> com : Package -> nomagic : Package -> ui -> Package -> BaseDialog : Class
Where $class is "BaseDialog" element, the result from above code will be:$report.getPackageQualifiedName($class, ".")
com.nomagic.ui.BaseDialog
- Parameters:
namedElement
- NamedElementseparator
- separator symbol. If value is null or empty string, the '::' will be used.- Returns:
- a qualified name.
-
serialize
public com.nomagic.magicdraw.magicreport.helper.Hyperlink serialize(Hyperlink hyperlink)
Convertcom.nomagic.magicdraw.hyperlinks.Hyperlink
toHyperlink
.- Parameters:
hyperlink
- the magicdraw hyperlink- Returns:
- the magic report hyperlink instance
-
getSendingOperationalNode
public Element getSendingOperationalNode(Element element)
Get needline association ends.- Parameters:
element
- element- Returns:
- needline association ends
-
getRecievingOperationalNode
public Element getRecievingOperationalNode(Element element)
Get needline association ends.- Parameters:
element
- element- Returns:
- needline association ends
-
findRelationship
public java.util.Collection<Element> findRelationship(Package modelPackage)
Search and return a collection of relationship element inside package.- Parameters:
modelPackage
- package element- Returns:
- Collection of relationship in this package
-
findRelationship
public java.util.Collection<Element> findRelationship(Package modelPackage, boolean recursive)
Search and return a collection of relationship element inside package.- Parameters:
modelPackage
- package elementrecursive
- if true, perform recursively- Returns:
- Collection of relationship in this package
-
getRelationship
public java.util.Collection<Element> getRelationship(Element element)
Gets direct relationships of specified element.- Parameters:
element
- Element element to be collect- Returns:
- Collection of relationship
-
getRelationship
public java.util.Collection<Element> getRelationship(Element element, boolean recursive)
Gets direct relationships of specified element.- Parameters:
element
- Element element to be collectrecursive
- if true, perform recursively- Returns:
- Collection of relationship
-
getRelationship
public java.util.Collection<Element> getRelationship(Element element, boolean recursive, boolean includeIndirect)
Gets relationships of specified element.- Parameters:
element
- element to be collectrecursive
- if true, perform recursivelyincludeIndirect
- true to include indirect relationships- Returns:
- Collection of relationship
-
collectRelationships
public java.util.Collection<Element> collectRelationships(Element element)
Gets direct relationships of specified element.- Parameters:
element
- Element element to be collect- Returns:
- Collection of relationship
-
collectRelationships
public java.util.Collection<Element> collectRelationships(Element element, boolean includeIndirect)
Gets relationships of specified element.- Parameters:
element
- element to be collectincludeIndirect
- true to include indirect relationships- Returns:
- Collection of relationship
-
collectRelationships
public java.util.Collection<Element> collectRelationships(Element element, boolean includeIndirect, boolean isRecursive)
Gets relationships of specified element.- Parameters:
element
- element to be collectincludeIndirect
- true to include indirect relationshipsisRecursive
- if true, perform recursively- Returns:
- Collection of relationship
-
getClientElement
public Element getClientElement(Element element)
Gets relationship client.- Parameters:
element
- relationship model element.- Returns:
- client element
-
getSupplierElement
public Element getSupplierElement(Element element)
Gets relationship supplier.- Parameters:
element
- relationship model element.- Returns:
- supplier element
-
getInnerElement
public java.util.Collection<Element> getInnerElement(Element element)
Return a collection of inner element.- Parameters:
element
- Element element to be collect- Returns:
- Collection of inner
-
getIconFor
public com.nomagic.magicreport.Image getIconFor(BaseElement element)
Return image icon for element.- Parameters:
element
- a Magic Draw element- Returns:
- Image object for element's icon
-
getIconFor
public com.nomagic.magicreport.Image getIconFor(BaseElement element, java.util.Map<java.lang.String,java.lang.String> iconProperty)
Return image icon for element.- Parameters:
element
- a Magic Draw elementiconProperty
- custom property to create icon- Returns:
- Image object for element's icon
-
getIconFor
public com.nomagic.magicreport.Image getIconFor(BaseElement element, boolean allowDuplicate)
Return image icon for element.- Parameters:
element
- a Magic Draw elementallowDuplicate
- true to always create new icon and don't keep the icon in map- Returns:
- Image object for element's icon
-
getIconFor
public com.nomagic.magicreport.Image getIconFor(BaseElement element, boolean allowDuplicate, java.util.Map<java.lang.String,java.lang.String> iconProperty)
Return image icon for element.- Parameters:
element
- a Magic Draw elementallowDuplicate
- true to always create new icon and don't keep the icon in mapiconProperty
- custom property to create icon- Returns:
- Image object for element's icon
-
getIconFor
public com.nomagic.magicreport.Image getIconFor(BaseElement element, java.lang.String prefix, java.lang.String suffix, boolean hashCode)
Return image icon for element. In case ofhashCode
equals true, icon's name format is set to "icon_"+hash code and doesn't include prefix/suffix.- Parameters:
element
- a MagicDraw elementprefix
- prefix for icon's namesuffix
- suffix for icon's namehashCode
- uses hash code in icon's name- Returns:
- Image object for element's icon
-
getIconFor
public com.nomagic.magicreport.Image getIconFor(BaseElement element, java.lang.String prefix, java.lang.String suffix, boolean hashCode, java.util.Map<java.lang.String,java.lang.String> iconProperty)
Return image icon for element. In case ofhashCode
equals true, icon's name format is set to "icon_"+hash code and doesn't include prefix/suffix.- Parameters:
element
- a MagicDraw elementprefix
- prefix for icon's namesuffix
- suffix for icon's namehashCode
- uses hash code in icon's nameiconProperty
- custom property to create icon- Returns:
- Image object for element's icon
-
getIconFor
public com.nomagic.magicreport.Image getIconFor(BaseElement element, java.lang.String prefix, java.lang.String suffix, boolean hashCode, boolean allowDuplicate)
Return image icon for element. In case ofhashCode
equals true, icon's name format is set to "icon_"+hash code and doesn't include prefix/suffix.- Parameters:
element
- a MagicDraw elementprefix
- prefix for icon's namesuffix
- suffix for icon's namehashCode
- uses hash code in icon's nameallowDuplicate
- true to always create new icon and don't keep the icon in map- Returns:
- Image object for element's icon
-
getIconId
public java.lang.String getIconId(BaseElement element, java.lang.String prefix, java.lang.String suffix, boolean hashCode, boolean allowDuplicate, ResizableIcon icon)
-
getIconFor
@CheckForNull public com.nomagic.magicreport.Image getIconFor(BaseElement element, java.lang.String prefix, java.lang.String suffix, boolean hashCode, boolean allowDuplicate, @CheckForNull java.util.Map<java.lang.String,java.lang.String> iconProperty)
Return image icon for element. In case ofhashCode
equals true, icon's name format is set to "icon_"+hash code and doesn't include prefix/suffix.- Parameters:
element
- a MagicDraw elementprefix
- prefix for icon's namesuffix
- suffix for icon's namehashCode
- uses hash code in icon's nameallowDuplicate
- true to always create new icon and don't keep the icon in mapiconProperty
- custom property to create icon- Returns:
- Image object for element's icon
-
getIconFor
public com.nomagic.magicreport.Image getIconFor(java.lang.String type)
Return image icon for element.- Parameters:
type
- element type- Returns:
- Image object for element's icon
-
getIconFor
public com.nomagic.magicreport.Image getIconFor(java.lang.String type, java.util.Map<java.lang.String,java.lang.String> iconProperty)
Return image icon for element.- Parameters:
type
- element type- Returns:
- Image object for element's icon
-
getIconFor
public com.nomagic.magicreport.Image getIconFor(java.lang.String type, java.lang.String prefix, java.lang.String suffix, boolean hashCode)
Return image icon for element. In case ofhashCode
equals true, icon's name format is set to "icon_"+hash code and doesn't include prefix/suffix.- Parameters:
type
- element typeprefix
- prefix for icon's namesuffix
- suffix for icon's namehashCode
- uses hash code in icon's name- Returns:
- Image object for element's icon
-
getIconFor
public com.nomagic.magicreport.Image getIconFor(java.lang.String type, java.lang.String prefix, java.lang.String suffix, boolean hashCode, java.util.Map<java.lang.String,java.lang.String> iconProperty)
Return image icon for element. In case ofhashCode
equals true, icon's name format is set to "icon_"+hash code and doesn't include prefix/suffix.- Parameters:
type
- element typeprefix
- prefix for icon's namesuffix
- suffix for icon's namehashCode
- uses hash code in icon's nameiconProperty
- custom property to create icon- Returns:
- Image object for element's icon
-
getCustomImage
public com.nomagic.magicreport.Image getCustomImage(PresentationElement presentationElement)
Return original image of Image property from presentationElement- Parameters:
presentationElement
- a presentationElement- Returns:
- original image in Image property
-
getCustomImage
public com.nomagic.magicreport.Image getCustomImage(Element element)
Return original image of Image property- Parameters:
element
- an element- Returns:
- original image in Image property
-
getCustomImageInformation
public ElementImageHelper.ImageInformation getCustomImageInformation(Element element)
Return a CustomImageHolder information- Parameters:
element
- element- Returns:
- CustomImageHolder
-
isNull
public boolean isNull(java.lang.Object obj)
Test and return true if object is null.- Parameters:
obj
- object being tested.- Returns:
- true if object is null
-
isEmpty
public boolean isEmpty(java.lang.Object obj)
Test and return true if object is null, empty string or empty collection.- Parameters:
obj
- object being tested.- Returns:
- true if object is null, empty string or empty collection.
-
isEmpty
public boolean isEmpty(java.lang.Object obj, boolean isIgnoreSpace)
Test and return true if object is null, empty string or empty collection.- Parameters:
obj
- object being tested.isIgnoreSpace
- true for ignoring all spaces, line feeds, etc. for html string only- Returns:
- true if object is null, empty string or empty collection.
-
isRelationship
public boolean isRelationship(Element element)
Test and return true if element is relationship.- Parameters:
element
- element being tested.- Returns:
- true if object is relationship
-
getInteractionMessageType
public java.lang.String getInteractionMessageType(Message message)
Gets interaction message type.- Parameters:
message
- Message- Returns:
- type of message
-
getUsageRepresentationText
public java.lang.String getUsageRepresentationText(BaseElement be, boolean addFullPath)
Formats the usage subject. The output string is the same as Result column of Used by table in Magic Draw.- Parameters:
be
-ModelElement
to format.addFullPath
- use full path.- Returns:
- formatted element, String.
-
getUsedBy
public java.util.Collection<BaseElement> getUsedBy(Element element)
Return a list of element used by this element (except diagram).- Parameters:
element
- the the element which will be gotten the list of element name that uses the specified element.- Returns:
- Collection of elements used by input element.
-
getUsages
public java.util.Map<BaseElement,java.util.List<com.nomagic.magicdraw.uml.DependencyType>> getUsages(java.lang.Object selectedObjects)
Returns Usage Map of MD and then use getUsageElements method for returning the usage of the specified element.- Parameters:
selectedObjects
- the elements that this method will find the usage.- Returns:
- Map of Usages of elements
-
getUsageElements
@CheckForNull public java.util.Collection<BaseElement> getUsageElements(java.util.Map<BaseElement,java.util.List<com.nomagic.magicdraw.uml.DependencyType>> usagesMap, Element element)
Gets the element usages from usage map.- Parameters:
usagesMap
- the Usages Map of MagicDraw.element
- the element which will be gotten the list of element name that uses the specified element.- Returns:
- Collection of usage name of elements.
-
getElementName
public java.lang.String getElementName(java.lang.Object element)
Gets name of the element. If the name of element is empty, it will return "<unnamed>". This method performs the following procedures:- If element is generalized from NamedElement, return $element.name
- If element is generalized from Slot, return $element.definingFeature.name
- If element is an UML element, return $element.humanName
- else return $element.toString()
- Parameters:
element
- the element.- Returns:
- element name
-
filterDiagram
public java.util.Collection<Diagram> filterDiagram(java.util.Collection<Diagram> diagramList, java.util.Collection<java.lang.String> digramTypes)
Return the collection from the diagram list filtered by types.Example:
#foreach ($d in $report.filterElement($Diagram, ['Use Case Diagram', 'Class Diagram']) $d.name #end
- Parameters:
diagramList
- the collection of diagrams.digramTypes
- the collection of diagram types which is used to filter.- Returns:
- the collection of filtered diagrams.
-
filterElement
public java.util.Collection<BaseElement> filterElement(java.util.Collection<BaseElement> elementList, java.util.Collection<java.lang.String> humanTypes)
Return the collection from the element list filtered by human types.Example:
#foreach ($e in $report.filterElement($elements, ['Class', 'Interface']) $e.name $e.humanType #end
- Parameters:
elementList
- the collection of element.humanTypes
- the collection of human types which is used to filter.- Returns:
- the collection of filtered elements.
-
filterElementByStereotypeName
public java.util.Collection<BaseElement> filterElementByStereotypeName(java.util.Collection<BaseElement> elementList, java.util.Collection<java.lang.String> stereotypesNames)
Return the collection from the element list filtered by stereotype.- Parameters:
elementList
- the collection of element.stereotypesNames
- the collection of stereotypes names which is used to filter.- Returns:
- the collection of filtered elements.
-
filterElementType
public java.util.Collection<BaseElement> filterElementType(java.util.Collection<BaseElement> elementList, java.util.Collection<java.lang.String> elementTypes)
Return the collection from the element list filtered by element types.Example:
#foreach ($e in $report.filterElementType($elements, ['class', 'interface']) $e.name $e.elementType #end
- Parameters:
elementList
- the collection of element.elementTypes
- the collection of element types which is used to filter.- Returns:
- the collection of filtered elements.
-
filterClassName
public java.util.Collection<BaseElement> filterClassName(java.util.Collection<BaseElement> elementList, java.util.Collection<java.lang.String> shortNameForClassTypes)
Return the collection from the element list filtered by short name for class types.Example:
#foreach ($e in $report.filterClassName($elements, ['Diagram', 'UseCase']) $e.name $e.className #end
- Parameters:
elementList
- the collection of element.shortNameForClassTypes
- the collection of short name for class type which is used to filter.- Returns:
- the collection of filtered elements.
-
filter
public java.util.Collection<Element> filter(java.util.Collection<Element> elementList, java.lang.String propertyName, java.util.Collection<?> propertyValue)
Return the collection from the element list filtered by specified property name.Example:
#foreach ($e in $report.filter($elements, 'name', ['foo', 'bar']) $e.name #end
- Parameters:
elementList
- the collection of element.propertyName
- the property name which is used to filter.propertyValue
- the collection of element property values which is used to filter.- Returns:
- the collection of filtered elements.
-
getBaseClassInheritableAttributes
public java.util.Collection getBaseClassInheritableAttributes(Classifier classifier)
Gets the classifier inheritable attributes.- Parameters:
classifier
- the Classifier.- Returns:
- the Collection of Attributes.
-
getBaseClassInheritableOperations
public java.util.Collection getBaseClassInheritableOperations(Classifier classifier)
Gets the classifier inheritable operations.- Parameters:
classifier
- the Classifier.- Returns:
- the Collection of Operations.
-
getBaseClassAssociations
public java.util.Collection getBaseClassAssociations(Classifier classifier)
Gets the classifier associations.- Parameters:
classifier
- the Classifier.- Returns:
- the Collection of Associations.
-
getBaseRelations
public java.util.Collection getBaseRelations(Classifier classifier)
Gets the classifier relations.- Parameters:
classifier
- the Classifier.- Returns:
- the Collection of Relations.
-
getBaseClassPorts
public java.util.Collection getBaseClassPorts(Classifier classifier)
Gets the classifier port.- Parameters:
classifier
- the Classifier.- Returns:
- the Collection of Ports.
-
getBaseRealizedInterfaces
public java.util.Collection getBaseRealizedInterfaces(BehavioredClassifier behavioredClassifier)
Gets the behavior classifier realized interfaces.- Parameters:
behavioredClassifier
- the BehavioredClassifier.- Returns:
- the Collection of RealizedInterfaces.
-
isDerivedClassifier
public boolean isDerivedClassifier(Classifier parent, Classifier child)
Checks if child is derived from parent by generalization.- Parameters:
parent
- parentchild
- possible parent- Returns:
- true if derived
-
getUseCaseNumber
public java.lang.String getUseCaseNumber(Element element)
Return the use case number or use case ID of element.- Parameters:
element
- the element- Returns:
- the use case number.
-
getActorNumber
public java.lang.String getActorNumber(Element element)
Return the actor ID of Actor.- Parameters:
element
- element- Returns:
- the actor ID
-
getUCOwnerNumber
public java.lang.String getUCOwnerNumber(Element element)
Return the use case number or use case ID of element.- Parameters:
element
- the element- Returns:
- the use case owner number or ID.
-
getElementURL
public java.lang.String getElementURL(Element element)
Retrieve MagicDraw's element URL.- Parameters:
element
- element object- Returns:
- MagicDraw's element URL
-
getBasicFlows
public java.util.List<FlowStep> getBasicFlows(UseCase useCase)
Find and return a list of basic flows from given use case. If use case scenario is not being used, it will retrieve the value from "requirementUseCase" stereotype tags.- Parameters:
useCase
- a use case.- Returns:
- a list of flow step
FlowStep
-
getAlternativeFlows
public java.util.List<FlowStep> getAlternativeFlows(UseCase useCase)
Find and return all alternative flows from given use case. The alternative flows will be listed from all possible branches of basic flows. If use case scenario is not being used, it will the retrieve value from "requirementUseCase" stereotype tags.- Parameters:
useCase
- a use case.- Returns:
- a list of flow step
FlowStep
-
getExceptionalFlows
public java.util.List<FlowStep> getExceptionalFlows(UseCase useCase)
Find and return a basic flow from given use case. If use case scenario is not being used, it will the retrieve value from "requirementUseCase" stereotype tags.- Parameters:
useCase
- a use case.- Returns:
- a list of flow step
FlowStep
-
getSlotValue
public java.util.List<java.lang.Object> getSlotValue(Element element, java.lang.String classifierName, java.lang.String definingFeatureName)
Get slot value by classifier name and definingFeature name. If there are more than one slots matching with specified parameters, return only the value of first matching slot.- Parameters:
element
- an element.classifierName
- classifier name. [case-sensitive]definingFeatureName
- defining feature name. [case-sensitive]- Returns:
- result value in ValueSpecification or value in array of ValueSpecification, up to multiplicity.
-
getSlotProperty
@CheckForNull public java.lang.Object getSlotProperty(Element element, java.lang.String classifierName)
Get slot property by classifier name If there are more than one classifier matching with specified parameters, return only the property of first matching classifier.- Parameters:
element
- an element.classifierName
- classifier name. [case-sensitive]- Returns:
- slot property
-
getOwnedElementsIncludingAdditional
public java.util.List<Element> getOwnedElementsIncludingAdditional(Element element, boolean includePureOwned)
Return owned elements of the given Element including additional owned elements defined in DSL specification by additionalContentProperty.- Parameters:
element
- an element to be found owned elementincludePureOwned
- include element owned directly in ownedElement UML metaproperty- Returns:
- owned elements of the given Element
-
getOwnedElementsIncludingAdditional
public java.util.List<Element> getOwnedElementsIncludingAdditional(Element element, boolean includePureOwned, boolean excludeRelationship)
Return owned elements of the given Element including additional owned elements defined in DSL specification by additionalContentProperty.- Parameters:
element
- an element to be found owned elementincludePureOwned
- include element owned directly in ownedElement UML metapropertyexcludeRelationship
- true to exclude relationship
-
getOwnedElementsIncludingAdditional
public java.util.List<Element> getOwnedElementsIncludingAdditional(Element element, boolean includePureOwned, boolean excludeRelationship, boolean excludeAuxiliaryResources)
Return owned elements of the given Element including additional owned elements defined in DSL specification by additionalContentProperty.- Parameters:
element
- an element to be found owned elementincludePureOwned
- include element owned directly in ownedElement UML metapropertyexcludeRelationship
- true to exclude relationship of given elementexcludeAuxiliaryResources
- true to exclude auxiliary resoures- Returns:
- owned elements of the given Element
-
getOwnedElementsIncludingAdditional
public java.util.List<Element> getOwnedElementsIncludingAdditional(Element element, boolean includePureOwned, boolean excludeRelationship, boolean excludeAuxiliaryResources, boolean excludeInvisibleElement)
Return owned elements of the given Element including additional owned elements defined in DSL specification by additionalContentProperty.- Parameters:
element
- an element to be found owned elementincludePureOwned
- include element owned directly in ownedElement UML metapropertyexcludeRelationship
- true to exclude relationship of given elementexcludeAuxiliaryResources
- true to exclude auxiliary resourcesexcludeInvisibleElement
- true to exclude invisible element- Returns:
- owned elements of the given Element
-
filterElementByElementFilters
public java.util.List<Element> filterElementByElementFilters(java.util.List<Element> elements, java.util.List<com.nomagic.magicdraw.ui.ElementFilter> elementFilters)
-
getPackages
public java.util.Collection<Element> getPackages(boolean includeSmartPackage)
-
isAttachedFile
public boolean isAttachedFile(Element element)
Check if element is attached file.- Parameters:
element
- specific element- Returns:
- true if element is attached element, otherwise; false
-
isAttachedImage
public boolean isAttachedImage(Element element)
Check if element is attached image.- Parameters:
element
- specific element- Returns:
- true if element is attached image, otherwise; false
-
getAttachedImage
public java.lang.Object getAttachedImage(Element element) throws java.io.IOException
- Throws:
java.io.IOException
-
getAttachedImage
@CheckForNull public java.lang.Object getAttachedImage(Element element, @CheckForNull java.lang.String cannotRenderImageMsg) throws java.io.IOException
Get image from attached image.- Parameters:
element
- specific elementcannotRenderImageMsg
- in case the element is attached file but not image, return this msg instead.- Returns:
- image of attached image.
- Throws:
java.io.IOException
-
getAttachedFile
public java.io.File getAttachedFile(Element element) throws java.io.IOException
Get file from attached file.- Parameters:
element
- specific element- Returns:
- image of attached image.
- Throws:
java.io.IOException
-
getTemplateFile
@CheckForNull public java.io.File getTemplateFile(java.lang.String templateFileName, java.lang.String templateLocation, java.lang.String extension, java.lang.Object marker)
Get Template file from template file name/path.- Parameters:
templateFileName
- template file name or pathtemplateLocation
- template location/dirextension
- extension for template file. in case it has no extensionmarker
- The marker object used to track the file.- Returns:
- template file
-
getTemplateFile
public java.io.File getTemplateFile(Element element) throws java.io.IOException
Get template file from element.- Parameters:
element
- attached file- Returns:
- template file
- Throws:
java.io.IOException
-
getImageFor
public java.lang.Object getImageFor(Element element)
Create image from element.
The image is always created.- Parameters:
element
- target element- Returns:
- image
-
getImageFor
public java.lang.Object getImageFor(Element element, int dpi)
Create image from element.
The image is always created.- Parameters:
element
- target elementdpi
-- Returns:
- image
-
getImageFor
public java.lang.Object getImageFor(java.lang.Object object, boolean allowDuplicate)
Create image from object.
The image is newly created or returned old image from map up to 'allowDuplicate'.- Parameters:
object
- object to be exported as imageallowDuplicate
- allowDuplicated true to always create new image and don't keep the image in map- Returns:
- Image
-
getImageFor
public java.lang.Object getImageFor(java.lang.Object object, boolean allowDuplicate, @CheckForNull java.lang.String cannotRenderImageMsg)
Create image from object.
The image is newly created or returned old image from map up to 'allowDuplicate'.- Parameters:
object
- object to be exported as imageallowDuplicate
- allowDuplicated true to always create new image and don't keep the image in mapcannotRenderImageMsg
- in case the element is attached file but not image, return error message instead.- Returns:
- Image
-
getImageFor
public java.lang.Object getImageFor(java.lang.Object object, boolean allowDuplicate, @CheckForNull java.lang.String cannotRenderImageMsg, int dpi)
Create image from object.
The image is newly created or returned old image from map up to 'allowDuplicate'.- Parameters:
object
- object to be exported as imageallowDuplicate
- allowDuplicated true to always create new image and don't keep the image in mapcannotRenderImageMsg
- in case the element is attached file but not image, return error message instead.dpi
- image dpi- Returns:
- Image
-
getCustomizationPropertyString
public java.lang.String getCustomizationPropertyString(Element element, java.lang.Object aStereotype, java.lang.String propertyName)
Return property value as string from Customization element of the specified stereotype, on the element.- Parameters:
element
- an elementaStereotype
- stereotype name or elementpropertyName
- property name- Returns:
- property value as string from Customization element
-
getCustomizationProperty
public java.lang.Object getCustomizationProperty(Element element, java.lang.Object aStereotype, java.lang.String propertyName)
Return property value from Customization element of the specified stereotype, on the element.- Parameters:
element
- an elementaStereotype
- stereotype name or elementpropertyName
- property name- Returns:
- property value from Customization element
-
getAllCustomizationsByElement
public java.util.List<Class> getAllCustomizationsByElement(Element element)
Get all customizations from specific element.- Parameters:
element
- an element- Returns:
- all customization elements of the stereotype on the element.
-
getAllCustomizationsByElement
public java.util.List<Class> getAllCustomizationsByElement(Element element, @CheckForNull java.lang.Object aStereotype)
Get all customizations from specific stereotype on element.- Parameters:
element
- an elementaStereotype
- stereotype name or element- Returns:
- all customization elements of the stereotype on the element.
-
getAllCustomizationsByTarget
public java.util.List<Class> getAllCustomizationsByTarget(java.lang.Object targetElement)
Get all customizations from specific target element of customization element.- Parameters:
targetElement
- a target element- Returns:
- all customizations from specific target element of customization element.
-
getElementPropertiesName
public java.util.List<java.lang.String> getElementPropertiesName(Element element)
Get name of all properties from specific element.- Parameters:
element
- element- Returns:
- list of properties name
-
getElementPropertiesNameWithMode
public java.util.List<java.lang.String> getElementPropertiesNameWithMode(Element element)
Get name of all properties from specific element and current mode.- Parameters:
element
- element- Returns:
- list of properties name
-
getElementPropertiesNameWithMode
public java.util.List<java.lang.String> getElementPropertiesNameWithMode(Element element, @CheckForNull java.lang.String mode)
Get name of all properties from specific element and specific mode.- Parameters:
element
- elementmode
- view mode from PropertiesModeHelper.MODES- Returns:
- list of properties name
-
getElementProperties
public java.util.List<Property> getElementProperties(Element element)
Get all properties from specific element.- Parameters:
element
- element- Returns:
- list of properties
-
getElementProperties
public java.util.List<Property> getElementProperties(Element element, @CheckForNull java.lang.String mode)
Collects properties that appears in element's specification dialog tree at specific view mode (Standard/Expert/All)- Parameters:
element
- elementmode
- view mode from PropertiesModeHelper.MODES -- STANDARD, EXPERT, ALL- Returns:
- list of properties
-
getDefaultElementFilter
public com.nomagic.magicdraw.ui.ElementFilter getDefaultElementFilter()
-
getExcludeAuxiliaryResourceFilter
public com.nomagic.magicdraw.ui.ElementFilter getExcludeAuxiliaryResourceFilter()
-
getVisibleElementFilter
public com.nomagic.magicdraw.ui.ElementFilter getVisibleElementFilter()
-
getExcludeRelationshipElementFilter
public com.nomagic.magicdraw.ui.ElementFilter getExcludeRelationshipElementFilter()
-
filterVisibleElement
public java.util.List<Element> filterVisibleElement(java.util.List<Element> elements)
-
filterVisibleElement
public java.util.List<Element> filterVisibleElement(java.util.List<Element> elements, boolean includeAuxiliaryResources)
-
isInvisibleElement
public boolean isInvisibleElement(BaseElement element)
-
isInvisibleElement
public boolean isInvisibleElement(BaseElement element, boolean isTypeFilter)
-
isInvisibleElement
public boolean isInvisibleElement(BaseElement element, @CheckForNull com.nomagic.magicdraw.ui.ElementFilter elementFilter)
-
getRootNodeOfContainmentTree
public static Node getRootNodeOfContainmentTree(boolean startWithPrimaryModel)
Get root node from containment tree.- Parameters:
startWithPrimaryModel
- true to filter only primary model,
otherwise it will return Project node that may contain primary model and usage project- Returns:
- root node from containment tree
-
getRootNodeOfDiagramTree
public Node getRootNodeOfDiagramTree()
Get root node from diagram tree.- Returns:
- root node from diagram tree
-
getPropertyGroupsByStereotype
public java.util.Collection<com.nomagic.magicdraw.propertygroup.PropertyGroup> getPropertyGroupsByStereotype(Class stereotype)
Get collection ofPropertyGroup
by specific stereotype.- Parameters:
stereotype
- a stereotype- Returns:
- collection of
PropertyGroup
-
getPropertyGroupsByElement
public java.util.Set<com.nomagic.magicdraw.propertygroup.PropertyGroup> getPropertyGroupsByElement(Element element, boolean addAlwaysVisible)
Get set ofPropertyGroup
by specific element.- Parameters:
element
- an elementaddAlwaysVisible
- true to use all set stereotypes + all settable showWhenNotApplied stereotypes, false to use only all set stereotypes.- Returns:
- set of
PropertyGroup
-
getQProperty
@CheckForNull public Property getQProperty(Element element, java.lang.String propertyName)
Get a property for element with DSL property groups, and each property group has its own property.- Parameters:
element
- an element.propertyName
- property name- Returns:
- a
Property
-
getQProperties
public java.util.List<Property> getQProperties(Element element, java.lang.String propertyName)
Get list of properties for element with DSL property groups, and each property group has its own property.- Parameters:
element
- an element.propertyName
- property name- Returns:
- a list of
Property
-
setActiveValidationEnabled
public void setActiveValidationEnabled(boolean enable)
-
ensureLoad
public void ensureLoad(Diagram diagram)
-
isTypeOf
public boolean isTypeOf(Element element, java.lang.String typeName)
A function for checking super type of the specific element.- Parameters:
element
- an elementtypeName
- stereotype name or java class name- Returns:
- return true, if the element is subtype of the specific stereotype name or class name.
-
isTypeOf
public boolean isTypeOf(Element element, java.lang.String typeName, boolean checkClassTypeName)
A function for checking super type of the specific element.- Parameters:
element
- an elementtypeName
- stereotype name or java class namecheckClassTypeName
- false to check type by stereotype name only- Returns:
- return true, if the element is subtype of the specific stereotype name or class name.
-
isAssignableFrom
public boolean isAssignableFrom(Element element, java.lang.String classTypeName)
A function for checking super type of the specific element.- Parameters:
element
- an elementclassTypeName
- java class name- Returns:
- return true, if the element is subtype of the specific class type name.
-
-