KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensymphony > workflow > query > FieldExpression


1 /*
2  * Copyright (c) 2002-2003 by OpenSymphony
3  * All rights reserved.
4  */

5 package com.opensymphony.workflow.query;
6
7
8 /**
9  * Field expressions are used when constructing a workflow query on the fields
10  * of persistent workflow instances like (START_DATE, OWNER,....).
11  * Field expressions have three attributes. These are:
12  * <li>operator: This is the operator to apply on the expression.
13  * <li>field: The workflow field to test agains
14  * <li>Context: The context to search in, which can be one history, current steps, or a workflow instance.
15  *
16  * @author Christine Zimmermann
17  * @version $Revision: 1.3 $
18  */

19 public class FieldExpression extends Expression {
20     //~ Static fields/initializers /////////////////////////////////////////////
21

22     // field operators
23

24     /**
25      * Constant for the equality operator.
26      */

27     public final static int EQUALS = 1;
28
29     /**
30      * Constant for the less than operator.
31      */

32     public final static int LT = 2;
33
34     /**
35      * Constant for the greater than operator.
36      */

37     public final static int GT = 3;
38
39     /**
40      * Constant for the not equals operator.
41      */

42     public final static int NOT_EQUALS = 5;
43
44     // fields
45

46     /**
47      * Constant for the workflow owner field.
48      */

49     public final static int OWNER = 1;
50
51     /**
52      * Constant for the workflow start date field.
53      */

54     public final static int START_DATE = 2;
55
56     /**
57      * Constant for the workflow finish date field.
58      */

59     public final static int FINISH_DATE = 3;
60
61     /**
62      * Constant for the workflow action field.
63      */

64     public final static int ACTION = 4;
65
66     /**
67      * Constant for the workflow step field.
68      */

69     public final static int STEP = 5;
70
71     /**
72      * Constant for the workflow caller field.
73      */

74     public final static int CALLER = 6;
75
76     /**
77      * Constant for the workflow status field.
78      */

79     public final static int STATUS = 7;
80
81     /**
82      * Constant for the workflow name field.
83      */

84     public final static int NAME = 8;
85
86     /**
87     * Constant for the state field.
88     */

89     public final static int STATE = 9;
90
91     // field context
92

93     /**
94      * Constant for the history steps context.
95      * Specifying this context means that the search
96      * should be performed against the workflow steps.
97      */

98     public final static int HISTORY_STEPS = 1;
99
100     /**
101      * Constant for the history steps context.
102      * Specifying this context means that the search
103      * should be performed against the workflow current steps.
104      */

105     public final static int CURRENT_STEPS = 2;
106
107     /**
108      * Constant for the workflow entry context.
109      * Specifying this context means that the search
110      * should be performed against the workflow entries.
111      */

112     public final static int ENTRY = 3;
113
114     //~ Instance fields ////////////////////////////////////////////////////////
115

116     private Object JavaDoc value;
117     private int context;
118     private int field;
119     private int operator;
120
121     //~ Constructors ///////////////////////////////////////////////////////////
122

123     public FieldExpression() {
124     }
125
126     public FieldExpression(int field, int context, int operator, Object JavaDoc value) {
127         this.context = context;
128         this.operator = operator;
129         this.field = field;
130         this.value = value;
131     }
132
133     public FieldExpression(int field, int context, int operator, Object JavaDoc value, boolean negate) {
134         this(field, context, operator, value);
135         super.negate = negate;
136     }
137
138     //~ Methods ////////////////////////////////////////////////////////////////
139

140     public int getContext() {
141         return context;
142     }
143
144     public int getField() {
145         return field;
146     }
147
148     public boolean isNested() {
149         return false;
150     }
151
152     public int getOperator() {
153         return operator;
154     }
155
156     public Object JavaDoc getValue() {
157         return value;
158     }
159 }
160
Popular Tags