@OpenApiAll
public class ReportHelper
extends com.nomagic.magicreport.engine.Tool
$report
For example:
<code> #foreach ($rel in $report.getRelationships($package)) $rel.name #end </code>
Constructor and Description |
---|
ReportHelper() |
Modifier and Type | Method and Description |
---|---|
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.
|
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<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> elementTypes)
Return the collection from the element list filtered by human types.
|
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<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.util.Collection |
getBaseClassAssociations(Classifier classifier)
Gets the classifier associations.
|
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.
|
java.util.Collection<Classifier> |
getDerivedClassifiers(Classifier parentClassifier)
Returns classifier derived elements.
|
java.util.Collection<Element> |
getDiagramElements(Diagram diagram)
Gets elements from this diagram.
|
java.util.Collection<Element> |
getDiagramElements(DiagramPresentationElement diagram)
Gets presentation 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.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.magicreport.Image |
getIconFor(BaseElement element)
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(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.
|
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.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.
|
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 includeSmartPacakge) |
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.
|
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.
|
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<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.
|
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. Use $element.owner.qualifiedName
|
Element |
getRecievingOperationalNode(Element element)
Get needline association ends.
|
java.util.Collection<Element> |
getRelationship(Element element)
Gets element relationship.
|
java.util.Collection<Element> |
getRelationship(Element element,
boolean recursive)
Return relationship of this element.
|
java.util.Collection<Actor> |
getRelativeActor(Element element)
Gets element relative actor.
|
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,
java.lang.String stereotypeName,
java.lang.String propertyName)
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.
|
java.lang.String |
getStereotypePropertyString(Element element,
java.lang.String stereotypeName,
java.lang.String propertyName)
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.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.ArrayList<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.ArrayList<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).
|
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 |
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 |
isNamedElement(Element element)
Returns whether the element an
NamedElement . |
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.
|
static java.lang.Object |
parseObjectForPrinting(java.lang.Object value)
Parses Strings and Collections of Strings
|
com.nomagic.magicdraw.magicreport.helper.Hyperlink |
serialize(Hyperlink hyperlink)
Convert
com.nomagic.magicdraw.hyperlinks.Hyperlink to Hyperlink . |
java.lang.String |
trimString(java.lang.String s)
Deprecated.
replaced with $s.trim()
|
clone, getContext, getProperties, getProperty, getProperty, notifyObservers, setContext, setProperties
public java.lang.Object getDSLProperty(Element element, java.lang.String propertyName)
element
- the element.propertyName
- the property name.public java.lang.Object getStereotypeProperty(Element element, java.lang.String stereotypeName, java.lang.String propertyName)
element
- the element.stereotypeName
- the stereotype name.propertyName
- the property name.getStereotypeProperty(Element, Stereotype, String)
,
getStereotypeProperty(Element, String, String, String)
public static java.lang.Object parseObjectForPrinting(java.lang.Object value)
public java.lang.Object getStereotypeProperty(Element element, Stereotype stereotype, java.lang.String propertyName)
element
- the element.stereotype
- the stereotype.propertyName
- the property name.getStereotypeProperty(Element, String, String)
,
getStereotypeProperty(Element, String, String, String)
public static java.lang.Object getStereotypeProperty(Element element, java.lang.String profileName, java.lang.String stereotypeName, java.lang.String propertyName)
element
- the element.profileName
- profile namestereotypeName
- the stereotype name.propertyName
- the property name.public java.util.List<java.lang.Object> getStereotypePropertyList(Element element, java.lang.String stereotypeName, java.lang.String propertyName)
element
- element with assigned stereotypestereotypeName
- stereotype namepropertyName
- name of the propertypublic java.lang.String getStereotypePropertyString(Element element, java.lang.String stereotypeName, java.lang.String propertyName)
element
- the element instancestereotypeName
- the stereotype namepropertyName
- the property namepublic java.lang.String getStereotypePropertyStringValue(java.lang.Object o)
o
- the propertypublic boolean isNamedElement(Element element)
NamedElement
.element
- element to testNamedElement
; otherwise falsepublic Stereotype getAppliedStereotypeByString(Element element, java.lang.String stereotype)
getAppliedStereotypeByName(Element, String)
element
- elementstereotype
- name of stereotypepublic Stereotype getAppliedStereotypeByName(Element element, java.lang.String stereotypeName)
element
- elementstereotypeName
- name of stereotypepublic boolean hasStereotype(Element element, java.lang.String stereotype)
containsStereotype(Element, String)
element
- element to checkstereotype
- stereotype name to checkpublic boolean containsStereotype(Element element, java.lang.String stereotypeName)
element
- element to teststereotypeName
- stereotype name to be testedcontainsStereotype(Element, String, boolean)
public boolean containsStereotype(Element element, java.lang.String stereotypeName, boolean includeDerived)
element
- element to teststereotypeName
- stereotype name to be testedincludeDerived
- true if search target include all derived stereotypes; otherwise falsecontainsStereotype(Element, String)
public boolean hasProperty(Element element, java.lang.String propertyName)
element
- element to testpropertyName
- property namepublic java.lang.Object getProperty(Element element, java.lang.String propertyName) throws com.nomagic.magicdraw.magicreport.helper.PropertyNotFoundException
element
- the object that will be gotten that data.propertyName
- the field of the element.PropertyNotFoundException
- when a request property name is not found on target element.public java.util.List<Stereotype> getStereotypes(Element element) throws java.lang.IllegalArgumentException
element
- the elementjava.lang.IllegalArgumentException
- from StereotypesHelper.getStereotypes
public boolean hasStereotype(Element element) throws java.lang.IllegalArgumentException
element
- element to checkjava.lang.IllegalArgumentException
- if element is nullpublic Element findElementInCollection(java.util.Collection<? extends Element> col, java.lang.String elementName)
col
- the collection of elementselementName
- the name of elementpublic java.util.Collection<Element> findElementByName(java.util.Collection<Element> source, java.lang.String regex)
source
- sourceregex
- the regular expression to which name is to be matchedpublic java.util.Collection<Classifier> getDerivedClassifiers(Classifier parentClassifier)
parentClassifier
- the parent classpublic boolean hasBaseClassifier(Classifier classifier, java.lang.String baseClassifier)
classifier
- the classifierbaseClassifier
- base classifier namepublic java.util.List<Classifier> getBaseClassifiers(Classifier classifier)
classifier
- the classifierpublic java.lang.String getComment(Element element)
element
- the element which will be gotten the name.public Comment getElementComment(Element element)
element
- the element which will be gotten the Comment.public java.util.Collection<Actor> getRelativeActor(Element element)
element
- the elementpublic java.util.Collection<Element> getUseCaseAssociatedElement(Element obj)
obj
- the element that we would like to find the other partpublic java.util.Collection<Element> getIncludeUseCase(UseCase useCase)
useCase
- the UseCase instancepublic java.lang.String trimString(java.lang.String s)
s
- the Stringpublic java.lang.String createValueSpecificationText(ValueSpecification specification)
specification
- The given ValueSpecification.public java.util.Collection<PresentationElement> getPresentationElements(Diagram diagram)
getPresentationDiagramElements(Diagram)
.diagram
- the diagram instance.getPresentationDiagramElements(Diagram)
public java.util.Collection<PresentationElement> getPresentationDiagramElements(Diagram diagram)
diagram
- the diagram instance.getPresentationDiagramElements(Diagram, boolean)
public java.util.Collection<PresentationElement> getPresentationDiagramElements(Diagram diagram, boolean includeNonManipulator)
diagram
- the diagram instance.includeNonManipulator
- true for include all non-manipulator element.getPresentationDiagramElements(Diagram)
public com.nomagic.magicdraw.magicreport.helper.Polygon getPresentationElementBounds(PresentationElement element)
element
- the presentation element on diagram.public java.util.List<java.awt.Rectangle> getPresentationElementRectangle(Diagram diagram, Element element)
diagram
- the target diagram.element
- the presentation element on given diagram.public java.util.List<com.nomagic.magicdraw.magicreport.helper.Polygon> getPresentationElementBounds(Diagram diagram, Element element)
diagram
- the target diagram.element
- the presentation element on given diagram.public java.lang.String getDiagramType(Diagram diagram)
diagram
- the diagram instance.public java.util.Collection<Class> getMetaClass(Stereotype stereotype)
stereotype
- the stereotypepublic java.util.Collection<Element> getDiagramElements(Diagram diagram)
diagram
- the target diagram.public java.util.Collection<Element> getDiagramElements(DiagramPresentationElement diagram)
diagram
- the target diagram.public java.lang.String getQualifiedOwnerName(NamedElement obj)
obj
- the object instancepublic static java.lang.String getQualifiedName(NamedElement namedElement, java.lang.String separator)
namedElement
- NamedElementseparator
- separator symbol. If value is null or empty string, the '::' will be used.public static java.lang.String getPackageQualifiedName(NamedElement namedElement, java.lang.String separator)
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
namedElement
- NamedElementseparator
- separator symbol. If value is null or empty string, the '::' will be used.public com.nomagic.magicdraw.magicreport.helper.Hyperlink serialize(Hyperlink hyperlink)
com.nomagic.magicdraw.hyperlinks.Hyperlink
to Hyperlink
.hyperlink
- the magicdraw hyperlinkpublic Element getSendingOperationalNode(Element element)
element
- elementpublic Element getRecievingOperationalNode(Element element)
element
- elementpublic java.util.Collection<Element> findRelationship(Package modelPackage)
modelPackage
- package elementpublic java.util.Collection<Element> findRelationship(Package modelPackage, boolean recursive)
modelPackage
- package elementrecursive
- if true, perform recursivelypublic java.util.Collection<Element> getRelationship(Element element)
element
- Element element to be collectpublic java.util.Collection<Element> getRelationship(Element element, boolean recursive)
element
- Element element to be collectrecursive
- if true, perform recursivelypublic Element getClientElement(Element element)
element
- relationship model element.public Element getSupplierElement(Element element)
element
- relationship model element.public java.util.Collection<Element> getInnerElement(Element element)
element
- Element element to be collectpublic com.nomagic.magicreport.Image getIconFor(BaseElement element)
element
- a Magic Draw elementpublic com.nomagic.magicreport.Image getIconFor(BaseElement element, java.lang.String prefix, java.lang.String suffix, boolean hashCode)
hashCode
equals true, icon's name format is set to
"icon_"+hash code and doesn't include prefix/suffix.element
- a MagicDraw elementprefix
- prefix for icon's namesuffix
- suffix for icon's namehashCode
- uses hash code in icon's namepublic com.nomagic.magicreport.Image getIconFor(java.lang.String type)
type
- element typepublic com.nomagic.magicreport.Image getIconFor(java.lang.String type, java.lang.String prefix, java.lang.String suffix, boolean hashCode)
hashCode
equals true, icon's name format is set to
"icon_"+hash code and doesn't include prefix/suffix.type
- element typeprefix
- prefix for icon's namesuffix
- suffix for icon's namehashCode
- uses hash code in icon's namepublic boolean isNull(java.lang.Object obj)
obj
- object being tested.public boolean isEmpty(java.lang.Object obj)
obj
- object being tested.public boolean isRelationship(Element element)
element
- element being tested.public java.lang.String getInteractionMessageType(Message message)
message
- Messagepublic java.lang.String getUsageRepresentationText(BaseElement be, boolean addFullPath)
be
- ModelElement
to format.addFullPath
- use full path.public java.util.Collection<BaseElement> getUsedBy(Element element)
element
- the the element which will be gotten the list of element name that uses the specified
element.public java.util.Map<BaseElement,java.util.ArrayList<com.nomagic.magicdraw.uml.DependencyType>> getUsages(java.lang.Object selectedObjects)
selectedObjects
- the elements that this method will find the usage.public java.util.Collection<BaseElement> getUsageElements(java.util.Map<BaseElement,java.util.ArrayList<com.nomagic.magicdraw.uml.DependencyType>> usagesMap, Element element)
usagesMap
- the Usages Map of MagicDraw.element
- the element which will be gotten the list of element name that uses the specified element.public java.lang.String getElementName(java.lang.Object element)
element
- the element.public java.util.Collection<Diagram> filterDiagram(java.util.Collection<Diagram> diagramList, java.util.Collection<java.lang.String> digramTypes)
Example:
#foreach ($d in $report.filterElement($Diagram, ['Use Case Diagram', 'Class Diagram'])
$d.name
#end
diagramList
- the collection of diagrams.digramTypes
- the collection of diagram types which is used to filter.public java.util.Collection<BaseElement> filterElement(java.util.Collection<BaseElement> elementList, java.util.Collection<java.lang.String> elementTypes)
Example:
#foreach ($e in $report.filterElement($elements, ['Class', 'Interface'])
$e.name $e.humanType
#end
elementList
- the collection of element.elementTypes
- the collection of element types which is used to filter.public java.util.Collection<Element> filter(java.util.Collection<Element> elementList, java.lang.String propertyName, java.util.Collection<?> propertyValue)
Example:
#foreach ($e in $report.filter($elements, 'name', ['foo', 'bar'])
$e.name
#end
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.public java.util.Collection getBaseClassInheritableAttributes(Classifier classifier)
classifier
- the Classifier.public java.util.Collection getBaseClassInheritableOperations(Classifier classifier)
classifier
- the Classifier.public java.util.Collection getBaseClassAssociations(Classifier classifier)
classifier
- the Classifier.public java.util.Collection getBaseRelations(Classifier classifier)
classifier
- the Classifier.public java.util.Collection getBaseClassPorts(Classifier classifier)
classifier
- the Classifier.public java.util.Collection getBaseRealizedInterfaces(BehavioredClassifier behavioredClassifier)
behavioredClassifier
- the BehavioredClassifier.public boolean isDerivedClassifier(Classifier parent, Classifier child)
parent
- parentchild
- possible parentpublic java.lang.String getUseCaseNumber(Element element)
element
- the elementpublic java.lang.String getActorNumber(Element element)
element
- elementpublic java.lang.String getUCOwnerNumber(Element element)
element
- the elementpublic java.lang.String getElementURL(Element element)
element
- element objectpublic java.util.List<FlowStep> getBasicFlows(UseCase useCase)
useCase
- a use case.FlowStep
public java.util.List<FlowStep> getAlternativeFlows(UseCase useCase)
useCase
- a use case.FlowStep
public java.util.List<FlowStep> getExceptionalFlows(UseCase useCase)
useCase
- a use case.FlowStep
public java.util.List<java.lang.Object> getSlotValue(Element element, java.lang.String classifierName, java.lang.String definingFeatureName)
element
- an element.classifierName
- classifier name. [case-sensitive]definingFeatureName
- defining feature name. [case-sensitive]public java.lang.Object getSlotProperty(Element element, java.lang.String classifierName)
element
- an element.classifierName
- classifier name. [case-sensitive]public java.util.List<Element> getOwnedElementsIncludingAdditional(Element element, boolean includePureOwned)
includePureOwned
- include element owned directly in ownedElement UML metapropertypublic java.util.Collection<Element> getPackages(boolean includeSmartPacakge)