KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > shark > expressionbuilders > ProcessMgrIteratorExpressionBuilderDODS


1 package org.enhydra.shark.expressionbuilders;
2
3 import java.util.Properties JavaDoc;
4
5 import org.enhydra.shark.api.common.ProcessMgrIteratorExpressionBuilder;
6 import org.enhydra.shark.api.common.SharkConstants;
7
8 /**
9  * @author Vladimir Puskas
10  * @version 0.21
11  */

12 public class ProcessMgrIteratorExpressionBuilderDODS extends
13                                                    BasicExpressionBuilder implements
14                                                                          ProcessMgrIteratorExpressionBuilder {
15    protected static final String JavaDoc sqlPackageId = " PackageId ";
16    protected static final String JavaDoc sqlProcessDefId = " ProcessDefinitionId ";
17    protected static final String JavaDoc sqlName = " Name ";
18    protected static final String JavaDoc sqlProcessDefVersion = " ProcessDefinitionVersion ";
19    protected static final String JavaDoc sqlState = " State ";
20    protected static final String JavaDoc sqlCreated = " ProcessDefinitionCreated ";
21
22    /*
23     * public static final ExpressionBuilder STATE_IS_OPEN = new
24     * BshExpressionBuilder().addStateEquals(SharkConstants.STATE_OPEN_NOT_RUNNING_SUSPENDED)
25     * .or()
26     * .addStateEquals(SharkConstants.STATE_OPEN_NOT_RUNNING_SUSPENDED)
27     * .or() .addStateEquals(SharkConstants.STATE_OPEN_RUNNING); public
28     * static final ExpressionBuilder STATE_IS_CLOSED = new
29     * BshExpressionBuilder().addStateEquals(SharkConstants.STATE_CLOSED_ABORTED)
30     * .or() .addStateEquals(SharkConstants.STATE_CLOSED_COMPLETED) .or()
31     * .addStateEquals(SharkConstants.STATE_CLOSED_TERMINATED);
32     */

33
34    public ProcessMgrIteratorExpressionBuilderDODS(Properties JavaDoc p) {
35       super(p);
36    }
37
38    public ProcessMgrIteratorExpressionBuilder and() {
39       this.operator = AND_OPERATOR;
40       return this;
41    }
42
43    public ProcessMgrIteratorExpressionBuilder or() {
44       this.operator = OR_OPERATOR;
45       return this;
46    }
47
48    public ProcessMgrIteratorExpressionBuilder not() {
49       this.operator |= NOT_OPERATOR;
50       return this;
51    }
52
53    public ProcessMgrIteratorExpressionBuilder addNameEquals(String JavaDoc name) {
54       addEquals(SharkConstants.MGR_NAME, sqlName, name);
55       return this;
56    }
57
58    public ProcessMgrIteratorExpressionBuilder addPackageIdEquals(String JavaDoc exp) {
59       addEquals(SharkConstants.MGR_PACKAGE_ID,
60                 sqlPackageId,
61                 exp);
62       return this;
63    }
64
65    public ProcessMgrIteratorExpressionBuilder addProcessDefIdEquals(String JavaDoc exp) {
66       addEquals(SharkConstants.MGR_PROCESS_DEFINITION_ID,
67                 sqlProcessDefId,
68                 exp);
69       return this;
70    }
71
72    public ProcessMgrIteratorExpressionBuilder addVersionEquals(String JavaDoc exp) {
73       addEquals(SharkConstants.MGR_VERSION,
74                 sqlProcessDefVersion,
75                 exp);
76       return this;
77    }
78
79    public ProcessMgrIteratorExpressionBuilder addCreatedTimeEquals(long arg) {
80       addEquals(SharkConstants.MGR_CREATED_TIME_MS, sqlCreated, arg);
81       return this;
82    }
83
84    public ProcessMgrIteratorExpressionBuilder addCreatedTimeBefore(long arg) {
85       addLessThan(SharkConstants.MGR_CREATED_TIME_MS, sqlCreated, arg);
86       return this;
87    }
88
89    public ProcessMgrIteratorExpressionBuilder addCreatedTimeAfter(long arg) {
90       addGreaterThan(SharkConstants.MGR_CREATED_TIME_MS, sqlCreated, arg);
91       return this;
92    }
93    
94    public ProcessMgrIteratorExpressionBuilder addIsEnabled() {
95       char NOT_PRECEDES = appendOperator(true);
96       this.bshExpression.add(NOT_PRECEDES
97                              + SharkConstants.MGR_ENABLED);
98       this.sqlExpression.add(sqlState
99                              + NOT_PRECEDES + "= 0 ");
100       this.propertiesUsed.add(SharkConstants.MGR_ENABLED);
101       return this;
102    }
103
104    public ProcessMgrIteratorExpressionBuilder addExpression(String JavaDoc exp) {
105       sqlComplete = false;
106       appendOperator(false);
107       this.bshExpression.add(exp);
108       return this;
109    }
110
111    public ProcessMgrIteratorExpressionBuilder addExpression(ProcessMgrIteratorExpressionBuilder eb) {
112       appendOperator(eb.isComplete());
113       this.bshExpression.add(eb);
114       this.sqlExpression.add(eb);
115       sqlComplete |= eb.isComplete();
116       return this;
117    }
118
119    public ProcessMgrIteratorExpressionBuilder setOrderByPackageId(boolean ascending) {
120       super.setOrderBy(sqlPackageId, ascending);
121       return this;
122    }
123
124    public ProcessMgrIteratorExpressionBuilder setOrderByProcessDefId(boolean ascending) {
125       super.setOrderBy(sqlProcessDefId, ascending);
126       return this;
127    }
128
129    public ProcessMgrIteratorExpressionBuilder setOrderByName(boolean ascending) {
130       super.setOrderBy(sqlName, ascending);
131       return this;
132    }
133
134    public ProcessMgrIteratorExpressionBuilder setOrderByVersion(boolean ascending) {
135       super.setOrderBy(sqlProcessDefVersion, ascending);
136       return this;
137    }
138
139    public ProcessMgrIteratorExpressionBuilder setOrderByEnabled(boolean ascending) {
140       super.setOrderBy(sqlState, ascending);
141       return this;
142    }
143
144    public ProcessMgrIteratorExpressionBuilder setOrderByCreatedTime(boolean ascending) {
145       super.setOrderBy(sqlCreated, ascending);
146       return this;
147    }
148
149 }
150
Popular Tags