org.opensubsystems.patterns.listdata.data
Class DataCondition

java.lang.Object
  extended by org.opensubsystems.patterns.listdata.data.DataCondition
All Implemented Interfaces:
java.io.Serializable

public class DataCondition
extends java.lang.Object
implements java.io.Serializable

Class representing logical condition which data should match.

Version:
$Id: DataCondition.java,v 1.14 2007/03/24 08:33:53 bastafidli Exp $
Author:
Peter Satury
See Also:
Serialized Form
Code reviewer:
Miro Halas
Code reviewed:
1.10 2006/05/26 07:30:24 jlegeny

Field Summary
static int DATA_CODE_FLAG_NO
          code for NO flag
static java.lang.Integer DATA_CODE_FLAG_NO_OBJ
          Object code for NO flag
static int DATA_CODE_FLAG_YES
          code for YES flag
static java.lang.Integer DATA_CODE_FLAG_YES_OBJ
          Object code for YES flag
protected  int m_iAttribute
          Constant for logical attribute of a data object, which has relation to some value.
protected  int m_iOperation
          Operation, constant for the operation between the data object attribute the value of the specified attribute.
protected  int m_iValueType
          Type of the value.
protected  java.lang.Object m_objOriginalValue
          Original value which applies to operation for given attribute.
protected  java.lang.Object m_objValue
          Value which applies to operation for given attribute.
static int NO_ATTRIBUTE
          Constant for no attribute set in the data condition.
static java.lang.Integer NO_ATTRIBUTE_OBJ
          Constant for no attribute set in the data condition.
static int NO_OPERATION
          Code for no operation set in the data condition.
static java.lang.Integer NO_OPERATION_OBJ
          Code for no operation set in the data condition.
static int OPERATION_CONTAINS_CASESENSITIVE
          Case sensitive like %str% The value has to match index of value if ListDatabaseUtils.OPERATIONS.
static int OPERATION_CONTAINS_CASEUNSENSITIVE
          Case unsensitive like %str% The value has to match index of value if ListDatabaseUtils.OPERATIONS.
static int OPERATION_ENDS_CASESENSITIVE
          Case sensitive like %str The value has to match index of value if ListDatabaseUtils.OPERATIONS.
static int OPERATION_ENDS_CASEUNSENSITIVE
          Case unsensitive like %str The value has to match index of value if ListDatabaseUtils.OPERATIONS.
static int OPERATION_EQUALS
          = (equals) operation code
static int OPERATION_EQUALS_CASESENSITIVE
          Case sensitive like str The value has to match index of value if ListDatabaseUtils.OPERATIONS.
static int OPERATION_EQUALS_CASEUNSENSITIVE
          Case unsensitive like str The value has to match index of value if ListDatabaseUtils.OPERATIONS.
static int OPERATION_EQUALS_OR_NULL
          Operation comparing two values or allowin null instead of one.
static int OPERATION_GREATER
          > (Greater than) operation code The value has to match index of value if ListDatabaseUtils.OPERATIONS.
static int OPERATION_GREATER_EQUALS
          >= (Greater or equals than) operation code The value has to match index of value if ListDatabaseUtils.OPERATIONS.
static int OPERATION_IN
          IN operation code Operation can be array of objects (Object[]) or String or Collection of Objects.
static int OPERATION_LESS
          < (Less than) operation code The value has to match index of value if ListDatabaseUtils.OPERATIONS.
static int OPERATION_LESS_EQUALS
          <= (Less or equals than) operation code The value has to match index of value if ListDatabaseUtils.OPERATIONS.
static int OPERATION_NOT_CONTAINS_CASESENSITIVE
          Case sensitive not like %str% The value has to match index of value if ListDatabaseUtils.OPERATIONS.
static int OPERATION_NOT_CONTAINS_CASEUNSENSITIVE
          case unsensitive not like %str% The value has to match index of value if ListDatabaseUtils.OPERATIONS.
static int OPERATION_NOT_ENDS_CASESENSITIVE
          Case sensitive not like %str The value has to match index of value if ListDatabaseUtils.OPERATIONS.
static int OPERATION_NOT_ENDS_CASEUNSENSITIVE
          Case unsensitive not like %str The value has to match index of value if ListDatabaseUtils.OPERATIONS.
static int OPERATION_NOT_EQUALS
          <> (not equals) operation code The value has to match index of value if ListDatabaseUtils.OPERATIONS.
static int OPERATION_NOT_EQUALS_CASESENSITIVE
          Case sensitive not like str The value has to match index of value if ListDatabaseUtils.OPERATIONS.
static int OPERATION_NOT_EQUALS_CASEUNSENSITIVE
          Case unsensitive not like str The value has to match index of value if ListDatabaseUtils.OPERATIONS.
static int OPERATION_NOT_IN
          NOT IN operation code Operation can be array of objects (Object[]) or String or Collection of Objects.
static int OPERATION_NOT_STARTS_CASESENSITIVE
          Case sensitive not like str% The value has to match index of value if ListDatabaseUtils.OPERATIONS.
static int OPERATION_NOT_STARTS_CASEUNSENSITIVE
          Case unsensitive not like str% The value has to match index of value if ListDatabaseUtils.OPERATIONS.
static int OPERATION_SQL_QUERY
          Sql query operation This operation is used if special query part have to be in the final query In this case just create data condition of this type and set what ever attribute you want except NO_ATTRIBUTE, value will be String representing query value type will be VALUE_TYPE_STRING.
static int OPERATION_STARTS_CASESENSITIVE
          Case sensitive like str% The value has to match index of value if ListDatabaseUtils.OPERATIONS.
static int OPERATION_STARTS_CASEUNSENSITIVE
          Case unsensitive like str% The value has to match index of value if ListDatabaseUtils.OPERATIONS.
static int VALUE_TYPE_BOOLEAN
          Value type constant for Boolean.
static int VALUE_TYPE_DOUBLE
          Value type constant for Double.
static int VALUE_TYPE_ID
          Value type constant for ID.
static int VALUE_TYPE_INTEGER
          Value type constant for Integer.
static int VALUE_TYPE_STRING
          Value type constant for String.
static int VALUE_TYPE_TIMESTAMP
          Value type constant for Timestamp.
static int VALUE_TYPE_UNKNOWN
          Unknown value type constant.
 
Constructor Summary
DataCondition()
          Default empty constructor
DataCondition(int attribute, int operation, java.lang.Object value, int valueType)
          Full constructor
DataCondition(int attribute, int operation, java.lang.Object value, int valueType, java.lang.Object originalValue)
          Copy constructor
 
Method Summary
 int getAttribute()
           
 int getOperation()
           
 java.lang.Object getOriginalValue()
           
 java.lang.String getOriginalValueString()
           
 java.lang.Object getValue()
           
 java.lang.String getValueString()
           
 int getValueType()
           
static java.util.Map getYesNoMap()
           
 void setOriginalValue(java.lang.Object objOriginalValue)
           
 void setValue(java.lang.Object objValue)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_ATTRIBUTE

public static final int NO_ATTRIBUTE
Constant for no attribute set in the data condition.

See Also:
Constant Field Values

NO_ATTRIBUTE_OBJ

public static final java.lang.Integer NO_ATTRIBUTE_OBJ
Constant for no attribute set in the data condition.


NO_OPERATION

public static final int NO_OPERATION
Code for no operation set in the data condition.

See Also:
Constant Field Values

NO_OPERATION_OBJ

public static final java.lang.Integer NO_OPERATION_OBJ
Code for no operation set in the data condition.


OPERATION_EQUALS

public static final int OPERATION_EQUALS
= (equals) operation code

See Also:
Constant Field Values

OPERATION_IN

public static final int OPERATION_IN
IN operation code Operation can be array of objects (Object[]) or String or Collection of Objects. This allows to for example do things like this ID: in (1,2,3,4) when Integer[] = [1,2,3,4,5] is passed in or when String "1,2,3,4,5" is passed in. But it is also possible to do ID in (SELECT ID FROM xxx WHERE yyy) if String SELECT ID FROM xxx WHERE yyy is passed in. The value has to match index of value if ListDatabaseUtils.OPERATIONS.

See Also:
Constant Field Values

OPERATION_NOT_IN

public static final int OPERATION_NOT_IN
NOT IN operation code Operation can be array of objects (Object[]) or String or Collection of Objects. This allows to for example do things like this: ID not in (1,2,3,4) when Integer[] = [1,2,3,4,5] is passed in or when String "1,2,3,4,5" is passed in. But it is also possible to do: ID not in (SELECT ID FROM xxx WHERE yyy) if String SELECT ID FROM xxx WHERE yyy is passed in. The value has to match index of value if ListDatabaseUtils.OPERATIONS.

See Also:
Constant Field Values

OPERATION_NOT_EQUALS

public static final int OPERATION_NOT_EQUALS
<> (not equals) operation code The value has to match index of value if ListDatabaseUtils.OPERATIONS.

See Also:
Constant Field Values

OPERATION_GREATER

public static final int OPERATION_GREATER
> (Greater than) operation code The value has to match index of value if ListDatabaseUtils.OPERATIONS.

See Also:
Constant Field Values

OPERATION_GREATER_EQUALS

public static final int OPERATION_GREATER_EQUALS
>= (Greater or equals than) operation code The value has to match index of value if ListDatabaseUtils.OPERATIONS.

See Also:
Constant Field Values

OPERATION_LESS

public static final int OPERATION_LESS
< (Less than) operation code The value has to match index of value if ListDatabaseUtils.OPERATIONS.

See Also:
Constant Field Values

OPERATION_LESS_EQUALS

public static final int OPERATION_LESS_EQUALS
<= (Less or equals than) operation code The value has to match index of value if ListDatabaseUtils.OPERATIONS.

See Also:
Constant Field Values

OPERATION_CONTAINS_CASEUNSENSITIVE

public static final int OPERATION_CONTAINS_CASEUNSENSITIVE
Case unsensitive like %str% The value has to match index of value if ListDatabaseUtils.OPERATIONS.

See Also:
Constant Field Values

OPERATION_CONTAINS_CASESENSITIVE

public static final int OPERATION_CONTAINS_CASESENSITIVE
Case sensitive like %str% The value has to match index of value if ListDatabaseUtils.OPERATIONS.

See Also:
Constant Field Values

OPERATION_SQL_QUERY

public static final int OPERATION_SQL_QUERY
Sql query operation This operation is used if special query part have to be in the final query In this case just create data condition of this type and set what ever attribute you want except NO_ATTRIBUTE, value will be String representing query value type will be VALUE_TYPE_STRING. In that case this query will be added to the final query as ... AND MY_QUERY AND ... This way you can do very special queries. The value has to match index of value if ListDatabaseUtils.OPERATIONS.

See Also:
Constant Field Values

OPERATION_EQUALS_OR_NULL

public static final int OPERATION_EQUALS_OR_NULL
Operation comparing two values or allowin null instead of one. The value has to match index of value if ListDatabaseUtils.OPERATIONS.

See Also:
Constant Field Values

OPERATION_NOT_CONTAINS_CASEUNSENSITIVE

public static final int OPERATION_NOT_CONTAINS_CASEUNSENSITIVE
case unsensitive not like %str% The value has to match index of value if ListDatabaseUtils.OPERATIONS.

See Also:
Constant Field Values

OPERATION_NOT_CONTAINS_CASESENSITIVE

public static final int OPERATION_NOT_CONTAINS_CASESENSITIVE
Case sensitive not like %str% The value has to match index of value if ListDatabaseUtils.OPERATIONS.

See Also:
Constant Field Values

OPERATION_STARTS_CASEUNSENSITIVE

public static final int OPERATION_STARTS_CASEUNSENSITIVE
Case unsensitive like str% The value has to match index of value if ListDatabaseUtils.OPERATIONS.

See Also:
Constant Field Values

OPERATION_STARTS_CASESENSITIVE

public static final int OPERATION_STARTS_CASESENSITIVE
Case sensitive like str% The value has to match index of value if ListDatabaseUtils.OPERATIONS.

See Also:
Constant Field Values

OPERATION_NOT_STARTS_CASEUNSENSITIVE

public static final int OPERATION_NOT_STARTS_CASEUNSENSITIVE
Case unsensitive not like str% The value has to match index of value if ListDatabaseUtils.OPERATIONS.

See Also:
Constant Field Values

OPERATION_NOT_STARTS_CASESENSITIVE

public static final int OPERATION_NOT_STARTS_CASESENSITIVE
Case sensitive not like str% The value has to match index of value if ListDatabaseUtils.OPERATIONS.

See Also:
Constant Field Values

OPERATION_ENDS_CASEUNSENSITIVE

public static final int OPERATION_ENDS_CASEUNSENSITIVE
Case unsensitive like %str The value has to match index of value if ListDatabaseUtils.OPERATIONS.

See Also:
Constant Field Values

OPERATION_ENDS_CASESENSITIVE

public static final int OPERATION_ENDS_CASESENSITIVE
Case sensitive like %str The value has to match index of value if ListDatabaseUtils.OPERATIONS.

See Also:
Constant Field Values

OPERATION_NOT_ENDS_CASEUNSENSITIVE

public static final int OPERATION_NOT_ENDS_CASEUNSENSITIVE
Case unsensitive not like %str The value has to match index of value if ListDatabaseUtils.OPERATIONS.

See Also:
Constant Field Values

OPERATION_NOT_ENDS_CASESENSITIVE

public static final int OPERATION_NOT_ENDS_CASESENSITIVE
Case sensitive not like %str The value has to match index of value if ListDatabaseUtils.OPERATIONS.

See Also:
Constant Field Values

OPERATION_EQUALS_CASEUNSENSITIVE

public static final int OPERATION_EQUALS_CASEUNSENSITIVE
Case unsensitive like str The value has to match index of value if ListDatabaseUtils.OPERATIONS.

See Also:
Constant Field Values

OPERATION_EQUALS_CASESENSITIVE

public static final int OPERATION_EQUALS_CASESENSITIVE
Case sensitive like str The value has to match index of value if ListDatabaseUtils.OPERATIONS.

See Also:
Constant Field Values

OPERATION_NOT_EQUALS_CASEUNSENSITIVE

public static final int OPERATION_NOT_EQUALS_CASEUNSENSITIVE
Case unsensitive not like str The value has to match index of value if ListDatabaseUtils.OPERATIONS.

See Also:
Constant Field Values

OPERATION_NOT_EQUALS_CASESENSITIVE

public static final int OPERATION_NOT_EQUALS_CASESENSITIVE
Case sensitive not like str The value has to match index of value if ListDatabaseUtils.OPERATIONS.

See Also:
Constant Field Values

DATA_CODE_FLAG_YES

public static final int DATA_CODE_FLAG_YES
code for YES flag

See Also:
Constant Field Values

DATA_CODE_FLAG_YES_OBJ

public static final java.lang.Integer DATA_CODE_FLAG_YES_OBJ
Object code for YES flag


DATA_CODE_FLAG_NO

public static final int DATA_CODE_FLAG_NO
code for NO flag

See Also:
Constant Field Values

DATA_CODE_FLAG_NO_OBJ

public static final java.lang.Integer DATA_CODE_FLAG_NO_OBJ
Object code for NO flag


VALUE_TYPE_UNKNOWN

public static final int VALUE_TYPE_UNKNOWN
Unknown value type constant.

See Also:
Constant Field Values

VALUE_TYPE_ID

public static final int VALUE_TYPE_ID
Value type constant for ID.

See Also:
Constant Field Values

VALUE_TYPE_BOOLEAN

public static final int VALUE_TYPE_BOOLEAN
Value type constant for Boolean.

See Also:
Constant Field Values

VALUE_TYPE_INTEGER

public static final int VALUE_TYPE_INTEGER
Value type constant for Integer.

See Also:
Constant Field Values

VALUE_TYPE_DOUBLE

public static final int VALUE_TYPE_DOUBLE
Value type constant for Double.

See Also:
Constant Field Values

VALUE_TYPE_STRING

public static final int VALUE_TYPE_STRING
Value type constant for String.

See Also:
Constant Field Values

VALUE_TYPE_TIMESTAMP

public static final int VALUE_TYPE_TIMESTAMP
Value type constant for Timestamp.

See Also:
Constant Field Values

m_iAttribute

protected int m_iAttribute
Constant for logical attribute of a data object, which has relation to some value.


m_iOperation

protected int m_iOperation
Operation, constant for the operation between the data object attribute the value of the specified attribute.


m_objValue

protected java.lang.Object m_objValue
Value which applies to operation for given attribute.


m_iValueType

protected int m_iValueType
Type of the value. One of VALUE_TYPE_XXX constants


m_objOriginalValue

protected java.lang.Object m_objOriginalValue
Original value which applies to operation for given attribute. This attribute has to be set up because some operations can modify value and original value will be lost. Therefore we need to store this original value within the extra parameter.

Constructor Detail

DataCondition

public DataCondition()
Default empty constructor


DataCondition

public DataCondition(int attribute,
                     int operation,
                     java.lang.Object value,
                     int valueType)
Full constructor

Parameters:
attribute - - attribute - the code for the attribute on which the operation should be performed, see the OPERATION_XXX constants
operation - - operation - what operation should be performed between the attribute and the value
value - - value - any data object which is compared or which operate on the attribute in some fashion (e.g. attribute "count", operation "greater than", value "5"
valueType - - type of the value (see constants VALUE_TYPE_XXX), this is used when inserting value to the SQL query to put it there in correct format

DataCondition

public DataCondition(int attribute,
                     int operation,
                     java.lang.Object value,
                     int valueType,
                     java.lang.Object originalValue)
Copy constructor

Parameters:
attribute - - attribute - the code for the attribute on which the operation should be performed, see the OPERATION_XXX constants
operation - - operation - what operation should be performed between the attribute and the value
value - - value - any data object which is compared or which operate on the attribute in some fashion (e.g. attribute "count", operation "greater than", value "5"
valueType - - type of the value (see constants VALUE_TYPE_XXX), this is used when inserting value to the SQL query to put it there in correct format
originalValue - - original value
Method Detail

getAttribute

public int getAttribute()
Returns:
int - attribute

getOperation

public int getOperation()
Returns:
int - operation

getValue

public java.lang.Object getValue()
Returns:
Object - value

setValue

public void setValue(java.lang.Object objValue)
Parameters:
objValue - - new object value

getValueType

public int getValueType()
Returns:
int - code of value type

getOriginalValue

public java.lang.Object getOriginalValue()
Returns:
Object - originalValue

setOriginalValue

public void setOriginalValue(java.lang.Object objOriginalValue)
Parameters:
objOriginalValue - - new object original value

getValueString

public java.lang.String getValueString()
Returns:
String - representation of value

getOriginalValueString

public java.lang.String getOriginalValueString()
Returns:
String - representation of original value

getYesNoMap

public static java.util.Map getYesNoMap()
Returns:
Map - map yes, no, true, false strings into int values


Copyright © 2003 - 2006 OpenSubsystems s.r.o.