Package com.microstrategy.web.transform
Class ExpressionStringsImpl
- java.lang.Object
-
- com.microstrategy.web.transform.ExpressionStringsImpl
-
- All Implemented Interfaces:
ExpressionStrings
- Direct Known Subclasses:
ExpressionPartsImpl
public class ExpressionStringsImpl extends java.lang.Object implements ExpressionStrings
A helper class that builds a collection of expression parts that can be used to build expression GUI. This collection contains part name - part value pairs.- Since:
- MicroStrategy Web 9.0.0
-
-
Field Summary
-
Fields inherited from interface com.microstrategy.web.transform.ExpressionStrings
BANDING_SEPARATOR, PART_ATTR_FORM, PART_BREAK_BY, PART_CANCELLED_PROMPT, PART_DORMANT_PROMPT, PART_EMBEDDED_PROMPT, PART_EXPRESSION, PART_LEFT_OPERAND, PART_OPERATOR, PART_OUTPUT_LEVEL, PART_RIGHT_OPERAND
-
-
Constructor Summary
Constructors Modifier Constructor Description ExpressionStringsImpl(ExpressionObject pOb)
Constructs expression parts object for a specified expression object.ExpressionStringsImpl(ExpressionObject pOb, java.util.Locale locale)
Constructs expression parts object for a specified expression object and a given localeprotected
ExpressionStringsImpl(ExpressionStringsImpl parent)
This constructor is used when a childExpressionParts
object is used to build subexpression string.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addMrpPrefix(WebOperatorNode node)
A helper method used to add rank/percent prefix to the left operand partprotected void
buildAndOrOperatorParts(WebOperatorNode node, java.lang.String operatorName)
A helper method used to build expression parts for infix operatorsprotected void
buildBetweenOperatorParts(WebOperatorNode node, java.lang.String operatorName)
A helper method used to build expression parts for BETWEEN operatorsprotected void
buildBreakByPart(WebOperatorNode node)
protected void
buildDescendantsParts(WebOperatorNode node)
protected java.lang.String
buildDimtyStr(WebOperatorNode node)
void
buildExpressionParts(WebNode node)
Builds expression parts collection for a specified expression node.protected void
buildExprParts(WebOperatorNode node)
A helper method called from the {link buildExpressionParts} to build expression parts for all expression types excluding rank and percent metric expressions.protected void
buildFormShortcutParts(WebFormShortcutNode node)
A helper method used to build expression parts (left operand and attribute form) for the form shortcut nodeprotected void
buildFunction(WebOperatorNode node, java.lang.String functionName)
A helper method used to build a tuple string representationprotected void
buildInfixOperatorParts(WebOperatorNode node, java.lang.String operatorName)
A helper method used to build expression parts for infix operatorsprotected void
buildInOperatorParts(WebOperatorNode node, java.lang.String operatorName)
A helper method used to build expression parts for IN operatorsprotected void
buildLeftOperandFromOperator(WebOperatorNode node)
A helper method called from thebuildLeftOperandParts(com.microstrategy.web.objects.WebOperatorNode)
to build left operand parts in the case the left operand is an operator.protected void
buildLeftOperandParts(WebOperatorNode node)
A helper method used to build left operand partsprotected void
buildMrpParts(WebOperatorNode node)
A helper method called from thebuildExpressionParts(com.microstrategy.web.objects.WebNode)
to build expression parts for rank and percent metric expressions.protected void
buildOutputLevelPart(WebOperatorNode node)
A helper method that builds and adds to the parts collection a dimensionality expression partprotected void
buildPostfixOperatorParts(WebOperatorNode node, java.lang.String operatorName)
A helper method used to build expression parts for postfix operatorsprotected void
buildPrefixOperatorParts(WebOperatorNode node, java.lang.String operatorName)
A helper method used to build expression parts for prefix operatorsjava.lang.String
getConstNodeVal(WebNode node)
A helper method that extracts value from the constant and time nodes.java.lang.String
getExpressionStr()
Builds and returns user-friendly expression string from the expression partsprotected java.lang.String
getMessageStr(int key)
A helper method that obtains a proper string from the resource bundleprotected java.lang.String
getMessageStr(int key, java.lang.String param)
A helper method that obtains a proper string from the resource bundle and replaces the "##" substring in it with the param valueprotected java.lang.String
getNodeStr(WebNode node)
A helper method used to build string representation of expression sub-nodes.java.lang.String
getPart(java.lang.String name)
Returns specified expresson part or null if the part does not exist.protected java.lang.String
getTupleStr(WebOperatorNode node)
A helper method used to build a tuple string representationboolean
hasPart(java.lang.String name)
Returns true if the collection contains part with specified nameprotected void
logWarning(java.lang.String message)
A helper method that logs warningsprotected ExpressionStringsImpl
newExpressionParts(WebNode node)
A helper factory method that creates newExpressionParts
instances for thegetNodeStr(com.microstrategy.web.objects.WebNode)
method.static void
removeThreadLocal()
void
setDataSets(RWDataSets value)
void
setPart(java.lang.String name, java.lang.String value)
Sets specified part valuevoid
setShowDynamicDatesAsStatic(boolean val)
void
setUseMathOperators(boolean val)
boolean
showDynamicDatesAsStatic()
boolean
useMathOperators()
-
-
-
Constructor Detail
-
ExpressionStringsImpl
public ExpressionStringsImpl(ExpressionObject pOb)
Constructs expression parts object for a specified expression object.
-
ExpressionStringsImpl
public ExpressionStringsImpl(ExpressionObject pOb, java.util.Locale locale)
Constructs expression parts object for a specified expression object and a given locale
-
ExpressionStringsImpl
protected ExpressionStringsImpl(ExpressionStringsImpl parent)
This constructor is used when a childExpressionParts
object is used to build subexpression string.- Parameters:
parent
- a parentExpressionParts
objects- See Also:
buildExpressionParts(com.microstrategy.web.objects.WebNode)
,newExpressionParts(com.microstrategy.web.objects.WebNode)
-
-
Method Detail
-
removeThreadLocal
public static void removeThreadLocal()
-
buildExpressionParts
public void buildExpressionParts(WebNode node)
Builds expression parts collection for a specified expression node.- Specified by:
buildExpressionParts
in interfaceExpressionStrings
- Parameters:
node
- expression node
-
getPart
public java.lang.String getPart(java.lang.String name)
Description copied from interface:ExpressionStrings
Returns specified expresson part or null if the part does not exist.- Specified by:
getPart
in interfaceExpressionStrings
- Parameters:
name
- a part name- Returns:
- a part value
-
setPart
public void setPart(java.lang.String name, java.lang.String value)
Description copied from interface:ExpressionStrings
Sets specified part value- Specified by:
setPart
in interfaceExpressionStrings
- Parameters:
name
- a part namevalue
- a part value
-
hasPart
public boolean hasPart(java.lang.String name)
Description copied from interface:ExpressionStrings
Returns true if the collection contains part with specified name- Specified by:
hasPart
in interfaceExpressionStrings
- Parameters:
name
- a part name- Returns:
- true if the collection contains part with specified name
-
getExpressionStr
public java.lang.String getExpressionStr()
Description copied from interface:ExpressionStrings
Builds and returns user-friendly expression string from the expression parts- Specified by:
getExpressionStr
in interfaceExpressionStrings
- Returns:
- name a part name
-
useMathOperators
public boolean useMathOperators()
-
setUseMathOperators
public void setUseMathOperators(boolean val)
-
showDynamicDatesAsStatic
public boolean showDynamicDatesAsStatic()
-
setShowDynamicDatesAsStatic
public void setShowDynamicDatesAsStatic(boolean val)
-
buildMrpParts
protected void buildMrpParts(WebOperatorNode node)
A helper method called from thebuildExpressionParts(com.microstrategy.web.objects.WebNode)
to build expression parts for rank and percent metric expressions.- Parameters:
node
- expression node
-
addMrpPrefix
protected void addMrpPrefix(WebOperatorNode node)
A helper method used to add rank/percent prefix to the left operand part- Parameters:
node
- an expression node
-
buildExprParts
protected void buildExprParts(WebOperatorNode node)
A helper method called from the {link buildExpressionParts} to build expression parts for all expression types excluding rank and percent metric expressions.- Parameters:
node
- expression node
-
buildInfixOperatorParts
protected void buildInfixOperatorParts(WebOperatorNode node, java.lang.String operatorName)
A helper method used to build expression parts for infix operators- Parameters:
node
- operator nodeoperatorName
- an operator name like "Grater then" or "+" and so on.
-
buildAndOrOperatorParts
protected void buildAndOrOperatorParts(WebOperatorNode node, java.lang.String operatorName)
A helper method used to build expression parts for infix operators- Parameters:
node
- operator nodeoperatorName
- an operator name like "Grater then" or "+" and so on.
-
buildPrefixOperatorParts
protected void buildPrefixOperatorParts(WebOperatorNode node, java.lang.String operatorName)
A helper method used to build expression parts for prefix operators- Parameters:
node
- operator nodeoperatorName
- an operator name like "Not" or "-" and so on.
-
buildBetweenOperatorParts
protected void buildBetweenOperatorParts(WebOperatorNode node, java.lang.String operatorName)
A helper method used to build expression parts for BETWEEN operators- Parameters:
node
- operator nodeoperatorName
- an operator name ("between" or "not between").
-
buildInOperatorParts
protected void buildInOperatorParts(WebOperatorNode node, java.lang.String operatorName)
A helper method used to build expression parts for IN operators- Parameters:
node
- operator nodeoperatorName
- an operator name ("in" or "not in").
-
buildDescendantsParts
protected void buildDescendantsParts(WebOperatorNode node)
-
buildPostfixOperatorParts
protected void buildPostfixOperatorParts(WebOperatorNode node, java.lang.String operatorName)
A helper method used to build expression parts for postfix operators- Parameters:
node
- operator nodeoperatorName
- an operator name like "is null" and so on.
-
buildLeftOperandParts
protected void buildLeftOperandParts(WebOperatorNode node)
A helper method used to build left operand parts- Parameters:
node
- an expression node
-
buildLeftOperandFromOperator
protected void buildLeftOperandFromOperator(WebOperatorNode node)
A helper method called from thebuildLeftOperandParts(com.microstrategy.web.objects.WebOperatorNode)
to build left operand parts in the case the left operand is an operator.- Parameters:
node
- a sub-node representing left operand
-
buildFunction
protected void buildFunction(WebOperatorNode node, java.lang.String functionName)
A helper method used to build a tuple string representation- Parameters:
node
- a sub-node representing a tuple
-
getTupleStr
protected java.lang.String getTupleStr(WebOperatorNode node)
A helper method used to build a tuple string representation- Parameters:
node
- a sub-node representing a tuple
-
buildFormShortcutParts
protected void buildFormShortcutParts(WebFormShortcutNode node)
A helper method used to build expression parts (left operand and attribute form) for the form shortcut node- Parameters:
node
- a for shortcut node
-
getNodeStr
protected java.lang.String getNodeStr(WebNode node)
A helper method used to build string representation of expression sub-nodes. Internally this method creates anotherExpressionParts
object callse it's buildExpressionParts to build sub-node's parts then calls getExpressionStr method. This process can recurcively propagate down expression tree.- Parameters:
node
- an expression sub-node- Returns:
- a sub-node string representation
-
newExpressionParts
protected ExpressionStringsImpl newExpressionParts(WebNode node)
A helper factory method that creates newExpressionParts
instances for thegetNodeStr(com.microstrategy.web.objects.WebNode)
method. This implementation creates instancess of theExpressionPartsImpl
class. Override this method to use customExpressionParts
objects
-
buildOutputLevelPart
protected void buildOutputLevelPart(WebOperatorNode node)
A helper method that builds and adds to the parts collection a dimensionality expression part- Parameters:
node
- an expression node
-
buildBreakByPart
protected void buildBreakByPart(WebOperatorNode node)
-
buildDimtyStr
protected java.lang.String buildDimtyStr(WebOperatorNode node)
-
getConstNodeVal
public java.lang.String getConstNodeVal(WebNode node)
A helper method that extracts value from the constant and time nodes. It also wraps in quotes string and time constant values.- Specified by:
getConstNodeVal
in interfaceExpressionStrings
-
getMessageStr
protected java.lang.String getMessageStr(int key)
A helper method that obtains a proper string from the resource bundle- Parameters:
key
- a message key
-
getMessageStr
protected java.lang.String getMessageStr(int key, java.lang.String param)
A helper method that obtains a proper string from the resource bundle and replaces the "##" substring in it with the param value- Parameters:
key
- a message keyparam
- a string parameter
-
logWarning
protected void logWarning(java.lang.String message)
A helper method that logs warnings
-
setDataSets
public void setDataSets(RWDataSets value)
- Specified by:
setDataSets
in interfaceExpressionStrings
-
-