Class ExpressionHelper


  • public class ExpressionHelper
    extends java.lang.Object
    This class contains some public utility methods that can be used for handling parameters included on objects such as HttpServletRequest and RequestKeys.
    Since:
    MicroStrategy Web 7.3.1 or earlier
    • Field Detail

      • EXPRESSION_TYPE_REGULAR

        public static final int EXPRESSION_TYPE_REGULAR
        Since:
        MicroStrategy Web 8.0.2
        See Also:
        Constant Field Values
      • EXPRESSION_TYPE_MDX

        public static final int EXPRESSION_TYPE_MDX
        Since:
        MicroStrategy Web 8.0.2
        See Also:
        Constant Field Values
      • SIMPLE_SEPARATOR

        public static final java.lang.String SIMPLE_SEPARATOR
        Character separators: SIMPLE_SEPARATOR UNIT_SEPARATOR ITEM_SEPARATOR EXPR_SEPARATOR
        See Also:
        Constant Field Values
      • SIMPLE_SEPARATOR_COMMA

        public static final java.lang.String SIMPLE_SEPARATOR_COMMA
        Constant for the comma separator.- ","
        Since:
        MicroStrategy Web 8.0.0
        See Also:
        Constant Field Values
      • UNIT_SEPARATOR

        public static final java.lang.String UNIT_SEPARATOR
        Constant for the unit separator.- ""
        See Also:
        Constant Field Values
      • ITEM_SEPARATOR

        public static final java.lang.String ITEM_SEPARATOR
        Constant for the item separator.- "~"
        See Also:
        Constant Field Values
      • EXPR_SEPARATOR

        public static final java.lang.String EXPR_SEPARATOR
        Constant for the expression separator.- ""
        See Also:
        Constant Field Values
      • ANSWER_SEPARATOR

        public static final java.lang.String ANSWER_SEPARATOR
        Constant for the expression separator.- ""
        Since:
        MicroStrategy Web 8.0.0
        See Also:
        Constant Field Values
      • ATTR_OPERATORS

        public static final int ATTR_OPERATORS
        Flag for determining type of operators list to be displayed: ATTR_OPERATORS METRIC_OPERATORS ALL_OPERATORS
        See Also:
        Constant Field Values
      • MDX_ATTR_OPERATORS

        public static final int MDX_ATTR_OPERATORS
        Since:
        MicroStrategy Web 8.0.0
        See Also:
        Constant Field Values
      • MDX_METRIC_OPERATORS

        public static final int MDX_METRIC_OPERATORS
        Since:
        MicroStrategy Web 8.0.0
        See Also:
        Constant Field Values
      • MDX_SAP_ATTR_OPERATORS

        public static final int MDX_SAP_ATTR_OPERATORS
        Since:
        MicroStrategy Web 8.0.1
        See Also:
        Constant Field Values
      • ATTR_LIST_OPERATORS

        public static final int ATTR_LIST_OPERATORS
        Since:
        MicroStrategy Web 9.0.0
        See Also:
        Constant Field Values
      • METRIC_RP_OPERATORS

        public static final int METRIC_RP_OPERATORS
        Since:
        MicroStrategy Web 9.5.0
        See Also:
        Constant Field Values
      • ATTR_BROWSE_FORMS

        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
        See Also:
        Constant Field Values
      • INCLUDE_ARGUMENT_VALUE

        public static final java.lang.String INCLUDE_ARGUMENT_VALUE
        Indicates the argument value for the Include option
        Since:
        MicroStrategy Web 8.0.1
        See Also:
        Constant Field Values
      • EXCLUDE_ARGUMENT_VALUE

        public static final java.lang.String EXCLUDE_ARGUMENT_VALUE
        Indicates the argument value for the exclude option
        Since:
        MicroStrategy Web 8.0.1
        See Also:
        Constant Field Values
    • Constructor Detail

      • ExpressionHelper

        public ExpressionHelper()
    • Method Detail

      • getOperators

        public static GUIOperator[] getOperators​(int operatorType,
                                                 Messages msgs)
        Since:
        MicroStrategy Web 9.0.0
      • getObjectText

        public static java.lang.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
      • getConstantText

        public static java.lang.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
      • getConstantText

        public static java.lang.String getConstantText​(WebNode node,
                                                       Messages messages,
                                                       java.util.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
      • getOperatorSymbol

        public static java.lang.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
      • toOperatorName

        public static java.lang.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
      • displayMQOperators

        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
      • displayMQOperators

        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
      • displayMQOperators

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

        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
        Since:
        MicroStrategy Web 8.0.2
      • displayRestrictedPromptOperators

        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
        Since:
        MicroStrategy Web 8.0.1
      • displayPromptMDXOperators

        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
        Since:
        MicroStrategy Web 8.0.0
      • displayPromptMDXOperators

        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
        Since:
        MicroStrategy Web 8.0.1
      • displayPromptOperators

        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.
      • displayAQOperators

        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
      • displayAQOperators

        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
      • displayAQOperators

        public static void displayAQOperators​(MarkupOutput mo,
                                              Messages messages,
                                              int opFunction,
                                              boolean bUnitComparison,
                                              int expressionType)
        Since:
        MicroStrategy Web 8.0.2
      • displayAQListOperators

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

        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
      • displayWorkingSetMetrics

        public static void displayWorkingSetMetrics​(MarkupOutput mo,
                                                    WebWorkingSet ws,
                                                    java.lang.String currentMetricID)
        Renders metrics defined in Workingset realm
        Parameters:
        mo - where to write output
        ws - Workingset instance
        currentMetricID - default value
      • displayWorkingSetAttributeForms

        public static void displayWorkingSetAttributeForms​(MarkupOutput mo,
                                                           WebWorkingSet ws,
                                                           java.lang.String currentAttId,
                                                           java.lang.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
      • displayAttributeForms

        public static void displayAttributeForms​(MarkupOutput mo,
                                                 Messages messages,
                                                 WebAttribute att,
                                                 java.lang.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
      • displayAttributeForms

        public static void displayAttributeForms​(MarkupOutput mo,
                                                 Messages messages,
                                                 WebAttribute att,
                                                 java.lang.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
      • displayAttributeForms

        public static void displayAttributeForms​(MarkupOutput mo,
                                                 Messages messages,
                                                 WebAttribute att,
                                                 java.lang.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
        Since:
        MicroStrategy Web 7.5.3
      • displayAttributeForms

        public static void displayAttributeForms​(MarkupOutput mo,
                                                 Messages messages,
                                                 WebAttribute att,
                                                 java.lang.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.
        Since:
        MicroStrategy Web 8.0.0
      • localizeValue

        public static java.lang.String localizeValue​(java.lang.String value,
                                                     int dataType,
                                                     java.util.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.
      • renderFilterDebugInfo

        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
      • formatObjectInfoValue

        public static java.lang.String formatObjectInfoValue​(java.lang.String id,
                                                             int type,
                                                             java.lang.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.
        Since:
        MicroStrategy Web 8.0.0
      • formatAttributeFormValue

        public static java.lang.String formatAttributeFormValue​(java.lang.String attId,
                                                                java.lang.String formId,
                                                                int formDataType,
                                                                java.lang.String attName,
                                                                java.lang.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.
        Since:
        MicroStrategy Web 8.0.0
      • formatAttributeValue

        public static java.lang.String formatAttributeValue​(java.lang.String attId,
                                                            java.lang.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.
        Since:
        MicroStrategy Web 8.0.0
      • formatAttributeFormDisplay

        public static java.lang.String formatAttributeFormDisplay​(java.lang.String attName,
                                                                  java.lang.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.
        Since:
        MicroStrategy Web 8.0.0
      • formatAttributeFormValueForSingleAttr

        public static java.lang.String formatAttributeFormValueForSingleAttr​(java.lang.String formId,
                                                                             int formDataType,
                                                                             java.lang.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
        Since:
        MicroStrategy Web 8.0.0
      • isExpressionAnswerComplex

        public static boolean isExpressionAnswerComplex​(WebExpression answer,
                                                        int expressionType)
        Determines whether the current answer is complex or not.
        Returns:
        boolean True if answer is complex.
        Since:
        MicroStrategy Web 8.0.0
      • isNodeComplex

        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.
        Since:
        MicroStrategy Web 8.0.0
      • isDimtyNodeEmpty

        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
        Since:
        MicroStrategy Web 8.0.0
      • isFilterEmpty

        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.
        Since:
        MicroStrategy Web 9.0.0
      • getDimtyOutputLevel

        public static int getDimtyOutputLevel​(WebNode n)
        Since:
        MicroStrategy Web 8.0.2
      • isAllowSpecialCharactersInElementId

        public static boolean isAllowSpecialCharactersInElementId()
        Checks if allow special characters like ~ in element IDs while answering prompts and editing filter definitions
        Returns:
        True if special characters is allowed
      • useItemSpecialSeparator

        public static boolean useItemSpecialSeparator​(java.lang.String id)
        Checks if use EnumPromptsBeanEvents.ITEM_SPECIAL_SEPARATOR to delimit each item contained in the string representation of a WebDisplayUnit
        Returns:
        True if need to use