Style Intelligence v12.0

inetsoft.uql
Class AbstractCondition

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

public abstract class AbstractCondition
extends Object
implements XCondition

XCondition defines the condition methods.

See Also:
Serialized Form

Field Summary
protected  boolean equal
           
protected  boolean negated
           
protected  int op
           
protected  String 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
AbstractCondition()
          Constructor.
 
Method Summary
static void checkValueString(String value, String type)
          Check a string value.
 Object clone()
          Clone the object.
static Object createDefaultValue(String type)
          Create default value for user variable.
static XCondition createXCondition(Element elem)
          Create one xcondition from an xml element.
 boolean equals(Object obj)
          Check if equqls another object.
 boolean equalsContent(Object obj)
          Check if equals another object in content.
static Boolean getBoolean(String val)
          Get a Boolean object with a value equal to that specified.
static Date getDate(String val)
          Get a Date object with a value equal to that specified.
static Object getDateObject(String type, Object val)
          Get an sql Date object due to the type.
static Object getObject(String type, String value)
          Get an Object instance with the specified value and type.
static Object getObject(String type, String value, boolean var)
          Get an Object instance with the specified value and type.
 int getOperation()
          Get the comparison operation of this condition.
 String getType()
          Get the condition value data type.
static String getValueSQLString(Object value)
          Get a sql string representation of the specified object's value.
static String getValueString(Object value)
          Get a String representation of the specified object's value.
static String getValueString(Object value, String type)
          Get a String representation of the specified object's value.
static String getValueString(Object value, String type, boolean def)
          Get a String representation of the specified object's value.
 boolean isEqual()
          Determine whether equivalence will be tested in addition to the defined comparison operation.
 boolean isNegated()
          Set whether this condition result should be negated.
 void parseAttributes(Element elem)
          Parse the attributes.
 void parseXML(Element ctag)
          Read in the XML representation of this object.
 boolean printKey(PrintWriter writer)
          Print the key to identify this content object.
 void setEqual(boolean equal)
          Set the equal to option when the comparison operation is LESS_THAN or GREATER_THAN, i.e.
 void setNegated(boolean negated)
          Determine whether this condition result should be negated.
 void setOperation(int op)
          Set the comparison operation of this condition.
 void setType(String type)
          Set the condition value data type.
 void writeAttributes(PrintWriter writer)
          Writer the attributes.
 void writeXML(PrintWriter writer)
          Write this data selection to XML.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface inetsoft.uql.XCondition
evaluate, getAllVariables, isEqualChangeable, isNegatedChangeable, isOperationChangeable, isTypeChangeable, isValid, parseContents, replaceVariable, writeContents
 

Field Detail

type

protected String type

op

protected int op

negated

protected boolean negated

equal

protected boolean equal
Constructor Detail

AbstractCondition

public AbstractCondition()
Constructor.

Method Detail

createDefaultValue

public static Object createDefaultValue(String type)
Create default value for user variable.

Parameters:
type - of variable.
Returns:
default value.

getValueSQLString

public static String getValueSQLString(Object value)
Get a sql string representation of the specified object's value. The format of the resulting String is determined by the type of object specified.

Parameters:
value - the object to get a a representation of.
Returns:
the sql string representation of the specified object's value.

getValueString

public static String getValueString(Object value)
Get a String representation of the specified object's value. The format of the resulting String is determined by the type of object specified.

Parameters:
value - the object to get a a representation of.
Returns:
the String representation of the specified object's value.

getValueString

public static String getValueString(Object value,
                                    String type)
Get a String representation of the specified object's value. The format of the resulting String is determined by the type of object specified.

Parameters:
value - the object to get a a representation of.
type - the data type.
Returns:
the String representation of the specified object's value.

getValueString

public static String getValueString(Object value,
                                    String type,
                                    boolean def)
Get a String representation of the specified object's value. The format of the resulting String is determined by the type of object specified.

Parameters:
value - the object to get a a representation of.
type - the data type.
def - true to use default value, false otherwise.
Returns:
the String representation of the specified object's value.

checkValueString

public static void checkValueString(String value,
                                    String type)
                             throws Exception
Check a string value.

Parameters:
value - the specified value.
type - the specified data type.
Throws:
Exception

getObject

public static Object getObject(String type,
                               String value,
                               boolean var)
Get an Object instance with the specified value and type.

Parameters:
type - the data type of the desired Object. Must be one of the data type constants defined in XSchema.
value - a String containing the desired value of the Object.
Returns:
an instance of the specified type of Object, having the specified value. If value is not a defined data type, value is returned. If var is true, a user variable is returned.

getObject

public static Object getObject(String type,
                               String value)
Get an Object instance with the specified value and type.

Parameters:
type - the data type of the desired Object. Must be one of the data type constants defined in XSchema.
value - a String containing the desired value of the Object.
Returns:
an instance of the specified type of Object, having the specified value. If value is not a defined data type, value is returned.

getDate

public static Date getDate(String val)
Get a Date object with a value equal to that specified.

Parameters:
val - a String representation of a date. The value should have the format yyyy-MM-dd.
Returns:
a Data object with the specified value. If unable to parse the value String, the current date will be returned.

getDateObject

public static Object getDateObject(String type,
                                   Object val)
Get an sql Date object due to the type.

Parameters:
val - the date to be converted.
type - the type of the date.
Returns:
a sql Date object with the specified value.

getBoolean

public static Boolean getBoolean(String val)
Get a Boolean object with a value equal to that specified.

Parameters:
val - a String representation of a boolean. The value should be true or false.
Returns:
a Boolean object with the specified value.

createXCondition

public static XCondition createXCondition(Element elem)
                                   throws Exception
Create one xcondition from an xml element.

Parameters:
elem - the specified xml element.
Returns:
the created xcondition.
Throws:
Exception

getType

public String getType()
Get the condition value data type.

Specified by:
getType in interface XCondition
Returns:
the data type of this condition. The type will be one of the constants defined in XSchema.

setType

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

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

getOperation

public int getOperation()
Get the comparison operation of this condition.

Specified by:
getOperation in interface XCondition
Returns:
one of the operation constant, one of the operation constants defined in this class.
See Also:
XCondition.EQUAL_TO, XCondition.ONE_OF, XCondition.LESS_THAN, XCondition.GREATER_THAN, XCondition.BETWEEN, XCondition.STARTING_WITH, XCondition.LIKE, XCondition.CONTAINS, XCondition.NULL, XCondition.TOP_N, XCondition.DATE_IN

setOperation

public void setOperation(int op)
Set the comparison operation of this condition.

Specified by:
setOperation in interface XCondition
Parameters:
op - one of the operation constants defined in this class.

isEqual

public final boolean isEqual()
Determine whether equivalence will be tested in addition to the defined comparison operation.

Specified by:
isEqual in interface XCondition
Returns:
true if equivalence will be tested

setEqual

public void setEqual(boolean equal)
Set the equal to option when the comparison operation is LESS_THAN or GREATER_THAN, i.e. a >= b.

Specified by:
setEqual in interface XCondition
Parameters:
equal - true if equivalence should be tested

isNegated

public boolean isNegated()
Set whether this condition result should be negated. A negated condition will evaluate as true if the if its condition definition(s) are not met.

Specified by:
isNegated in interface XCondition
Returns:
true if this condition is negated.

setNegated

public void setNegated(boolean negated)
Determine whether this condition result should be negated. A negated condition will evaluate as true if the if its condition definition(s) are not met.

Specified by:
setNegated in interface XCondition
Parameters:
negated - true if this condition is negated.

writeAttributes

public void writeAttributes(PrintWriter writer)
Writer the attributes.

Specified by:
writeAttributes in interface XCondition
Parameters:
writer - the specified print writer.

parseAttributes

public void parseAttributes(Element elem)
                     throws Exception
Parse the attributes.

Specified by:
parseAttributes in interface XCondition
Parameters:
elem - the specified xml element.
Throws:
Exception

clone

public Object clone()
Clone the object.

Specified by:
clone in interface XCondition
Overrides:
clone in class Object
Returns:
the cloned object.

equalsContent

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

Specified by:
equalsContent in interface inetsoft.util.ContentObject

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
Throws:
Exception

equals

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

Overrides:
equals in class Object

writeXML

public void writeXML(PrintWriter writer)
Write this data selection to XML.

Specified by:
writeXML in interface inetsoft.util.XMLSerializable
Parameters:
writer - the stream to output the XML text to

parseXML

public void parseXML(Element ctag)
              throws Exception
Read in the XML representation of this object.

Specified by:
parseXML in interface inetsoft.util.XMLSerializable
Parameters:
ctag - the XML element representing this object.
Throws:
Exception

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