Class ElementHelper
- java.lang.Object
-
- com.nomagic.magicdraw.magicreport.helper.ElementHelper
-
@OpenApiAll public class ElementHelper extends java.lang.Object
This class provides the function to help the report in order to handle elements.- Since:
- June 26, 2007
-
-
Field Summary
-
Constructor Summary
Constructors Constructor Description ElementHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static java.lang.String
constructMessageText(Message element)
static boolean
containsStereotype(Element element, java.lang.String stereotypeName)
Returns true if element contains a stereotype for the specified stereotype name.private static java.lang.String
convertVariableToValue(java.lang.String variableContent, com.nomagic.magicdraw.magicreport.ui.bean.ReportBean reportBean)
Convert variable content to value.private static void
createVariable(com.nomagic.magicdraw.magicreport.helper.Variable parent, com.nomagic.magicdraw.magicreport.ui.bean.UserDefinedBean ud)
private static com.nomagic.magicdraw.magicreport.helper.Variable
createVariableAndFindRootVar(com.nomagic.magicdraw.magicreport.ui.bean.ReportBean reportBean, java.lang.String rootVariableName)
Create variable and find root variable.static java.lang.String
getElementType(BaseElement element)
Return type of element in all lower case format.static java.lang.String
getMetaClassName(Element element)
Return meta class name.static java.lang.String
getPathVariable(java.lang.String name)
It is used for getting path variable by using variable name.static java.lang.Object
getProperty(Element element, java.lang.String propertyName)
Get the property for custom tags that are not included in Open API.private static java.lang.Object
getPropertyByName(Element element, java.lang.String propertyName)
static java.lang.String
getSortKey(BaseElement input)
It is use for getting SortKey.static boolean
hasProperty(Element element, java.lang.String propertyName)
Returns true when a property with a given name is specified on this element, false otherwise.private static java.lang.String
replaceSpecialCharacter(java.lang.String content)
Replace special character in content.static java.lang.String
resolveFileNameVariable(java.lang.String content, com.nomagic.magicdraw.magicreport.ui.bean.ReportBean reportBean)
Used for resolving the variable in output report file name in to value.static java.lang.String
resolvePathVariable(java.lang.String content)
It is used for resolving the path variable into the real path.
-
-
-
Field Detail
-
log
private static final org.apache.logging.log4j.Logger log
-
INITIAL_STATE
private static final int INITIAL_STATE
- See Also:
- Constant Field Values
-
DATE_VARIABLE_WITH_DEFAULT_FORMAT
private static final int DATE_VARIABLE_WITH_DEFAULT_FORMAT
- See Also:
- Constant Field Values
-
DATE_VARIABLE_WITH_CUSTOM_FORMAT_FOUND_OPEN_GET_COMMAND
private static final int DATE_VARIABLE_WITH_CUSTOM_FORMAT_FOUND_OPEN_GET_COMMAND
- See Also:
- Constant Field Values
-
DATE_VARIABLE_WITH_CUSTOM_FORMAT_FOUND_CLOSE_GET_COMMAND
private static final int DATE_VARIABLE_WITH_CUSTOM_FORMAT_FOUND_CLOSE_GET_COMMAND
- See Also:
- Constant Field Values
-
RANDOM_VARIABLE_WITH_DEFAULT
private static final int RANDOM_VARIABLE_WITH_DEFAULT
- See Also:
- Constant Field Values
-
RANDOM_VARIABLE_WITH_INTEGER_FOUND_OPEN_NEXTINT_COMMAND
private static final int RANDOM_VARIABLE_WITH_INTEGER_FOUND_OPEN_NEXTINT_COMMAND
- See Also:
- Constant Field Values
-
RANDOM_VARIABLE_WITH_INTEGER_FOUND_CLOSE_NEXTINT_COMMAND
private static final int RANDOM_VARIABLE_WITH_INTEGER_FOUND_CLOSE_NEXTINT_COMMAND
- See Also:
- Constant Field Values
-
PROJECT_VARIABLE
private static final int PROJECT_VARIABLE
- See Also:
- Constant Field Values
-
PROJECT_VARIABLE_NAME
private static final int PROJECT_VARIABLE_NAME
- See Also:
- Constant Field Values
-
PROJECT_VARIABLE_VERSION
private static final int PROJECT_VARIABLE_VERSION
- See Also:
- Constant Field Values
-
TEMPLATE_VARIABLE_WHICH_START_WITH_SPECIFIED_CHARACTER
private static final int TEMPLATE_VARIABLE_WHICH_START_WITH_SPECIFIED_CHARACTER
- See Also:
- Constant Field Values
-
TEMPLATE_VARABLE_WITH_DOT
private static final int TEMPLATE_VARABLE_WITH_DOT
- See Also:
- Constant Field Values
-
TEMPLATE_VARIABLE_WITH_GET_COMMAND
private static final int TEMPLATE_VARIABLE_WITH_GET_COMMAND
- See Also:
- Constant Field Values
-
TEMPLATE_VARIABLE_GET_CHILD_BY_POSITION
private static final int TEMPLATE_VARIABLE_GET_CHILD_BY_POSITION
- See Also:
- Constant Field Values
-
TEMPLATE_VARIABLE_GET_CHILD_BY_NAME_FOUND_OPEN_QUOTE
private static final int TEMPLATE_VARIABLE_GET_CHILD_BY_NAME_FOUND_OPEN_QUOTE
- See Also:
- Constant Field Values
-
TEMPLATE_VARIABLE_GET_CHILD_BY_NAME_FOUND_CLOSE_QUOTE
private static final int TEMPLATE_VARIABLE_GET_CHILD_BY_NAME_FOUND_CLOSE_QUOTE
- See Also:
- Constant Field Values
-
TEMPLATE_VARIABLE_GET_CHILD_BY_NAME
private static final int TEMPLATE_VARIABLE_GET_CHILD_BY_NAME
- See Also:
- Constant Field Values
-
TEMPLATE_VARIBLE_GET_CHILD
private static final int TEMPLATE_VARIBLE_GET_CHILD
- See Also:
- Constant Field Values
-
EXCEPTION_STATE
private static final int EXCEPTION_STATE
- See Also:
- Constant Field Values
-
random
private static final java.util.Random random
-
-
Method Detail
-
getSortKey
public static java.lang.String getSortKey(BaseElement input)
It is use for getting SortKey.- Parameters:
input
- BaseElement.- Returns:
- string
-
getPathVariable
public static java.lang.String getPathVariable(java.lang.String name)
It is used for getting path variable by using variable name.- Parameters:
name
- that variable name- Returns:
- the path
-
resolvePathVariable
public static java.lang.String resolvePathVariable(java.lang.String content)
It is used for resolving the path variable into the real path.- Parameters:
content
- the content that includes the path variable- Returns:
- the content that are resolved into the real path.
-
resolveFileNameVariable
public static java.lang.String resolveFileNameVariable(java.lang.String content, com.nomagic.magicdraw.magicreport.ui.bean.ReportBean reportBean)
Used for resolving the variable in output report file name in to value.- Parameters:
content
- the content that includes the variable.reportBean
- reportBean object- Returns:
- the content that are resolved into real value.
-
convertVariableToValue
private static java.lang.String convertVariableToValue(java.lang.String variableContent, com.nomagic.magicdraw.magicreport.ui.bean.ReportBean reportBean)
Convert variable content to value. Variable content locates between "${" and "}".- Parameters:
variableContent
- variable contentreportBean
- report bean- Returns:
- converted value
-
replaceSpecialCharacter
private static java.lang.String replaceSpecialCharacter(java.lang.String content)
Replace special character in content. Special character consists of '$'.- Parameters:
content
- string content- Returns:
- new content which is replaced special character.
-
createVariableAndFindRootVar
private static com.nomagic.magicdraw.magicreport.helper.Variable createVariableAndFindRootVar(com.nomagic.magicdraw.magicreport.ui.bean.ReportBean reportBean, java.lang.String rootVariableName)
Create variable and find root variable.- Parameters:
reportBean
- report beanrootVariableName
- root variable name- Returns:
- root variable
-
createVariable
private static void createVariable(com.nomagic.magicdraw.magicreport.helper.Variable parent, com.nomagic.magicdraw.magicreport.ui.bean.UserDefinedBean ud)
-
hasProperty
public static 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 static java.lang.Object getProperty(Element element, java.lang.String propertyName) throws com.nomagic.magicdraw.magicreport.helper.PropertyNotFoundException
Get the property for custom tags that are not included in Open API.- 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.
-
getPropertyByName
@CheckForNull private static java.lang.Object getPropertyByName(Element element, java.lang.String propertyName) throws com.nomagic.magicdraw.magicreport.helper.PropertyNotFoundException
- Throws:
com.nomagic.magicdraw.magicreport.helper.PropertyNotFoundException
-
constructMessageText
private static java.lang.String constructMessageText(Message element)
-
getMetaClassName
public static java.lang.String getMetaClassName(Element element)
Return meta class name.- Parameters:
element
- element- Returns:
- meta class name
-
getElementType
public static java.lang.String getElementType(BaseElement element)
Return type of element in all lower case format.- Parameters:
element
- MagicDraw base element- Returns:
- element type
-
containsStereotype
public static boolean containsStereotype(Element element, java.lang.String stereotypeName)
Returns true if element contains a 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.
-
-