Class WebElementHelper


  • public class WebElementHelper
    extends java.lang.Object
    Helper class for extracting information from element IDs. Conversion between different types of element IDs.
    Since:
    MicroStrategy Web 9.0.1
    • Field Detail

      • DETAIL_TERSE_SOURCE_UNIT_ID

        public static final int DETAIL_TERSE_SOURCE_UNIT_ID
        See Also:
        Constant Field Values
      • DETAIL_TERSE_DISPLAY_NAME

        public static final int DETAIL_TERSE_DISPLAY_NAME
        See Also:
        Constant Field Values
      • PRESENTATION_UNKNOWN

        public static final int PRESENTATION_UNKNOWN
        Type to return for an unknown presentation mode. Created for readability.
        See Also:
        Constant Field Values
      • PRESENTATION_OLD_LONG

        public static final int PRESENTATION_OLD_LONG
        "BB:8D679D4B11D3E4981000E787EC6DE8A4:1:2:0:2:1:3:1:Northeast" is an example of the old long element ID. Code should not be written to rely on disseminating the contents of this element ID. This presentation will be replaced by PRESENTATION_TERSE_LONG.
        See Also:
        Constant Field Values
      • PRESENTATION_OLD_SHORT

        public static final int PRESENTATION_OLD_SHORT
        "8D679D4B11D3E4981000E787EC6DE8A4:1" is an example of the old short element ID.
        See Also:
        Constant Field Values
      • PRESENTATION_TERSE_LONG

        public static final int PRESENTATION_TERSE_LONG
        This will become the standard presentation of the element ID. "h1;8D679D4B11D3E4981000E787EC6DE8A4;Northeast" is an example. It consists of ";;display name". The long form contains at least the terse default and source DSS ID, with the display name optional. If display name is optional, there should not be a trailing semi-colon.
        See Also:
        Constant Field Values
      • PRESENTATION_TERSE_DEFAULT

        public static final int PRESENTATION_TERSE_DEFAULT
        This is not explicitly supported. While we read terse default element IDs such as "h1" from the Intelligence Server, in order to submit an attribute element ID, we also require at least the source attribute DSS ID as well, such as "h1;8D679D4B11D3E4981000E787EC6DE8A4".
        See Also:
        Constant Field Values
    • Constructor Detail

      • WebElementHelper

        public WebElementHelper()
    • Method Detail

      • getElementSourceID

        public static java.lang.String getElementSourceID​(java.lang.String elementID)
        Returns:
        the element source ID from the element ID string
        Throws:
        MSTRUncheckedException - thrown if element source ID cannot be determined
        java.lang.NullPointerException - thrown if element ID is null
      • getElementType

        public static int getElementType​(java.lang.String elementID)
        Determines the EnumDSSXMLElementType from the element ID. Only works for long versions. Returns 0 if unable to determine type.
      • getTemplateUnitType

        public static int getTemplateUnitType​(java.lang.String elementID)
        Determines the EnumDSSXMLTemplateUnitType from the element ID. Returns 0 if unable to determine type.
      • toShortElementID

        public static java.lang.String toShortElementID​(java.lang.String originalID)
      • getFormIndex

        public static int getFormIndex​(java.lang.String originalID,
                                       java.lang.String displayName)
      • reduceElementID

        public static java.lang.String reduceElementID​(java.lang.String originalID)
      • reduceElementID

        public static java.lang.String reduceElementID​(java.lang.String originalID,
                                                       boolean removeAttribute)
      • removeAttributeId

        public static java.lang.String removeAttributeId​(java.lang.String originalID)
      • addToElementsCollection

        public static WebElement addToElementsCollection​(WebElements collection,
                                                         java.lang.String originalID,
                                                         java.lang.String displayFormIndices)
        Utility method to add an element to the element collection
        Parameters:
        collection - - WebElements the collection to add the element to.
        originalID - - The element id.
        displayFormIndices - - comma separated list of attribute form indices that are part of the display name
        Returns:
        WebElement that was added.
      • addToElementsCollection

        public static WebElement addToElementsCollection​(WebElements collection,
                                                         java.lang.String originalID,
                                                         java.lang.String displayFormIndices,
                                                         java.lang.String displayName)
        Utility method to add an element to the element collection
        Parameters:
        collection - - WebElements the collection to add the element to.
        originalID - - The element id.
        displayFormIndices - - comma separated list of attribute form indices that are part of the display name
        displayName - - element name
        Returns:
        WebElement that was added.
      • addToElementsCollection

        public static WebElement addToElementsCollection​(WebElements collection,
                                                         java.lang.String originalID)
        Utility method to add an element to the element collection
        Parameters:
        collection - - WebElements the collection to add the element to.
        originalID - - The element id.
        Returns:
        WebElement that was added.
      • determinePresentation

        public static int determinePresentation​(java.lang.String elementID)
        Tries to determine presentation type. If unknown, 0 is returned.
      • getElementIDForSortID

        public static java.lang.String getElementIDForSortID​(WebElement e)
      • getConstructedElementID

        public static java.lang.String getConstructedElementID​(com.microstrategy.web.objects.WebElementImpl elm)
      • getConstructedElementID

        public static java.lang.String getConstructedElementID​(WebElement elm)
        Construct elementID with display name if it's WebElementImpl instance. Otherwise return element ID
        Parameters:
        elm -
        Returns:
      • isNullElemID

        public static boolean isNullElemID​(java.lang.String elementID)
        Check if it is a null element by the given element id. It can handle both long id format and terse id format.
        Parameters:
        elementID -
        Returns:
        boolean
      • decodeHTML

        public static java.lang.String decodeHTML​(java.lang.String oldStr)
      • splitElemIDWithSemicolon

        public static java.lang.String[] splitElemIDWithSemicolon​(java.lang.String elementId)
      • getNodeKey

        public static java.lang.String getNodeKey​(java.lang.String panelElementID)
        Extracts the node key of a panel element ID in a report services document.
      • fromOldShortToTerseLongId

        public static java.lang.String fromOldShortToTerseLongId​(java.lang.String shortId,
                                                                 WebElement webElement)
        This function is just for transforming concrete short old id to terse long id, and the returned terse long id is like 'h1;8D679D4B11D3E4981000E787EC6DE8A4'
        Parameters:
        shortId - it is like '8D679D4B11D3E4981000E787EC6DE8A4:1'
      • fromOldShortToTerseLongId

        public static java.lang.String fromOldShortToTerseLongId​(java.lang.String shortId,
                                                                 int unitType)
        This function is just for transforming concrete short old id to terse long id only for attribute, and the returned terse long id is like 'h1;8D679D4B11D3E4981000E787EC6DE8A4'
        Parameters:
        shortId - it is like '8D679D4B11D3E4981000E787EC6DE8A4:1'
        unitType - it is the element id's target type in EnumDSSXMLTemplateUnitType