Package com.microstrategy.web.objects
Class WebElementHelper
- java.lang.Object
-
- com.microstrategy.web.objects.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 Summary
Fields Modifier and Type Field Description static int
DETAIL_TERSE_DEFAULT
static int
DETAIL_TERSE_DISPLAY_NAME
static int
DETAIL_TERSE_SOURCE_UNIT_ID
static int
PRESENTATION_OLD_LONG
"BB:8D679D4B11D3E4981000E787EC6DE8A4:1:2:0:2:1:3:1:Northeast" is an example of the old long element ID.static int
PRESENTATION_OLD_SHORT
"8D679D4B11D3E4981000E787EC6DE8A4:1" is an example of the old short element ID.static int
PRESENTATION_TERSE_DEFAULT
This is not explicitly supported.static int
PRESENTATION_TERSE_LONG
This will become the standard presentation of the element ID.static int
PRESENTATION_UNKNOWN
Type to return for an unknown presentation mode.static char
SEPARATOR_TERSE_FIELD
-
Constructor Summary
Constructors Constructor Description WebElementHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static WebElement
addToElementsCollection(WebElements collection, java.lang.String originalID)
Utility method to add an element to the element collectionstatic WebElement
addToElementsCollection(WebElements collection, java.lang.String originalID, java.lang.String displayFormIndices)
Utility method to add an element to the element collectionstatic 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 collectionstatic java.lang.String
decodeHTML(java.lang.String oldStr)
static int
determinePresentation(java.lang.String elementID)
Tries to determine presentation type.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'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'static java.lang.String
getConstructedElementID(WebElement elm)
Construct elementID with display name if it's WebElementImpl instance.static java.lang.String
getConstructedElementID(com.microstrategy.web.objects.WebElementImpl elm)
static java.lang.String
getElementID(WebElement e, int detail)
Returns a terse element ID composed according to detail fieldsDETAIL_TERSE_DEFAULT
,DETAIL_TERSE_SOURCE_UNIT_ID
, andDETAIL_TERSE_DISPLAY_NAME
.static java.lang.String
getElementIDForSortID(WebElement e)
static java.lang.String
getElementSourceID(java.lang.String elementID)
static int
getElementType(java.lang.String elementID)
Determines theEnumDSSXMLElementType
from the element ID.static int
getFormIndex(java.lang.String originalID, java.lang.String displayName)
static java.lang.String
getNodeKey(java.lang.String panelElementID)
Extracts the node key of a panel element ID in a report services document.static int
getTemplateUnitType(WebElement e)
Determines theEnumDSSXMLTemplateUnitType
of theWebElement
.static int
getTemplateUnitType(java.lang.String elementID)
Determines theEnumDSSXMLTemplateUnitType
from the element ID.static boolean
isNullElemID(java.lang.String elementID)
Check if it is a null element by the given element id.static java.lang.String
reduceElementID(java.lang.String originalID)
static java.lang.String
reduceElementID(java.lang.String originalID, boolean removeAttribute)
static java.lang.String
removeAttributeId(java.lang.String originalID)
static java.lang.String[]
splitElemIDWithSemicolon(java.lang.String elementId)
static java.lang.String
toShortElementID(java.lang.String originalID)
-
-
-
Field Detail
-
DETAIL_TERSE_DEFAULT
public static final int DETAIL_TERSE_DEFAULT
- See Also:
- Constant Field Values
-
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 byPRESENTATION_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 "; - 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
-
SEPARATOR_TERSE_FIELD
public static final char SEPARATOR_TERSE_FIELD
- See Also:
- Constant Field Values
-
-
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 determinedjava.lang.NullPointerException
- thrown if element ID is null
-
getElementType
public static int getElementType(java.lang.String elementID)
Determines theEnumDSSXMLElementType
from the element ID. Only works for long versions. Returns 0 if unable to determine type.
-
getTemplateUnitType
public static int getTemplateUnitType(WebElement e)
Determines theEnumDSSXMLTemplateUnitType
of theWebElement
. Returns 0 if unable to determine type.
-
getTemplateUnitType
public static int getTemplateUnitType(java.lang.String elementID)
Determines theEnumDSSXMLTemplateUnitType
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 namedisplayName
- - 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.
-
getElementID
public static java.lang.String getElementID(WebElement e, int detail)
Returns a terse element ID composed according to detail fieldsDETAIL_TERSE_DEFAULT
,DETAIL_TERSE_SOURCE_UNIT_ID
, andDETAIL_TERSE_DISPLAY_NAME
.DETAIL_TERSE_SOURCE_UNIT_ID
implies inclusion ofDETAIL_TERSE_DEFAULT
, andDETAIL_TERSE_DISPLAY_NAME
implies inclusion ofDETAIL_TERSE_SOURCE_UNIT_ID
. Fields are delimited bySEPARATOR_TERSE_FIELD
- separator is omitted if there is no subsequent field. Most element IDs will require at leastDETAIL_TERSE_SOURCE_UNIT_ID
to be consumed by the Intelligence Server.
-
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 inEnumDSSXMLTemplateUnitType
-
-