Package com.microstrategy.utils
Class WebTools
- java.lang.Object
-
- com.microstrategy.utils.WebTools
-
public class WebTools extends java.lang.Object
This class provides static utility methods that can be used in various tasks.- Since:
- MicroStrategy Web 7.3.1 or earlier
-
-
Constructor Summary
Constructors Constructor Description WebTools()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static WebElement
addToElementsCollection(WebElements collection, java.lang.String originalID)
Deprecated.static WebElement
addToElementsCollection(WebElements collection, java.lang.String originalID, java.lang.String displayFormIndices)
static boolean
canSelectElements(WebAttribute webAttribute, WebElementSource elementSource)
Check whether we do project browsing or notstatic boolean
checkConnection(java.lang.String serverName, int serverPort)
Checks to see if MicroStrategy Web is connected to the given Intelligence Server.static int
compareStrings(java.lang.String str1, java.lang.String str2, java.util.Locale loc)
static int
getFormIndex(java.lang.String originalID, java.lang.String displayName)
Deprecated.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 java.util.Comparator
getObjectComparator(int sortField, boolean isAscending)
This method can be used to get aComparator
for sorting objects within aWebFolder
Using a sort field argument specified from the interfaceEnumWebObjectSort
, one can obtain a corresponding Comparator.static java.util.Comparator<WebDisplayUnitEntry>
getObjectComparator(int sortField, RegionalOptions locales, boolean isAscending)
This method can be used to get aComparator
for sorting objects within aWebFolder
Using a sort field argument specified from the interfaceEnumWebObjectSort
, one can obtain a corresponding Comparator.static java.util.Comparator
getObjectComparator(int sortField, java.util.Locale numberDateLocale, boolean isAscending)
Deprecated.static java.lang.String
getObjectNodeName(int objectType)
This function maps the object type with the XML short name.static java.lang.String
getObjectNodeName(java.lang.Integer objectType)
static boolean
isConnected(java.lang.String serverName, int serverPort)
Makes acheckConnection(String, int)
call, returning true/false depending on whether it was successful.static java.lang.String
reduceElementID(java.lang.String originalID)
Deprecated.static java.lang.String
reduceElementID(java.lang.String originalID, boolean removeAttribute)
Deprecated.static java.lang.String
removeParameterFromURL(java.lang.String URL, java.lang.String parameter)
Removes the requested parameter from the URL, together with its value assigned.static boolean
showHyperCard()
static java.lang.String
toShortElementID(java.lang.String originalID)
Deprecated.
-
-
-
Method Detail
-
getObjectNodeName
public static java.lang.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.
-
getObjectNodeName
public static java.lang.String getObjectNodeName(java.lang.Integer objectType)
-
removeParameterFromURL
public static java.lang.String removeParameterFromURL(java.lang.String URL, java.lang.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 removedparameter
- 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
-
compareStrings
public static int compareStrings(java.lang.String str1, java.lang.String str2, java.util.Locale loc)
- Since:
- MicroStrategy Web 9.0.0
-
getObjectComparator
public static java.util.Comparator getObjectComparator(int sortField, boolean isAscending)
This method can be used to get aComparator
for sorting objects within aWebFolder
Using a sort field argument specified from the interfaceEnumWebObjectSort
, one can obtain a corresponding Comparator. The Comparator can be used on theWebDisplayUnits
object returned byWebDisplayUnit.getChildUnits()
method of a WebFolder to sort theWebObjectInfo
objects of the WebFolder.- Parameters:
sortField
- the sort field. Must be a value fromEnumWebObjectSort
. The sort fields cannot be combined.isAscending
- Specify whetherComparator
will be used for ascending sorting or descending sorting.- Returns:
- the corresponding
Comparator
-
getObjectComparator
@Deprecated public static java.util.Comparator getObjectComparator(int sortField, java.util.Locale numberDateLocale, boolean isAscending)
Deprecated.This method can be used to get aComparator
for sorting objects within aWebFolder
Using a sort field argument specified from the interfaceEnumWebObjectSort
, one can obtain a corresponding Comparator. The Comparator can be used on theWebDisplayUnits
object returned byWebDisplayUnit.getChildUnits()
method of a WebFolder to sort theWebObjectInfo
objects of the WebFolder.- Parameters:
sortField
- the sort field. Must be a value fromEnumWebObjectSort
. 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 whetherComparator
will be used for ascending sorting or descending sorting.- Returns:
- the corresponding
Comparator
- Since:
- MicroStrategy Web 8.0.0
-
getObjectComparator
public static java.util.Comparator<WebDisplayUnitEntry> getObjectComparator(int sortField, RegionalOptions locales, boolean isAscending)
This method can be used to get aComparator
for sorting objects within aWebFolder
Using a sort field argument specified from the interfaceEnumWebObjectSort
, one can obtain a corresponding Comparator. The Comparator can be used on theWebDisplayUnits
object returned byWebDisplayUnit.getChildUnits()
method of a WebFolder to sort theWebObjectInfo
objects of the WebFolder.- Parameters:
sortField
- the sort field. Must be a value fromEnumWebObjectSort
. The sort fields cannot be combined.locales
- The associated locales.isAscending
- Specify whetherComparator
will be used for ascending sorting or descending sorting.- Returns:
- the corresponding
Comparator
- Since:
- MicroStrategy Web 9.0.0
-
isConnected
public static boolean isConnected(java.lang.String serverName, int serverPort)
Makes acheckConnection(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
- Since:
- MicroStrategy Web 9.0.0
- See Also:
checkConnection(String, int)
-
checkConnection
public static boolean checkConnection(java.lang.String serverName, int serverPort) throws MSTRWebAPIException
Checks to see if MicroStrategy Web is connected to the given Intelligence Server. We will attempt connecting if (IDSSXMLAdmin.getAutoConnect()
) is true. checkConnection (1) finds out if the cluster exists, (2) automatically reconnects to the IServer if the auto-connect feature is on.- 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.- Since:
- MicroStrategy Web 9.0.1
-
reduceElementID
@Deprecated public static java.lang.String reduceElementID(java.lang.String originalID)
Deprecated.- Since:
- MicroStrategy Web 9.0.0
-
reduceElementID
@Deprecated public static java.lang.String reduceElementID(java.lang.String originalID, boolean removeAttribute)
Deprecated.- Since:
- MicroStrategy Web 8.1.2
-
getFormIndex
@Deprecated public static int getFormIndex(java.lang.String originalID, java.lang.String displayName)
Deprecated.- Since:
- MicroStrategy Web 8.1.2
-
addToElementsCollection
@Deprecated 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.
- Since:
- MicroStrategy Web 8.1.2
-
addToElementsCollection
@Deprecated public static WebElement addToElementsCollection(WebElements collection, java.lang.String originalID)
Deprecated.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.
- Since:
- MicroStrategy Web 8.1.2
-
toShortElementID
@Deprecated public static java.lang.String toShortElementID(java.lang.String originalID)
Deprecated.- Since:
- MicroStrategy Web 8.1.2
-
getMRPFunction
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.
- Since:
- MicroStrategy Web 9.0.0
-
canSelectElements
public static boolean canSelectElements(WebAttribute webAttribute, WebElementSource elementSource)
Check whether we do project browsing or not- Parameters:
webAttribute
-elementSource
-- Since:
- MicroStrategy Web 9.0.1
-
showHyperCard
public static boolean showHyperCard()
-
-