Style Intelligence v12.0

inetsoft.uql
Class Condition

java.lang.Object
  extended by inetsoft.uql.AbstractCondition
      extended by inetsoft.uql.Condition
All Implemented Interfaces:
XCondition, inetsoft.util.ContentObject, inetsoft.util.XMLSerializable, Serializable, Cloneable
Direct Known Subclasses:
AssetCondition

public class Condition
extends AbstractCondition

A Condition object defines a comparison operation to be performed on a value to determine if it should be included in a result set.

See Also:
Serialized Form

Field Summary
protected  boolean caseSensitive
           
protected  boolean ctype
           
protected  boolean dupcheck
           
protected  List values
           
 
Fields inherited from class inetsoft.uql.AbstractCondition
equal, negated, op, type
 
Fields inherited from interface inetsoft.uql.XCondition
BETWEEN, BOTTOM_N, CONTAINS, CORRELATED, DATE_IN, EQUAL_TO, GREATER_THAN, LESS_THAN, LIKE, NONE, NULL, ONE_OF, PSEUDO, STARTING_WITH, TOP_N
 
Constructor Summary
Condition()
          Create a condition for a default data type of STRING.
Condition(boolean ctype, boolean dupcheck)
          Create a condition for a default data type of STRING.
Condition(String type)
          Create a condition for the specified data type.
 
Method Summary
 void addValue(Object value)
          Add a condition value.
 Object clone()
          Creates and returns a copy of this object.
 boolean containsValue(Object name)
          Check if contains a values.
 boolean equals(Object obj)
          Check if equals another object.
 boolean evaluate(Object value)
          Evaluate this condition against the specified value object.
 UserVariable[] getAllVariables()
          Get all variables in the condition value list.
 DataRef[] getDataRefValues()
          Get the data ref value if any.
 Object getValue(int index)
          Get the specified value.
 int getValueCount()
          Get the number of values in this condition.
 List getValues()
          Get the values of a row.
 boolean isCaseSensitive()
          Determine if the test will be case sensitive when comparing strings.
 boolean isConvertingType()
           
 boolean isEqualChangeable()
          Check if equal is changeable.
 boolean isIgnored()
          Check whether to ignore this condition.
 boolean isNegatedChangeable()
          Check if negated is changeable.
 boolean isOperationChangeable()
          Check if operation is changeable.
 boolean isOptimized()
          Check whether optimization is checked on.
static boolean isSessionVariable(Object v0)
          Check if the string is a session variable, _USER_, _ROLES_, _GROUPS_.
 boolean isTypeChangeable()
          Check if type is changeable.
 boolean isValid()
          Check if the condition is a valid condition.
static boolean isVariable(Object v0)
          Checks if a String follows the StyleReport convention for declaring variables.
static boolean isVariable(Object v0, boolean unrestricted)
          Checks if a String follows the StyleReport convention for declaring variables.
protected  Object normalizeValue(Object value, Object target)
          Normalize a value.
protected  Object parseConditionValue(Element atag)
          Parse the condition value.
 void parseContents(Element elem)
          Parse the contents.
 boolean printKey(PrintWriter writer)
          Print the key to identify this content object.
 void removeAllValues()
          Clear all values from this condition.
 void replaceVariable(VariableTable vart)
          Replace all embeded user variables with value from variable table.
 void setCaseSensitive(boolean caseSensitive)
          Set whether the test will be case sensitive when comparing strings.
 void setConvertingType(boolean ctype)
           
 void setIgnored(boolean ignored)
          Set whether to ignore this condition.
 void setOptimized(boolean optimized)
          Set whether optimization is check on.
 void setType(String type)
          Set the condition value data type.
 void setValue(int idx, Object value)
          Set (replace) a condition value.
 String toString()
          Get a textual representation of this object.
protected  void writeConditionValue(PrintWriter writer, Object val)
          Set the condition value object as xml.
 void writeContents(PrintWriter writer)
          Write the contents.
 
Methods inherited from class inetsoft.uql.AbstractCondition
checkValueString, createDefaultValue, createXCondition, equalsContent, getBoolean, getDate, getDateObject, getObject, getObject, getOperation, getType, getValueSQLString, getValueString, getValueString, getValueString, isEqual, isNegated, parseAttributes, parseXML, setEqual, setNegated, setOperation, writeAttributes, writeXML
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

caseSensitive

protected boolean caseSensitive

values

protected List values

ctype

protected transient boolean ctype

dupcheck

protected transient boolean dupcheck
Constructor Detail

Condition

public Condition()
Create a condition for a default data type of STRING.


Condition

public Condition(boolean ctype,
                 boolean dupcheck)
Create a condition for a default data type of STRING.


Condition

public Condition(String type)
Create a condition for the specified data type.

Parameters:
type - the data type of the condition. Must be one of the data type constants defined in XSchema.
Method Detail

isVariable

public static boolean isVariable(Object v0)
Checks if a String follows the StyleReport convention for declaring variables. Variables start with $( and end with ).

Parameters:
v0 - the String representation of the variable to check

isVariable

public static boolean isVariable(Object v0,
                                 boolean unrestricted)
Checks if a String follows the StyleReport convention for declaring variables. Variables start with $( and end with ).

Parameters:
v0 - the String representation of the variable to check
unrestricted - check if allows empty value

isSessionVariable

public static boolean isSessionVariable(Object v0)
Check if the string is a session variable, _USER_, _ROLES_, _GROUPS_.


setType

public void setType(String type)
Set the condition value data type.

Specified by:
setType in interface XCondition
Overrides:
setType in class AbstractCondition
Parameters:
type - the data type of the condition. Must be one of the data type constants defined in XSchema.

setCaseSensitive

public void setCaseSensitive(boolean caseSensitive)
Set whether the test will be case sensitive when comparing strings.

Parameters:
caseSensitive - true for case sensitive comparisons.

isCaseSensitive

public boolean isCaseSensitive()
Determine if the test will be case sensitive when comparing strings.

Returns:
true for case sensitive comparisons.

setIgnored

public void setIgnored(boolean ignored)
Set whether to ignore this condition.


isIgnored

public boolean isIgnored()
Check whether to ignore this condition.


isTypeChangeable

public boolean isTypeChangeable()
Check if type is changeable.

Returns:
true if changeable, false otherwise.

isOperationChangeable

public boolean isOperationChangeable()
Check if operation is changeable.

Returns:
true if changeable, false otherwise.

isEqualChangeable

public boolean isEqualChangeable()
Check if equal is changeable.

Returns:
true if changeable, false otherwise.

isNegatedChangeable

public boolean isNegatedChangeable()
Check if negated is changeable.

Returns:
true if changeable, false otherwise.

addValue

public void addValue(Object value)
Add a condition value. Condition values are the predefined objects that objects will be compared with.

Parameters:
value - the condition value.

setValue

public void setValue(int idx,
                     Object value)
Set (replace) a condition value.

Parameters:
idx - value index.
value - the condition value.

removeAllValues

public void removeAllValues()
Clear all values from this condition.


getValueCount

public int getValueCount()
Get the number of values in this condition.

Returns:
the number of values.

getValue

public Object getValue(int index)
Get the specified value.

Parameters:
index - the zero-based index of the value to get.
Returns:
the value object.

getDataRefValues

public DataRef[] getDataRefValues()
Get the data ref value if any.

Returns:
the contained data ref value if any.

replaceVariable

public void replaceVariable(VariableTable vart)
Replace all embeded user variables with value from variable table.

Parameters:
vart - the specified variable table.

getAllVariables

public UserVariable[] getAllVariables()
Get all variables in the condition value list.

Returns:
the variable list.

getValues

public List getValues()
Get the values of a row.

Returns:
the values of the row.

isConvertingType

public final boolean isConvertingType()

setConvertingType

public final void setConvertingType(boolean ctype)

evaluate

public boolean evaluate(Object value)
Evaluate this condition against the specified value object.

Parameters:
value - the value object this condition should be compared with.
Returns:
true if the value object meets this condition.

setOptimized

public void setOptimized(boolean optimized)
Set whether optimization is check on.


isOptimized

public boolean isOptimized()
Check whether optimization is checked on.


normalizeValue

protected Object normalizeValue(Object value,
                                Object target)
Normalize a value.

Parameters:
value - the spefied value to be normalized.

isValid

public boolean isValid()
Check if the condition is a valid condition.

Returns:
true if is valid, false otherwise.

writeContents

public void writeContents(PrintWriter writer)
Write the contents.

Parameters:
writer - the specified print writer.

writeConditionValue

protected void writeConditionValue(PrintWriter writer,
                                   Object val)
Set the condition value object as xml.


parseContents

public void parseContents(Element elem)
                   throws Exception
Parse the contents.

Parameters:
elem - the specified xml element.
Throws:
Exception

parseConditionValue

protected Object parseConditionValue(Element atag)
                              throws Exception
Parse the condition value.

Throws:
Exception

toString

public String toString()
Get a textual representation of this object.

Overrides:
toString in class Object
Returns:
a String containing a textual representation of this object.

printKey

public boolean printKey(PrintWriter writer)
                 throws Exception
Print the key to identify this content object. If the keys of two content objects are equal, the content objects are equal too.

Specified by:
printKey in interface inetsoft.util.ContentObject
Overrides:
printKey in class AbstractCondition
Throws:
Exception

equals

public boolean equals(Object obj)
Check if equals another object.

Overrides:
equals in class AbstractCondition

clone

public Object clone()
Creates and returns a copy of this object.

Specified by:
clone in interface XCondition
Overrides:
clone in class AbstractCondition
Returns:
a condition Object defining the same parameters as this.

containsValue

public final boolean containsValue(Object name)
Check if contains a values.

Parameters:
name - the specified condtion name.
Returns:
true if contains, otherwise false.

Copyright © 1996-2014 InetSoft Technology Corp. All Rights Reserved.