com.konakartadmin.app
Class AdminExpressionVariable

java.lang.Object
  extended by com.konakartadmin.app.AdminExpressionVariable
All Implemented Interfaces:
AdminObjectIf

public class AdminExpressionVariable
extends java.lang.Object
implements AdminObjectIf

An expression variable is part of an expression


Field Summary
static int AND
          Expression type.
private  int andOr
          Defines whether this variable has to be ANDed or ORed with the one that precedes it.
private  int customerTagId
          Id of the customer tag for this variable
private  java.lang.String customerValue
          The customer value for the tag which is compared to the value attribute when evaluating the expression variable.
static int EQUAL
          Comparison type.
private  int expressionId
          Id of the expression that this variable belongs to
static int GREATER_EQUAL
          Comparison type.
static int GREATER_THAN
          Comparison type.
private  int groupAndOr
          Defines whether this group has to be ANDed or ORed with the one that precedes it.
private  int groupOrder
          The order of the group that this expression variable belongs to.
private  int id
          id
static int LESS_EQUAL
          Comparison type.
static int LESS_THAN
          Comparison type.
static int MATCH
          Comparison type to match regular expression
static int NOT_EQUAL
          Comparison type.
private  int operator
          Valid operators are: AdminExpressionVariable.EQUAL AdminExpressionVariable.NOT_EQUAL AdminExpressionVariable.GREATER_EQUAL AdminExpressionVariable.GREATER_THAN AdminExpressionVariable.LESS_EQUAL AdminExpressionVariable.LESS_THAN AdminExpressionVariable.MATCH - Used to match regular expression Note that not all operators are valid for all tag types.
static int OR
          Expression type.
private  int order
          The order of this expression variable.
private  int type
          The type of variable.
private  java.lang.String value
          The value of the expression variable.
 
Constructor Summary
AdminExpressionVariable()
          Constructor
AdminExpressionVariable(com.workingdogs.village.Record vr, org.apache.torque.util.Criteria c)
          Instantiates the attributes of the Tag object from a Record object
 
Method Summary
protected  boolean compareAge(int oper)
          The value attribute is the age in seconds.
protected  boolean compareBooleans(int oper)
          Compare Booleans
protected  boolean compareDates(int oper)
          Compare dates which are stored as strings containing the millisecond value
protected  boolean compareDecimals(int oper)
          Compare decimals
protected  boolean compareInts(int oper)
          Compare integers
protected  boolean compareMultiInt(int oper)
          Compare Multi ints which are stored as integers separated by AdminCustomerTag.DELIM
protected  boolean compareStrings(int oper)
          Compare strings
 boolean evaluate()
          Evaluates the variable by comparing the value attribute with the customerValue attribute using the operator attribute.
 int getAndOr()
           
 int getCustomerTagId()
           
 java.lang.String getCustomerValue()
           
 int getExpressionId()
           
 int getGroupAndOr()
           
 int getGroupOrder()
           
 int getId()
           
 int getOperator()
           
protected  java.lang.String getOperatorName(int oper)
          Returns the name of the operator mainly for reporting purposes.
 int getOrder()
           
 int getType()
           
 java.lang.String getValue()
           
 void setAndOr(int andOr)
           
 void setCustomerTagId(int customerTagId)
           
 void setCustomerValue(java.lang.String customerValue)
           
 void setExpressionId(int expressionId)
           
 void setGroupAndOr(int groupAndOr)
           
 void setGroupOrder(int groupOrder)
           
 void setId(int id)
           
 void setOperator(int operator)
           
 void setOrder(int order)
           
 void setType(int type)
           
 void setValue(java.lang.String value)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EQUAL

public static final int EQUAL
Comparison type.

See Also:
Constant Field Values

NOT_EQUAL

public static final int NOT_EQUAL
Comparison type.

See Also:
Constant Field Values

GREATER_THAN

public static final int GREATER_THAN
Comparison type.

See Also:
Constant Field Values

LESS_THAN

public static final int LESS_THAN
Comparison type.

See Also:
Constant Field Values

GREATER_EQUAL

public static final int GREATER_EQUAL
Comparison type.

See Also:
Constant Field Values

LESS_EQUAL

public static final int LESS_EQUAL
Comparison type.

See Also:
Constant Field Values

MATCH

public static final int MATCH
Comparison type to match regular expression

See Also:
Constant Field Values

AND

public static final int AND
Expression type.

See Also:
Constant Field Values

OR

public static final int OR
Expression type.

See Also:
Constant Field Values

id

private int id
id


customerTagId

private int customerTagId
Id of the customer tag for this variable


expressionId

private int expressionId
Id of the expression that this variable belongs to


type

private int type
The type of variable. It must match the type of the customer tag referred to by customerTagId. Valid types are:


operator

private int operator
Valid operators are:
  • AdminExpressionVariable.EQUAL
  • AdminExpressionVariable.NOT_EQUAL
  • AdminExpressionVariable.GREATER_EQUAL
  • AdminExpressionVariable.GREATER_THAN
  • AdminExpressionVariable.LESS_EQUAL
  • AdminExpressionVariable.LESS_THAN
  • AdminExpressionVariable.MATCH - Used to match regular expression
Note that not all operators are valid for all tag types.


value

private java.lang.String value
The value of the expression variable. Valid values depend on the tag type.


customerValue

private java.lang.String customerValue
The customer value for the tag which is compared to the value attribute when evaluating the expression variable.


order

private int order
The order of this expression variable.


andOr

private int andOr
Defines whether this variable has to be ANDed or ORed with the one that precedes it.


groupOrder

private int groupOrder
The order of the group that this expression variable belongs to.


groupAndOr

private int groupAndOr
Defines whether this group has to be ANDed or ORed with the one that precedes it.

Constructor Detail

AdminExpressionVariable

public AdminExpressionVariable()
Constructor


AdminExpressionVariable

public AdminExpressionVariable(com.workingdogs.village.Record vr,
                               org.apache.torque.util.Criteria c)
                        throws com.workingdogs.village.DataSetException
Instantiates the attributes of the Tag object from a Record object

Parameters:
vr - Record containing data
c - Criteria containing column names
Throws:
com.workingdogs.village.DataSetException
Method Detail

toString

public java.lang.String toString()
Specified by:
toString in interface AdminObjectIf
Overrides:
toString in class java.lang.Object
Returns:
Returns a string containing the attributes of the ExpressionVariable object.

evaluate

public boolean evaluate()
                 throws KKAdminException
Evaluates the variable by comparing the value attribute with the customerValue attribute using the operator attribute. False is returned if any of the values are null.

Not all operators are valid for all customer tag types. The valid operators for each customer tag type are:

  • AdminCustomerTag.BOOLEAN_TYPE
    • AdminExpressionVariable.EQUAL
    • AdminExpressionVariable.NOT_EQUAL
  • AdminCustomerTag.DATE_TYPE
    • AdminExpressionVariable.EQUAL
    • AdminExpressionVariable.NOT_EQUAL
    • AdminExpressionVariable.GREATER_EQUAL
    • AdminExpressionVariable.GREATER_THAN
    • AdminExpressionVariable.LESS_EQUAL
    • AdminExpressionVariable.LESS_THAN
  • AdminCustomerTag.AGE_TYPE
    • AdminExpressionVariable.EQUAL
    • AdminExpressionVariable.NOT_EQUAL
    • AdminExpressionVariable.GREATER_EQUAL
    • AdminExpressionVariable.GREATER_THAN
    • AdminExpressionVariable.LESS_EQUAL
    • AdminExpressionVariable.LESS_THAN
  • AdminCustomerTag.DECIMAL_TYPE
    • AdminExpressionVariable.EQUAL
    • AdminExpressionVariable.NOT_EQUAL
    • AdminExpressionVariable.GREATER_EQUAL
    • AdminExpressionVariable.GREATER_THAN
    • AdminExpressionVariable.LESS_EQUAL
    • AdminExpressionVariable.LESS_THAN
  • AdminCustomerTag.INT_TYPE
    • AdminExpressionVariable.EQUAL
    • AdminExpressionVariable.NOT_EQUAL
    • AdminExpressionVariable.GREATER_EQUAL
    • AdminExpressionVariable.GREATER_THAN
    • AdminExpressionVariable.LESS_EQUAL
    • AdminExpressionVariable.LESS_THAN
  • AdminCustomerTag.MULTI_INT_TYPE
    • AdminExpressionVariable.EQUAL
    • AdminExpressionVariable.NOT_EQUAL
  • AdminCustomerTag.STRING_TYPE
    • AdminExpressionVariable.EQUAL
    • AdminExpressionVariable.NOT_EQUAL
    • AdminExpressionVariable.MATCH

Returns:
Returns a boolean
Throws:
KKAdminException

compareStrings

protected boolean compareStrings(int oper)
                          throws KKAdminException
Compare strings

Parameters:
oper -
Returns:
Returns true or false
Throws:
KKAdminException

compareBooleans

protected boolean compareBooleans(int oper)
                           throws KKAdminException
Compare Booleans

Parameters:
oper -
Returns:
Returns true or false
Throws:
KKAdminException

compareMultiInt

protected boolean compareMultiInt(int oper)
                           throws KKAdminException
Compare Multi ints which are stored as integers separated by AdminCustomerTag.DELIM

Parameters:
oper -
Returns:
Returns true or false
Throws:
KKAdminException

compareInts

protected boolean compareInts(int oper)
                       throws KKAdminException
Compare integers

Parameters:
oper -
Returns:
Returns true or false
Throws:
KKAdminException

compareDates

protected boolean compareDates(int oper)
                        throws KKAdminException
Compare dates which are stored as strings containing the millisecond value

Parameters:
oper -
Returns:
Returns true or false
Throws:
KKAdminException

compareAge

protected boolean compareAge(int oper)
                      throws KKAdminException
The value attribute is the age in seconds. We calculate the current age of the customerValue and compare it to the value.

Parameters:
oper -
Returns:
Returns true or false
Throws:
KKAdminException

compareDecimals

protected boolean compareDecimals(int oper)
                           throws KKAdminException
Compare decimals

Parameters:
oper -
Returns:
Returns true or false
Throws:
KKAdminException

getOperatorName

protected java.lang.String getOperatorName(int oper)
Returns the name of the operator mainly for reporting purposes.

Parameters:
oper -
Returns:
the name of the operator as a String.

getId

public int getId()
Specified by:
getId in interface AdminObjectIf
Returns:
the id

setId

public void setId(int id)
Specified by:
setId in interface AdminObjectIf
Parameters:
id - the id to set

getCustomerTagId

public int getCustomerTagId()
Returns:
the customerTagId

setCustomerTagId

public void setCustomerTagId(int customerTagId)
Parameters:
customerTagId - the customerTagId to set

getExpressionId

public int getExpressionId()
Returns:
the expressionId

setExpressionId

public void setExpressionId(int expressionId)
Parameters:
expressionId - the expressionId to set

getType

public int getType()
Returns:
the type

setType

public void setType(int type)
Parameters:
type - the type to set

getOperator

public int getOperator()
Returns:
the operator

setOperator

public void setOperator(int operator)
Parameters:
operator - the operator to set

getValue

public java.lang.String getValue()
Returns:
the value

setValue

public void setValue(java.lang.String value)
Parameters:
value - the value to set

getOrder

public int getOrder()
Returns:
the order

setOrder

public void setOrder(int order)
Parameters:
order - the order to set

getAndOr

public int getAndOr()
Returns:
the andOr

setAndOr

public void setAndOr(int andOr)
Parameters:
andOr - the andOr to set

getGroupOrder

public int getGroupOrder()
Returns:
the groupOrder

setGroupOrder

public void setGroupOrder(int groupOrder)
Parameters:
groupOrder - the groupOrder to set

getGroupAndOr

public int getGroupAndOr()
Returns:
the groupAndOr

setGroupAndOr

public void setGroupAndOr(int groupAndOr)
Parameters:
groupAndOr - the groupAndOr to set

getCustomerValue

public java.lang.String getCustomerValue()
Returns:
the customerValue

setCustomerValue

public void setCustomerValue(java.lang.String customerValue)
Parameters:
customerValue - the customerValue to set


Copyright © 2011 DS Data Systems UK Ltd.