Package com.microstrategy.web.objects
Class WebElementSearchFilterBuilder
- java.lang.Object
-
- com.microstrategy.web.objects.WebElementSearchFilterBuilder
-
public class WebElementSearchFilterBuilder extends java.lang.Object
This utility class builds aWebFilter
for element browsing based on the following rules:- If an
WebAttribute
has multipleWebAttributeForm
, they are OR'ed together to build a filter expression. For example, suppose an attribute namedEmployee
has two attribute formsFirstName
andLastName
, a search on "Joe" would result in a filter expression like:Employee.FirstName Like "*Joe*" OR Employee.LastName Like "*Joe*"
- Any search string without any wildcard character (the character â*â)
within it will be treated as: (a) if the
BaseAttributeFormDataType
is of EnumDSSXMLDataType.DssXmlDataTypeChar, use theLike
operator or (b) if theBaseAttributeFormDataType
is of typeNumerical
orDate/Time
, use theEquals
operator and do not add any wildcard character to the search string. - Any search string included within a pair of double-quotes is treated as
a string literal and thus always use the
Equals
operator. If a string begins with a double-quote character but misses the end quote, the rest of the string starting from the double-quote is treated a string literal - A date should comform to the following formats in order to be recognized as a date. (a) mm/dd/yy (b) mm/dd/yyyy (c) dd/mm/yy (d) dd/mm/yyyy. Any date which can not be expressed in the above four formats, should be expressed as a string literal (enclosed with a pair of double-quotes).
- If the search string already contains wildcard characters, we do not add any more. Such a search string can not be parsed into any numerical value or date/time.
- A blank white space character, a comma, or the word
OR
indicates a logicalOR
operator between two conditions. Multiple forms are still ORâed. The above three operators get ignored if they appear either at the beginning or the end of a search string. - An ampersand character â&â or the word
AND
indicates a logicalAND
operator between two conditions. Multiple forms are still ORâed. The above two operators get ignored if they appear either at the beginning or the end of a search string. - Search can be qualified on a particular
WebAttributeForm
if the attribute form name is enclosed within a pair of square brackets (â[â and â]â) and is followed by a colon and a text i.e. [FirstName]:"Joe" - A minus-symbol (-) and the word
NOT
indicates a logical âAND NOTâ operator on a condition. If the operator appears at the beginning of a search string, it is taken as a âNOTâ operator; if it appears at the end of a searching string, it is simply ignored. - Range operators: a value can be preceeded by a range operator to specify a range. The supported range operators are: (a) â>â (b) â<â (c) â>=â and (d) â<=â. Note the range operator must be the first character in an input or be preceeded by blank spaces.
-
AND
andOR
operators can not co-exist in one search string, although they each can have multiple branches. This is due to the lack of support of opearator precedence.
- Since:
- MicroStrategy Web 7.5.3
- If an
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
WebElementSearchFilterBuilder.ParserException
This exception class extendsMSTRCheckedException
and is intended for reporting parsing error of element search string.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addElementSearchPatternFilter(WebOperatorNode root, WebAttribute attr, java.lang.String searchStr, boolean matchCase, java.util.Locale locale)
Builds a filter expression and appends it to the specifiedroot
operator node if it is notnull
; otherwise, appends the search filter at the root node of the filter expression of the specifiedWebAttribute
.static void
addElementSearchPatternFilter(WebOperatorNode root, WebExpression expr, WebAttribute attr, WebAttributeForms forms, java.lang.String searchStr, boolean matchCase, java.util.Locale locale)
static void
addElementSearchPatternFilter(WebOperatorNode root, WebExpression expr, WebAttribute attr, WebAttributeForms forms, java.lang.String searchStr, boolean matchCase, java.util.Locale locale, boolean ensureDetails)
Builds a filter expression and appends it to the specifiedroot
operator node if it is notnull
; otherwise, appends the search filter at the root node of the specifiedWebExpression
.static void
addElementSearchPatternFilter(WebOperatorNode root, WebExpression expr, WebAttribute attr, java.lang.String searchStr, boolean matchCase, java.util.Locale locale)
Builds a filter expression and appends it to the specifiedroot
operator node if it is notnull
; otherwise, appends the search filter at the root node of the specifiedWebExpression
.
-
-
-
Method Detail
-
addElementSearchPatternFilter
public static void addElementSearchPatternFilter(WebOperatorNode root, WebAttribute attr, java.lang.String searchStr, boolean matchCase, java.util.Locale locale) throws WebObjectsException, WebElementSearchFilterBuilder.ParserException
Builds a filter expression and appends it to the specifiedroot
operator node if it is notnull
; otherwise, appends the search filter at the root node of the filter expression of the specifiedWebAttribute
.The filter is built via qualifying on all browse forms of the specified attribute.
- Parameters:
root
- the root node to append the filter expression builtattr
- the attribute whose elements to be searchedsearchStr
- the search string user types inmatchCase
-True
means case sensitive searchinglocale
- theLocale
object- Throws:
WebObjectsException
- thrown if the specifiedroot
does not belong to the filter of the specifiedattr
, or there is data type mismatch between the user inputs and attribute form data type, or there is any exception when accessing to a WebObject.WebElementSearchFilterBuilder.ParserException
- thrown if there is any error due to conflicts to the search rules.- See Also:
WebAttribute.getBrowseForms()
-
addElementSearchPatternFilter
public static void addElementSearchPatternFilter(WebOperatorNode root, WebExpression expr, WebAttribute attr, java.lang.String searchStr, boolean matchCase, java.util.Locale locale) throws WebObjectsException, WebElementSearchFilterBuilder.ParserException
Builds a filter expression and appends it to the specifiedroot
operator node if it is notnull
; otherwise, appends the search filter at the root node of the specifiedWebExpression
.The filter is built via qualifying on all browse forms of the specified attribute.
- Parameters:
root
- the root node to append the filter expression builtexpr
- theWebExpression
to which theroot
node belongsattr
- the attribute whose elements to be searchedsearchStr
- the search string user types inmatchCase
-True
means case sensitive searchinglocale
- theLocale
object- Throws:
WebObjectsException
- thrown if the specifiedroot
does not belong to the filter of the specifiedattr
, or there is data type mismatch between the user inputs and attribute form data type, or there is any exception when accessing to a WebObject.WebElementSearchFilterBuilder.ParserException
- thrown if there is any error due to conflicts to the search rules.- See Also:
WebAttribute.getBrowseForms()
-
addElementSearchPatternFilter
public static void addElementSearchPatternFilter(WebOperatorNode root, WebExpression expr, WebAttribute attr, WebAttributeForms forms, java.lang.String searchStr, boolean matchCase, java.util.Locale locale) throws WebObjectsException, WebElementSearchFilterBuilder.ParserException
-
addElementSearchPatternFilter
public static void addElementSearchPatternFilter(WebOperatorNode root, WebExpression expr, WebAttribute attr, WebAttributeForms forms, java.lang.String searchStr, boolean matchCase, java.util.Locale locale, boolean ensureDetails) throws WebObjectsException, WebElementSearchFilterBuilder.ParserException
Builds a filter expression and appends it to the specifiedroot
operator node if it is notnull
; otherwise, appends the search filter at the root node of the specifiedWebExpression
.If the attribute forms are not specified, the filter is built via qualifying on attribute browse forms.
- Parameters:
root
- the root node to append the filter expression builtexpr
- theWebExpression
to which theroot
node belongsattr
- the attribute whose elements to be searchedforms
- the attribute forms to qualify onsearchStr
- the search string user types inmatchCase
-True
means case sensitive searchinglocale
- theLocale
object- Throws:
WebObjectsException
- thrown if the specifiedroot
does not belong to the filter of the specifiedattr
, or there is data type mismatch between the user inputs and attribute form data type, or there is any exception when accessing to a WebObject.WebElementSearchFilterBuilder.ParserException
- thrown if there is any error due to conflicts to the search rules.- Since:
- MicroStrategy Web 8.0.0
-
-