public class

ExpressionHelper

extends Object
java.lang.Object
   ↳ com.microstrategy.web.app.utils.ExpressionHelper

Class Overview

This class contains some public utility methods that can be used for handling parameters included on objects such as HttpServletRequest and RequestKeys.

Summary

Constants
int ALL_OPERATORS
String ANSWER_SEPARATOR Constant for the expression separator.- ""
int ATTR_ALL_FORMS
int ATTR_BROWSE_FORMS Flag indicating type of forms to be retrieved for a given attribute: ATTR_BROWSE_FORMS ATTR_ALL_FORMS ATTR_TEMPLATE_FORMS
int ATTR_LIST_OPERATORS
int ATTR_OPERATORS Flag for determining type of operators list to be displayed: ATTR_OPERATORS METRIC_OPERATORS ALL_OPERATORS
int ATTR_TEMPLATE_FORMS
String EXCLUDE_ARGUMENT_VALUE Indicates the argument value for the exclude option
int EXPRESSION_TYPE_MDX
int EXPRESSION_TYPE_REGULAR
String EXPR_SEPARATOR Constant for the expression separator.- ""
String INCLUDE_ARGUMENT_VALUE Indicates the argument value for the Include option
String ITEM_SEPARATOR Constant for the item separator.- "~"
int MDX_ATTR_OPERATORS
int MDX_METRIC_OPERATORS
int MDX_SAP_ATTR_OPERATORS
int METRIC_OPERATORS
int METRIC_RP_OPERATORS
String SIMPLE_SEPARATOR Character separators: SIMPLE_SEPARATOR UNIT_SEPARATOR ITEM_SEPARATOR EXPR_SEPARATOR
String SIMPLE_SEPARATOR_COMMA Constant for the comma separator.- ","
String UNIT_SEPARATOR Constant for the unit separator.- ""
Public Constructors
ExpressionHelper()
Public Methods
static void displayAQListOperators(MarkupOutput mo, Messages messages, int opFunction, boolean forRA)
Renders all operators supported in Attribute Qualification prompts.
static void displayAQListOperators(MarkupOutput mo, Messages messages, int opFunction)
static void displayAQOperators(MarkupOutput mo, Messages messages, int opFunction, boolean bUnitComparison, int expressionType)
static void displayAQOperators(MarkupOutput mo, Messages messages, int opFunction, boolean bUnitComparison)
Renders all operators supported in Attribute Qualification prompts.
static void displayAQOperators(MarkupOutput mo, Messages messages, int opFunction)
Renders all operators supported in Attribute Qualification prompts.
static void displayAttributeForms(MarkupOutput mo, Messages messages, WebAttribute att, String currentFormId, int showFormsId, WebWorkingSet wkSet)
Renders a form list of a given attribute
static void displayAttributeForms(MarkupOutput mo, Messages messages, WebAttribute att, String currentFormId)
Renders a form list of a given attribute
static void displayAttributeForms(MarkupOutput mo, Messages messages, WebAttribute att, String currentFormId, int showFormsId)
Renders a form list of a given attribute
static void displayAttributeForms(MarkupOutput mo, Messages messages, WebAttribute att, String currentFormId, int showFormsId, WebWorkingSet wkSet, boolean hideIDForms)
Renders a form list of a given attribute
static void displayMQOperators(MarkupOutput mo, Messages messages, int opFunction, int opFunctionType, boolean bUnitComparison, boolean bShowRankOperators)
static void displayMQOperators(MarkupOutput mo, Messages messages, int opFunction, int opFunctionType, boolean bUnitComparison)
Renders an HTML option list of Metric qualification operators.
static void displayMQOperators(MarkupOutput mo, Messages messages, int opFunction, int opFunctionType, boolean bUnitComparison, boolean bShowRankOperators, boolean blnShowStringOperators)
Renders an HTML option list of Metric qualification operators.
static void displayMQOperators(MarkupOutput mo, Messages messages, int opFunction)
Renders an HTML option list of Metric qualification operators.
static void displayPromptMDXOperators(MarkupOutput mo, Messages messages, int opFunction, boolean bShowMetricOps, boolean bShowSAPOperators)
Renders all the different types of Prompt Operators as options of a list
static void displayPromptMDXOperators(MarkupOutput mo, Messages messages, int opFunction, boolean bShowMetricOps)
Renders all the different types of Prompt Operators as options of a list
static void displayPromptOperators(MarkupOutput mo, Messages messages, int opFunction, int opFunctionType, boolean bShowMetricOps)
Renders all operators supported by the Prompts feature.
static void displayRestrictedPromptOperators(MarkupOutput mo, Messages messages, int restrictedOperator)
Renders all the different types of Prompt Operators as options of a list
static void displayWorkingSetAttributeForms(MarkupOutput mo, WebWorkingSet ws, String currentAttId, String currentFormId)
Renders all attribute forms defined in Workingset realm
static void displayWorkingSetMetrics(MarkupOutput mo, WebWorkingSet ws, String currentMetricID)
Renders metrics defined in Workingset realm
static String formatAttributeFormDisplay(String attName, String formName)
Returns the string used to display an attribute form to the end user.
static String formatAttributeFormValue(String attId, String formId, int formDataType, String attName, String formName)
Returns the string used by some event-handlers to identify an attribute form based on the specified arguments.
static String formatAttributeFormValueForSingleAttr(String formId, int formDataType, String formName)
Returns the string used by some event-handlers to identify an attribute form when there can only be a single attribute in the request.
static String formatAttributeValue(String attId, String attName)
Returns the string used by some event-handlers to identify an attribute based on the specified arguments.
static String formatObjectInfoValue(String id, int type, String name)
Returns the string used by some event-handlers to identify an object-info based on the specified arguments.
static String getConstantText(WebNode node, Messages messages)
Gets the children nodes of the DssXmlNodeConstant type from the operator node and returns the constant value as text
static String getConstantText(WebNode node, Messages messages, Locale locale)
Gets the children nodes of the DssXmlNodeConstant type from the operator node and returns the constant value as text.
static int getDimtyOutputLevel(WebNode n)
static String getObjectText(WebNode node)
Gets the first child node from the operator node and returns the object as a String:
  • for MQ, it's the display name of the metric object
  • for AQ form qualification, it's AttName.FormName
static String getOperatorSymbol(int operatorId, Messages messages)
Returns the corresponding operator text associated with the operator Id.
static GUIOperator[] getOperators(int operatorType, Messages msgs)
static boolean isDimtyNodeEmpty(WebNode node)
Checks if the node has dimensionality (Dimty), and if so, if it's empty.
static boolean isExpressionAnswerComplex(WebExpression answer, int expressionType)
Determines whether the current answer is complex or not.
static boolean isFilterEmpty(WebExpression expr)
Returns whether the given filter expression is empty.
static boolean isNodeComplex(WebNode node, int expressionType)
Checks if a single subexpression is Complex.
static String localizeValue(String value, int dataType, Locale locale)
Returns the localized value for the specified date or number
static void renderFilterDebugInfo(MarkupOutput out, WebFilter filter, int indent)
Renders debugging information for a given Filter instance
static String toOperatorName(int operatorId, int operatorType, Messages messages)
Gets the operator's name based on the operator's id and type
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int ALL_OPERATORS

Constant Value: 3 (0x00000003)

public static final String ANSWER_SEPARATOR

Constant for the expression separator.- ""

Constant Value: ""

public static final int ATTR_ALL_FORMS

Constant Value: 2 (0x00000002)

public static final int ATTR_BROWSE_FORMS

Flag indicating type of forms to be retrieved for a given attribute: ATTR_BROWSE_FORMS ATTR_ALL_FORMS ATTR_TEMPLATE_FORMS

Constant Value: 1 (0x00000001)

public static final int ATTR_LIST_OPERATORS

Constant Value: 7 (0x00000007)

public static final int ATTR_OPERATORS

Flag for determining type of operators list to be displayed: ATTR_OPERATORS METRIC_OPERATORS ALL_OPERATORS

Constant Value: 1 (0x00000001)

public static final int ATTR_TEMPLATE_FORMS

Constant Value: 3 (0x00000003)

public static final String EXCLUDE_ARGUMENT_VALUE

Indicates the argument value for the exclude option

Constant Value: "exclude"

public static final int EXPRESSION_TYPE_MDX

Constant Value: 2 (0x00000002)

public static final int EXPRESSION_TYPE_REGULAR

Constant Value: 1 (0x00000001)

public static final String EXPR_SEPARATOR

Constant for the expression separator.- ""

Constant Value: ""

public static final String INCLUDE_ARGUMENT_VALUE

Indicates the argument value for the Include option

Constant Value: "include"

public static final String ITEM_SEPARATOR

Constant for the item separator.- "~"

Constant Value: "~"

public static final int MDX_ATTR_OPERATORS

Constant Value: 4 (0x00000004)

public static final int MDX_METRIC_OPERATORS

Constant Value: 5 (0x00000005)

public static final int MDX_SAP_ATTR_OPERATORS

Constant Value: 6 (0x00000006)

public static final int METRIC_OPERATORS

Constant Value: 2 (0x00000002)

public static final int METRIC_RP_OPERATORS

Constant Value: 8 (0x00000008)

public static final String SIMPLE_SEPARATOR

Character separators: SIMPLE_SEPARATOR UNIT_SEPARATOR ITEM_SEPARATOR EXPR_SEPARATOR

Constant Value: ";"

public static final String SIMPLE_SEPARATOR_COMMA

Constant for the comma separator.- ","

Constant Value: ","

public static final String UNIT_SEPARATOR

Constant for the unit separator.- ""

Constant Value: ""

Public Constructors

public ExpressionHelper ()

Public Methods

public static void displayAQListOperators (MarkupOutput mo, Messages messages, int opFunction, boolean forRA)

Renders all operators supported in Attribute Qualification prompts.

Parameters
mo where to write output
messages instance used for getting localized texts
opFunction default operator Id

public static void displayAQListOperators (MarkupOutput mo, Messages messages, int opFunction)

public static void displayAQOperators (MarkupOutput mo, Messages messages, int opFunction, boolean bUnitComparison, int expressionType)

public static void displayAQOperators (MarkupOutput mo, Messages messages, int opFunction, boolean bUnitComparison)

Renders all operators supported in Attribute Qualification prompts.

Parameters
mo where to write output
messages instance used for getting localized texts
opFunction default operator Id
bUnitComparison flag indicating whether unit comparison is enabled

public static void displayAQOperators (MarkupOutput mo, Messages messages, int opFunction)

Renders all operators supported in Attribute Qualification prompts.

Parameters
mo where to write output
messages instance used for getting localized texts
opFunction default operator Id

public static void displayAttributeForms (MarkupOutput mo, Messages messages, WebAttribute att, String currentFormId, int showFormsId, WebWorkingSet wkSet)

Renders a form list of a given attribute

Parameters
mo where to write output
messages instance used for getting localized texts
att attribute instance to be parsed in order to get its forms
currentFormId Form Id for given default value
showFormsId flag indicating whether to show form Ids

public static void displayAttributeForms (MarkupOutput mo, Messages messages, WebAttribute att, String currentFormId)

Renders a form list of a given attribute

Parameters
mo where to write output
messages instance used for getting localized texts
att attribute instance to be parsed in order to get its forms
currentFormId Form Id for given default value

public static void displayAttributeForms (MarkupOutput mo, Messages messages, WebAttribute att, String currentFormId, int showFormsId)

Renders a form list of a given attribute

Parameters
mo where to write output
messages instance used for getting localized texts
att attribute instance to be parsed in order to get its forms
currentFormId Form Id for given default value
showFormsId flag indicating whether to show form Ids

public static void displayAttributeForms (MarkupOutput mo, Messages messages, WebAttribute att, String currentFormId, int showFormsId, WebWorkingSet wkSet, boolean hideIDForms)

Renders a form list of a given attribute

Parameters
mo where to write output
messages instance used for getting localized texts
att attribute instance to be parsed in order to get its forms
currentFormId Form Id for given default value
showFormsId flag indicating whether to show form Ids
hideIDForms If this is true, then all ID forms will be removed, as long as the form is not selected, and there exists at least one non-id form.

public static void displayMQOperators (MarkupOutput mo, Messages messages, int opFunction, int opFunctionType, boolean bUnitComparison, boolean bShowRankOperators)

public static void displayMQOperators (MarkupOutput mo, Messages messages, int opFunction, int opFunctionType, boolean bUnitComparison)

Renders an HTML option list of Metric qualification operators.

Parameters
mo where to write output
messages instance for getting localized text
opFunction function to set as default value
opFunctionType function type
bUnitComparison flag indicating whether unit comparison is enabled or not

public static void displayMQOperators (MarkupOutput mo, Messages messages, int opFunction, int opFunctionType, boolean bUnitComparison, boolean bShowRankOperators, boolean blnShowStringOperators)

Renders an HTML option list of Metric qualification operators.

Parameters
mo where to write output
messages instance for getting localized text
opFunction function to set as default value
opFunctionType function type
bUnitComparison flag indicating whether unit comparison is enabled or not.
bShowRankOperators flag indicating whether or not to show rank operators

public static void displayMQOperators (MarkupOutput mo, Messages messages, int opFunction)

Renders an HTML option list of Metric qualification operators.

Parameters
mo where to write output
messages instance for getting localized text
opFunction function to set as default value

public static void displayPromptMDXOperators (MarkupOutput mo, Messages messages, int opFunction, boolean bShowMetricOps, boolean bShowSAPOperators)

Renders all the different types of Prompt Operators as options of a list

Parameters
mo MarkupOutput
messages Messages
opFunction int
bShowMetricOps boolean
bShowSAPOperators boolean

public static void displayPromptMDXOperators (MarkupOutput mo, Messages messages, int opFunction, boolean bShowMetricOps)

Renders all the different types of Prompt Operators as options of a list

Parameters
mo MarkupOutput
messages Messages
opFunction int
bShowMetricOps boolean

public static void displayPromptOperators (MarkupOutput mo, Messages messages, int opFunction, int opFunctionType, boolean bShowMetricOps)

Renders all operators supported by the Prompts feature.

Parameters
mo where to write output
messages instance used for getting localized texts
opFunction default operator Id
bShowMetricOps flag indicating whether to show metric operators or not.

public static void displayRestrictedPromptOperators (MarkupOutput mo, Messages messages, int restrictedOperator)

Renders all the different types of Prompt Operators as options of a list

Parameters
mo MarkupOutput
messages Messages
restrictedOperator int

public static void displayWorkingSetAttributeForms (MarkupOutput mo, WebWorkingSet ws, String currentAttId, String currentFormId)

Renders all attribute forms defined in Workingset realm

Parameters
mo where to write output
ws Workingset instance
currentAttId active default attribute Id
currentFormId active default form Id

public static void displayWorkingSetMetrics (MarkupOutput mo, WebWorkingSet ws, String currentMetricID)

Renders metrics defined in Workingset realm

Parameters
mo where to write output
ws Workingset instance
currentMetricID default value

public static String formatAttributeFormDisplay (String attName, String formName)

Returns the string used to display an attribute form to the end user. based on the specified arguments. This method shows the attribute's name followed by the attribute form enclosed in parenthesis.

Parameters
attName Attribute's name
formName Attribute form's name.
Returns
  • A string to display the attribute form to the end user.

public static String formatAttributeFormValue (String attId, String formId, int formDataType, String attName, String formName)

Returns the string used by some event-handlers to identify an attribute form based on the specified arguments. This string can then be used as the value of an <INPUT> tag to submit it in a form.

Parameters
attId Attribute id
formId Form-id
formDataType Form's data-type
attName Attribute name
formName Form name
Returns
  • A string value used to identify an attribute-form.

public static String formatAttributeFormValueForSingleAttr (String formId, int formDataType, String formName)

Returns the string used by some event-handlers to identify an attribute form when there can only be a single attribute in the request. This string can then be used as the value of an <INPUT> tag to submit it in a form.

Parameters
formId Form-id
formDataType Form's data-type
formName Form name
Returns
  • String

public static String formatAttributeValue (String attId, String attName)

Returns the string used by some event-handlers to identify an attribute based on the specified arguments. This string can then be used as the value of an <INPUT> tag to submit it in a form.

Parameters
attId Attribute id
attName Attribute name
Returns
  • A string value used to identify an attribute-form.

public static String formatObjectInfoValue (String id, int type, String name)

Returns the string used by some event-handlers to identify an object-info based on the specified arguments. This string can then be used as the value of an <INPUT> tag to submit it in a form.

Parameters
id object-id
type object-type
name object-name
Returns
  • A string value used to identify an object-info.

public static String getConstantText (WebNode node, Messages messages)

Gets the children nodes of the DssXmlNodeConstant type from the operator node and returns the constant value as text

Parameters
node the operator node
messages object for retrieving localized messages
Returns
  • constant text representation

public static String getConstantText (WebNode node, Messages messages, Locale locale)

Gets the children nodes of the DssXmlNodeConstant type from the operator node and returns the constant value as text.
It uses the locale to return its localized value.

Parameters
node the operator node
messages object for retrieving localized messages
locale language
Returns
  • constant text representation

public static int getDimtyOutputLevel (WebNode n)

public static String getObjectText (WebNode node)

Gets the first child node from the operator node and returns the object as a String:

  • for MQ, it's the display name of the metric object
  • for AQ form qualification, it's AttName.FormName

Parameters
node the operator node, i.e the subexpression node
Returns
  • object text representation

public static String getOperatorSymbol (int operatorId, Messages messages)

Returns the corresponding operator text associated with the operator Id.

Parameters
operatorId Function Id
messages instance for getting localized messages
Returns
  • String localized operator text

public static GUIOperator[] getOperators (int operatorType, Messages msgs)

public static boolean isDimtyNodeEmpty (WebNode node)

Checks if the node has dimensionality (Dimty), and if so, if it's empty.

Parameters
node The node to check.
Returns
  • True if the Node has no dimensionality or if it has but it's empty

public static boolean isExpressionAnswerComplex (WebExpression answer, int expressionType)

Determines whether the current answer is complex or not.

Returns
  • boolean True if answer is complex.

public static boolean isFilterEmpty (WebExpression expr)

Returns whether the given filter expression is empty.

Parameters
expr The expression to evaluate.
Returns
  • True if the given expression is empty, false otherwise.

public static boolean isNodeComplex (WebNode node, int expressionType)

Checks if a single subexpression is Complex. An expression is complex if it cannot be created using the Web interface.
This is used by ExpressionPrompts transforms to determine if the Answer is Complex.

Parameters
node the root node of the subexpression to check
Returns
  • True if the Node is complex, that is, it cannot be created using Web. Use the method on AbstractPromptExpressionTransform.

public static String localizeValue (String value, int dataType, Locale locale)

Returns the localized value for the specified date or number

Parameters
value string to be localized
dataType value dataType
locale language being used as locale
Returns
  • String text already localized.

public static void renderFilterDebugInfo (MarkupOutput out, WebFilter filter, int indent)

Renders debugging information for a given Filter instance

Parameters
out where to write output
filter Filter instance to be parsed
indent text used as indent character

public static String toOperatorName (int operatorId, int operatorType, Messages messages)

Gets the operator's name based on the operator's id and type

Parameters
operatorId int
operatorType int
messages Messages
Returns
  • String