public class

WebTools

extends Object
java.lang.Object
   ↳ com.microstrategy.utils.WebTools

Class Overview

This class provides static utility methods that can be used in various tasks.

Summary

Public Constructors
WebTools()
Public Methods
static WebElement addToElementsCollection(WebElements collection, String originalID)
This method is deprecated. use addToElementsCollection(WebElements, String)
static WebElement addToElementsCollection(WebElements collection, String originalID, String displayFormIndices)
static boolean canSelectElements(WebAttribute webAttribute, WebElementSource elementSource)
Check whether we do project browsing or not
static boolean checkConnection(String serverName, int serverPort)
Checks to see if MicroStrategy Web is connected to the given Intelligence Server.
static int compareStrings(String str1, String str2, Locale loc)
static int getFormIndex(String originalID, String displayName)
This method is deprecated. use getFormIndex(String, String)
static int getMRPFunction(int dssFunc, int funcType, boolean asc)
This method returns the MRP function for a DSS function, function type, and ascending/descending flag.
static Comparator getObjectComparator(int sortField, Locale numberDateLocale, boolean isAscending)
This method is deprecated. replaced by getObjectComparator(int, RegionalOptions, boolean)
static Comparator<WebDisplayUnitEntry> getObjectComparator(int sortField, RegionalOptions locales, boolean isAscending)
This method can be used to get a java.util.Comparator for sorting objects within a WebFolder Using a sort field argument specified from the interface EnumWebObjectSort, one can obtain a corresponding Comparator.
static Comparator getObjectComparator(int sortField, boolean isAscending)
This method can be used to get a java.util.Comparator for sorting objects within a WebFolder Using a sort field argument specified from the interface EnumWebObjectSort, one can obtain a corresponding Comparator.
static String getObjectNodeName(int objectType)
This function maps the object type with the XML short name.
static String getObjectNodeName(Integer objectType)
static boolean isConnected(String serverName, int serverPort)
Makes a checkConnection(String, int) call, returning true/false depending on whether it was successful.
static String reduceElementID(String originalID)
This method is deprecated. use reduceElementID(String)
static String reduceElementID(String originalID, boolean removeAttribute)
This method is deprecated. use reduceElementID(String, boolean)
static String removeParameterFromURL(String URL, String parameter)
Removes the requested parameter from the URL, together with its value assigned.
static String toShortElementID(String originalID)
This method is deprecated. see toShortElementID(String)
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public WebTools ()

Public Methods

public static WebElement addToElementsCollection (WebElements collection, String originalID)

This method is deprecated.
use addToElementsCollection(WebElements, String)

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.

public static WebElement addToElementsCollection (WebElements collection, String originalID, String displayFormIndices)

This method is deprecated.
use addToElementsCollection(WebElements, String, String)

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.

public static boolean canSelectElements (WebAttribute webAttribute, WebElementSource elementSource)

Check whether we do project browsing or not

public static boolean checkConnection (String serverName, int serverPort)

Checks to see if MicroStrategy Web is connected to the given Intelligence Server. We will attempt connecting if (getAutoConnect()) is true.

Parameters
serverName name of the Intelligence Server.
serverPort port of the Intelligence Server.
Returns
  • whether we're connected
Throws
MSTRWebAPIException thrown if there was a problem establishing a connection.

public static int compareStrings (String str1, String str2, Locale loc)

public static int getFormIndex (String originalID, String displayName)

This method is deprecated.
use getFormIndex(String, String)

public static int getMRPFunction (int dssFunc, int funcType, boolean asc)

This method returns the MRP function for a DSS function, function type, and ascending/descending flag. This is used to map the preference for default operator to the EnumWebMRPFunction, which is required for rank/ percent to build those expressions.

Parameters
dssFunc The function, from EnumDSSXMLFunction.
funcType The function type, from EnumWebFunctionType.
asc Whether the order should be ascending or descending
Returns
  • The correct function - if rank/percent, from EnumWebMRPFunction, otherwise the original function.

public static Comparator getObjectComparator (int sortField, Locale numberDateLocale, boolean isAscending)

This method is deprecated.
replaced by getObjectComparator(int, RegionalOptions, boolean)

This method can be used to get a java.util.Comparator for sorting objects within a WebFolder Using a sort field argument specified from the interface EnumWebObjectSort, one can obtain a corresponding Comparator. The Comparator can be used on the WebDisplayUnits object returned by getChildUnits() method of a WebFolder to sort the WebObjectInfo objects of the WebFolder.

Parameters
sortField the sort field. Must be a value from EnumWebObjectSort. The sort fields cannot be combined.
numberDateLocale The associated locale. This will be used in number/date comparisons. If the locale parameter is passed in as null, then the default locale is used.
isAscending Specify whether Comparator will be used for ascending sorting or descending sorting.
Returns
  • the corresponding java.util.Comparator

public static Comparator<WebDisplayUnitEntry> getObjectComparator (int sortField, RegionalOptions locales, boolean isAscending)

This method can be used to get a java.util.Comparator for sorting objects within a WebFolder Using a sort field argument specified from the interface EnumWebObjectSort, one can obtain a corresponding Comparator. The Comparator can be used on the WebDisplayUnits object returned by getChildUnits() method of a WebFolder to sort the WebObjectInfo objects of the WebFolder.

Parameters
sortField the sort field. Must be a value from EnumWebObjectSort. The sort fields cannot be combined.
locales The associated locales.
isAscending Specify whether Comparator will be used for ascending sorting or descending sorting.
Returns
  • the corresponding java.util.Comparator

public static Comparator getObjectComparator (int sortField, boolean isAscending)

This method can be used to get a java.util.Comparator for sorting objects within a WebFolder Using a sort field argument specified from the interface EnumWebObjectSort, one can obtain a corresponding Comparator. The Comparator can be used on the WebDisplayUnits object returned by getChildUnits() method of a WebFolder to sort the WebObjectInfo objects of the WebFolder.

Parameters
sortField the sort field. Must be a value from EnumWebObjectSort. The sort fields cannot be combined.
isAscending Specify whether Comparator will be used for ascending sorting or descending sorting.
Returns
  • the corresponding java.util.Comparator

public static String getObjectNodeName (int objectType)

This function maps the object type with the XML short name.

Parameters
objectType The type of object we want to look for.
Returns
  • The XML short name of the specified object type.

public static String getObjectNodeName (Integer objectType)

public static boolean isConnected (String serverName, int serverPort)

Makes a checkConnection(String, int) call, returning true/false depending on whether it was successful. No exception is thrown by this method.

Parameters
serverName name of the Intelligence Server.
serverPort port of the Intelligence Server.
Returns
  • whether we're connected

public static String reduceElementID (String originalID)

This method is deprecated.
use reduceElementID(String)

public static String reduceElementID (String originalID, boolean removeAttribute)

This method is deprecated.
use reduceElementID(String, boolean)

public static String removeParameterFromURL (String URL, String parameter)

Removes the requested parameter from the URL, together with its value assigned.

Parameters
URL the query string from where the parameter should be removed
parameter the name of the parameter to search and remove
Returns
  • The resulting string after removing the parameter. - If not found, returns the same string, - If it's the only parameter on the URL, returns an empty string - In any other case, returns the string without the parameter and its value

public static String toShortElementID (String originalID)

This method is deprecated.
see toShortElementID(String)