KickJava   Java API By Example, From Geeks To Geeks.

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


1 /* ActivityIteratorExpressionBuilderDODS.java */
2
3 package org.enhydra.shark.expressionbuilders;
4
5 import java.util.Iterator JavaDoc;
6 import java.util.Properties JavaDoc;
7
8 import org.enhydra.shark.api.RootException;
9 import org.enhydra.shark.api.common.ActivityIteratorExpressionBuilder;
10 import org.enhydra.shark.api.common.SharkConstants;
11
12 /**
13  * ActivityIteratorExpressionBuilderDODS
14  *
15  * @author V.Puskas
16  * @version 0.21
17  */

18 public class ActivityIteratorExpressionBuilderDODS extends
19                                                  BasicExpressionBuilder implements
20                                                                        ActivityIteratorExpressionBuilder {
21    private static final String JavaDoc sqlId = " Id ";
22    private static final String JavaDoc sqlActivityDefId = " ActivityDefinitionId ";
23    private static final String JavaDoc sqlActivitySetDefId = " ActivitySetDefinitionId ";
24    private static final String JavaDoc sqlState = " State ";
25    private static final String JavaDoc sqlPriority = " Priority ";
26    private static final String JavaDoc sqlName = " Name ";
27    private static final String JavaDoc sqlActivated = " Activated ";
28    private static final String JavaDoc sqlAccepted = " Accepted ";
29    private static final String JavaDoc sqlLastStateTime = " LastStateTime ";
30
31    public ActivityIteratorExpressionBuilderDODS(Properties JavaDoc p) {
32       super(p);
33    }
34
35    public ActivityIteratorExpressionBuilder and() {
36       this.operator = AND_OPERATOR;
37       return this;
38    }
39
40    public ActivityIteratorExpressionBuilder or() {
41       this.operator = OR_OPERATOR;
42       return this;
43    }
44
45    public ActivityIteratorExpressionBuilder not() {
46       this.operator |= NOT_OPERATOR;
47       return this;
48    }
49
50    public ActivityIteratorExpressionBuilder addPackageIdEquals(String JavaDoc exp) {
51       addEqualsWithSubQuery(SharkConstants.ACT_MGR_PACKAGE_ID,
52                             " Process ",
53                             "IN (SELECT "
54                             + objectid_column_name
55                             + " FROM Processes WHERE ProcessDefinition IN (SELECT"
56                             + objectid_column_name
57                             + "FROM ProcessDefinitions WHERE PackageId = ",
58                             exp,
59                             ")) ");
60       return this;
61    }
62
63    public ActivityIteratorExpressionBuilder addProcessDefIdEquals(String JavaDoc exp) {
64       addEqualsWithSubQuery(SharkConstants.ACT_MGR_PROCESS_DEFINITION_ID,
65                             " Process ",
66                             "IN (SELECT "
67                             + objectid_column_name
68                             + " FROM Processes WHERE ProcessDefinition IN (SELECT "
69                             + objectid_column_name
70                             + " FROM ProcessDefinitions WHERE ProcessDefinitionId = ",
71                             exp,
72                             ")) ");
73       return this;
74    }
75
76    public ActivityIteratorExpressionBuilder addMgrNameEquals(String JavaDoc exp) {
77       addEqualsWithSubQuery(SharkConstants.ACT_MGR_NAME,
78                             " Process ",
79                             "IN (SELECT "
80                             + objectid_column_name
81                             + " FROM Processes WHERE ProcessDefinition IN (SELECT "
82                             + objectid_column_name
83                             + " FROM ProcessDefinitions WHERE Name = ",
84                             exp,
85                             ")) ");
86       return this;
87    }
88
89    public ActivityIteratorExpressionBuilder addVersionEquals(String JavaDoc exp) {
90       addEqualsWithSubQuery(SharkConstants.ACT_MGR_VERSION,
91                             " Process ",
92                             "IN (SELECT "
93                             + objectid_column_name
94                             + " FROM Processes WHERE ProcessDefinition IN (SELECT "
95                             + objectid_column_name
96                             + " FROM ProcessDefinitions WHERE ProcessDefinitionVersion = ",
97                             exp,
98                             ")) ");
99       return this;
100    }
101
102    public ActivityIteratorExpressionBuilder addIsMgrEnabled() {
103       addEqualsWithSubQuery(SharkConstants.ACT_MGR_ENABLED,
104                             " Process ",
105                             "IN (SELECT "
106                             + objectid_column_name
107                             + " FROM Processes WHERE ProcessDefinition IN (SELECT "
108                             + objectid_column_name
109                             + " FROM ProcessDefinitions WHERE State = ",
110                             "0",
111                             ")) ");
112       return this;
113    }
114
115    public ActivityIteratorExpressionBuilder addProcessStateEquals(String JavaDoc arg) {
116       addEqualsWithSubQuery(SharkConstants.ACT_PROC_STATE,
117                             " Process ",
118                             "IN (SELECT "
119                             + objectid_column_name
120                             + " FROM Processes WHERE State IN (SELECT "
121                             + objectid_column_name
122                             + " FROM ProcessStates WHERE Name = ",
123                             arg,
124                             ")) ");
125       return this;
126    }
127
128    public ActivityIteratorExpressionBuilder addProcessStateStartsWith(String JavaDoc arg) {
129       addStartsWithSubQuery(SharkConstants.ACT_PROC_STATE,
130                             " Process ",
131                             "IN (SELECT "
132                             + objectid_column_name
133                             + " FROM Processes WHERE State IN (SELECT "
134                             + objectid_column_name
135                             + " FROM ProcessStates WHERE Name LIKE ",
136                             arg,
137                             ")) ");
138       return this;
139    }
140
141    public ActivityIteratorExpressionBuilder addProcessIdEquals(String JavaDoc arg) {
142       addEqualsWithSubQuery(SharkConstants.ACT_PROC_KEY,
143                             " Process ",
144                             "IN (SELECT "
145                             + objectid_column_name
146                             + " FROM Processes WHERE Id = ",
147                             arg,
148                             ") ");
149       return this;
150    }
151
152    public ActivityIteratorExpressionBuilder addProcessNameEquals(String JavaDoc arg) {
153       addEqualsWithSubQuery(SharkConstants.ACT_PROC_NAME,
154                             " Process ",
155                             "IN (SELECT "
156                             + objectid_column_name
157                             + " FROM Processes WHERE Name = ",
158                             arg,
159                             ") ");
160       return this;
161    }
162
163    public ActivityIteratorExpressionBuilder addProcessPriorityEquals(int arg) {
164       addEqualsWithSubQuery(SharkConstants.ACT_PROC_PRIORITY,
165                             " Process ",
166                             "IN (SELECT "
167                             + objectid_column_name
168                             + " FROM Processes WHERE Priority = ",
169                             arg,
170                             ") ");
171       return this;
172    }
173
174    public ActivityIteratorExpressionBuilder addProcessDescriptionEquals(String JavaDoc arg) {
175       addEqualsWithSubQuery(SharkConstants.ACT_PROC_DESCRIPTION,
176                             " Process ",
177                             "IN (SELECT "
178                             + objectid_column_name
179                             + " FROM Processes WHERE Description = ",
180                             arg,
181                             ") ");
182       return this;
183    }
184
185    public ActivityIteratorExpressionBuilder addProcessDescriptionContains(String JavaDoc arg) {
186       // FIXME Auto-generated method stub
187
return this;
188    }
189
190    public ActivityIteratorExpressionBuilder addProcessRequesterIdEquals(String JavaDoc arg) {
191       addEqualsWithSubQueryTwice(SharkConstants.ACT_PROC_REQUESTER_ID,
192                                  " Process ",
193                                  "IN (SELECT "
194                                  + objectid_column_name
195                                  + " FROM Processes WHERE Id IN (SELECT Id FROM ProcessRequesters WHERE ActivityRequester IN (SELECT "
196                                  + objectid_column_name
197                                  + "FROM Activities WHERE Id = ",
198                                  arg,
199                                  ") OR ResourceRequester IN (SELECT "
200                                  + objectid_column_name
201                                  + "FROM ResourcesTable WHERE Username = ",
202                                  "))) ");
203       return this;
204    }
205
206    public ActivityIteratorExpressionBuilder addProcessCreatedTimeEquals(long arg) {
207       addEqualsWithSubQuery(SharkConstants.ACT_PROC_CREATED_TIME_MS,
208                             " Process ",
209                             "IN (SELECT "
210                             + objectid_column_name
211                             + " FROM Processes WHERE Created = ",
212                             arg,
213                             ") ");
214       return this;
215    }
216
217    public ActivityIteratorExpressionBuilder addProcessCreatedTimeBefore(long arg) {
218       addLessThanWithSubQuery(SharkConstants.ACT_PROC_CREATED_TIME_MS,
219                               " Process ",
220                               "IN (SELECT "
221                               + objectid_column_name
222                               + " FROM Processes WHERE Created ",
223                               arg,
224                               ") ");
225       return this;
226    }
227
228    public ActivityIteratorExpressionBuilder addProcessCreatedTimeAfter(long arg) {
229       addGreaterThanWithSubQuery(SharkConstants.ACT_PROC_CREATED_TIME_MS,
230                                  " Process ",
231                                  "IN (SELECT "
232                                  + objectid_column_name
233                                  + " FROM Processes WHERE Created ",
234                                  arg,
235                                  ") ");
236       return this;
237    }
238
239    public ActivityIteratorExpressionBuilder addProcessStartTimeEquals(long arg) {
240       addEqualsWithSubQuery(SharkConstants.ACT_PROC_START_TIME_MS,
241                             " Process ",
242                             "IN (SELECT "
243                             + objectid_column_name
244                             + " FROM Processes WHERE Started = ",
245                             arg,
246                             ") ");
247       return this;
248    }
249
250    public ActivityIteratorExpressionBuilder addProcessStartTimeBefore(long arg) {
251       addLessThanWithSubQuery(SharkConstants.ACT_PROC_START_TIME_MS,
252                               " Process ",
253                               "IN (SELECT "
254                               + objectid_column_name
255                               + " FROM Processes WHERE Started ",
256                               arg,
257                               ") ");
258       return this;
259    }
260
261    public ActivityIteratorExpressionBuilder addProcessStartTimeAfter(long arg) {
262       addGreaterThanWithSubQuery(SharkConstants.ACT_PROC_START_TIME_MS,
263                                  " Process ",
264                                  "IN (SELECT "
265                                  + objectid_column_name
266                                  + " FROM Processes WHERE Started ",
267                                  arg,
268                                  ") ");
269       return this;
270    }
271
272    public ActivityIteratorExpressionBuilder addProcessLastStateTimeEquals(long arg) {
273       addEqualsWithSubQuery(SharkConstants.ACT_PROC_LAST_STATE_TIME_MS,
274                             " Process ",
275                             "IN (SELECT "
276                             + objectid_column_name
277                             + " FROM Processes WHERE LastStateTime = ",
278                             arg,
279                             ") ");
280       return this;
281    }
282
283    public ActivityIteratorExpressionBuilder addProcessLastStateTimeBefore(long arg) {
284       addLessThanWithSubQuery(SharkConstants.ACT_PROC_LAST_STATE_TIME_MS,
285                               " Process ",
286                               "IN (SELECT "
287                               + objectid_column_name
288                               + " FROM Processes WHERE LastStateTime ",
289                               arg,
290                               ") ");
291       return this;
292    }
293
294    public ActivityIteratorExpressionBuilder addProcessLastStateTimeAfter(long arg) {
295       addGreaterThanWithSubQuery(SharkConstants.ACT_PROC_LAST_STATE_TIME_MS,
296                                  " Process ",
297                                  "IN (SELECT "
298                                  + objectid_column_name
299                                  + " FROM Processes WHERE LastStateTime ",
300                                  arg,
301                                  ") ");
302       return this;
303    }
304
305    public ActivityIteratorExpressionBuilder addProcessVariableEquals(String JavaDoc vName,
306                                                                      Object JavaDoc vValue) throws RootException {
307       if (vValue instanceof String JavaDoc) {
308          addVariableEquals(vName, (String JavaDoc) vValue);
309       } else if (vValue instanceof Long JavaDoc) {
310          addVariableEquals(vName, ((Long JavaDoc) vValue).longValue());
311       } else if (vValue instanceof Double JavaDoc) {
312          addVariableEquals(vName, ((Double JavaDoc) vValue).doubleValue());
313       } else if (vValue instanceof Boolean JavaDoc) {
314          addEqualsWithSubQuery(SharkConstants.ACT_PROC_CONTEXT_ + vName,
315                                " Process ",
316                                "IN (SELECT Process FROM ProcessData"
317                                +(this.usingStandardVariableModel?"":"WOB")
318                                +" WHERE VariableValueBOOL = ",
319                                ((Boolean JavaDoc) vValue).booleanValue() ? 1L : 0L,
320                                ") ");
321       } else {
322          throw new RootException("Class "
323                                  + vValue.getClass().getName()
324                                  + " not supported");
325       }
326       return this;
327    }
328
329    public ActivityIteratorExpressionBuilder addProcessVariableEquals(String JavaDoc vName,
330                                                                      String JavaDoc vValue) {
331       addEqualsWithSubQuery(SharkConstants.ACT_PROC_CONTEXT_ + vName,
332                             " Process ",
333                             "IN (SELECT Process FROM ProcessData"
334                             +(this.usingStandardVariableModel?"":"WOB")
335                             +" WHERE VariableValueVCHAR = ",
336                             vValue,
337                             ") ");
338       return this;
339    }
340
341    public ActivityIteratorExpressionBuilder addProcessVariableEquals(String JavaDoc vName,
342                                                                      long vValue) {
343       addEqualsWithSubQuery(SharkConstants.ACT_PROC_CONTEXT_ + vName,
344                             " Process ",
345                             "IN (SELECT Process FROM ProcessData"
346                             +(this.usingStandardVariableModel?"":"WOB")
347                             +" WHERE VariableValueLONG = ",
348                             vValue,
349                             ") ");
350       return this;
351    }
352
353    public ActivityIteratorExpressionBuilder addProcessVariableGreaterThan(String JavaDoc vName,
354                                                                           long vValue) {
355       addGreaterThanWithSubQuery(SharkConstants.ACT_PROC_CONTEXT_ + vName,
356                                  " Process ",
357                                  "IN (SELECT Process FROM ProcessData"
358                                  +(this.usingStandardVariableModel?"":"WOB")
359                                  +" WHERE VariableValueLONG ",
360                                  vValue,
361                                  ") ");
362       return this;
363    }
364
365    public ActivityIteratorExpressionBuilder addProcessVariableLessThan(String JavaDoc vName,
366                                                                        long vValue) {
367       addLessThanWithSubQuery(SharkConstants.ACT_PROC_CONTEXT_ + vName,
368                               " Process ",
369                               "IN (SELECT Process FROM ProcessData"
370                               +(this.usingStandardVariableModel?"":"WOB")
371                               +" WHERE VariableValueLONG ",
372                               vValue,
373                               ") ");
374       return this;
375    }
376
377    public ActivityIteratorExpressionBuilder addProcessVariableEquals(String JavaDoc vName, double vValue) {
378       addEqualsWithSubQuery(SharkConstants.ACT_PROC_CONTEXT_ + vName,
379                             " Process ",
380                             "IN (SELECT Process FROM ProcessData"
381                             +(this.usingStandardVariableModel?"":"WOB")
382                             +" WHERE VariableValueDBL = ",
383                             vValue,
384                             ") ");
385       return this;
386    }
387
388    public ActivityIteratorExpressionBuilder addProcessVariableGreaterThan(String JavaDoc vName,
389                                                                           double vValue) {
390       addGreaterThanWithSubQuery(SharkConstants.ACT_PROC_CONTEXT_ + vName,
391                                  " Process ",
392                                  "IN (SELECT Process FROM ProcessData"
393                                  +(this.usingStandardVariableModel?"":"WOB")
394                                  +" WHERE VariableValueDBL ",
395                                  vValue,
396                                  ") ");
397       return this;
398    }
399
400    public ActivityIteratorExpressionBuilder addProcessVariableLessThan(String JavaDoc vName,
401                                                                        double vValue) {
402       addLessThanWithSubQuery(SharkConstants.ACT_PROC_CONTEXT_ + vName,
403                               " Process ",
404                               "IN (SELECT Process FROM ProcessData"
405                               +(this.usingStandardVariableModel?"":"WOB")
406                               +" WHERE VariableValueDBL ",
407                               vValue,
408                               ") ");
409       return this;
410    }
411
412    public ActivityIteratorExpressionBuilder addStateEquals(String JavaDoc arg) {
413       addEqualsWithSubQuery(SharkConstants.ACT_STATE,
414             sqlState,
415                             "IN (SELECT "
416                             + objectid_column_name
417                             + " FROM ActivityStates WHERE Name = ",
418                             arg,
419                             ") ");
420       return this;
421    }
422
423    public ActivityIteratorExpressionBuilder addStateStartsWith(String JavaDoc arg) {
424       addStartsWithSubQuery(SharkConstants.ACT_STATE,
425                             sqlState,
426                             "IN (SELECT "
427                             + objectid_column_name
428                             + " FROM ActivityStates WHERE Name LIKE ",
429                             arg,
430                             ") ");
431       return this;
432    }
433
434    public ActivityIteratorExpressionBuilder addIdEquals(String JavaDoc arg) {
435       addEquals(SharkConstants.ACT_KEY, sqlId, arg);
436       return this;
437    }
438
439    public ActivityIteratorExpressionBuilder addNameEquals(String JavaDoc arg) {
440       addEquals(SharkConstants.ACT_NAME, sqlName, arg);
441       return this;
442    }
443
444    public ActivityIteratorExpressionBuilder addPriorityEquals(int arg) {
445       addEquals(SharkConstants.ACT_PRIORITY, sqlPriority, arg);
446       return this;
447    }
448
449    public ActivityIteratorExpressionBuilder addDescriptionEquals(String JavaDoc arg) {
450       addEquals(SharkConstants.ACT_DESCRIPTION, " Description ", arg);
451       return this;
452    }
453
454    public ActivityIteratorExpressionBuilder addDescriptionContains(String JavaDoc arg) {
455       addContains(SharkConstants.ACT_DESCRIPTION, " Description ", arg);
456       return this;
457    }
458
459    public ActivityIteratorExpressionBuilder addActivatedTimeEquals(long arg) {
460       addEquals(SharkConstants.ACT_ACTIVATED_TIME_MS, sqlActivated, arg);
461       return this;
462    }
463
464    public ActivityIteratorExpressionBuilder addActivatedTimeBefore(long arg) {
465       addGreaterThan(SharkConstants.ACT_ACTIVATED_TIME_MS, sqlActivated, arg);
466       return this;
467    }
468
469    public ActivityIteratorExpressionBuilder addActivatedTimeAfter(long arg) {
470       addLessThan(SharkConstants.ACT_ACTIVATED_TIME_MS, sqlActivated, arg);
471       return this;
472    }
473
474    public ActivityIteratorExpressionBuilder addLastStateTimeEquals(long arg) {
475       addEquals(SharkConstants.ACT_LAST_STATE_TIME_MS, sqlLastStateTime, arg);
476       return this;
477    }
478
479    public ActivityIteratorExpressionBuilder addLastStateTimeBefore(long arg) {
480       addGreaterThan(SharkConstants.ACT_LAST_STATE_TIME_MS,
481             sqlLastStateTime,
482                      arg);
483       return this;
484    }
485
486    public ActivityIteratorExpressionBuilder addLastStateTimeAfter(long arg) {
487       addLessThan(SharkConstants.ACT_LAST_STATE_TIME_MS,
488             sqlLastStateTime,
489                   arg);
490       return this;
491    }
492
493    public ActivityIteratorExpressionBuilder addAcceptedTimeEquals(long arg) {
494       addEquals(SharkConstants.ACT_ACCEPTED_TIME_MS, sqlAccepted, arg);
495       return this;
496    }
497
498    public ActivityIteratorExpressionBuilder addAcceptedTimeBefore(long arg) {
499       addGreaterThan(SharkConstants.ACT_ACCEPTED_TIME_MS, sqlAccepted, arg);
500       return this;
501    }
502
503    public ActivityIteratorExpressionBuilder addAcceptedTimeAfter(long arg) {
504       addLessThan(SharkConstants.ACT_ACCEPTED_TIME_MS, sqlAccepted, arg);
505       return this;
506    }
507
508    public ActivityIteratorExpressionBuilder addVariableEquals(String JavaDoc vName,
509                                                               Object JavaDoc vValue) throws RootException {
510       if (vValue instanceof String JavaDoc) {
511          addVariableEquals(vName, (String JavaDoc) vValue);
512       } else if (vValue instanceof Long JavaDoc) {
513          addVariableEquals(vName, ((Long JavaDoc) vValue).longValue());
514       } else if (vValue instanceof Double JavaDoc) {
515          addVariableEquals(vName, ((Double JavaDoc) vValue).doubleValue());
516       } else if (vValue instanceof Boolean JavaDoc) {
517          addEqualsWithSubQuery(SharkConstants.ACT_CONTEXT_ + vName,
518                                objectid_column_name,
519                                "IN (SELECT Activity FROM ActivityData WHERE VariableValueBOOL = ",
520                                ((Boolean JavaDoc) vValue).booleanValue() ? 1L : 0L,
521                                ") ");
522       } else {
523          throw new RootException("Class "
524                                  + vValue.getClass().getName()
525                                  + " not supported");
526       }
527       return this;
528    }
529
530    public ActivityIteratorExpressionBuilder addVariableEquals(String JavaDoc vName, String JavaDoc vValue) {
531       addEqualsWithSubQuery(SharkConstants.ACT_CONTEXT_ + vName,
532                             objectid_column_name,
533                             "IN (SELECT Process FROM ActivityData"
534                             +(this.usingStandardVariableModel?"":"WOB")
535                             +" WHERE VariableValueVCHAR = ",
536                             vValue,
537                             ") ");
538       return this;
539    }
540
541    public ActivityIteratorExpressionBuilder addVariableEquals(String JavaDoc vName, long vValue) {
542       addEqualsWithSubQuery(SharkConstants.ACT_CONTEXT_ + vName,
543                             objectid_column_name,
544                             "IN (SELECT Process FROM ActivityData"
545                             +(this.usingStandardVariableModel?"":"WOB")
546                             +" WHERE VariableValueLONG = ",
547                             vValue,
548                             ") ");
549       return this;
550    }
551
552    public ActivityIteratorExpressionBuilder addVariableGreaterThan(String JavaDoc vName, long vValue) {
553       addGreaterThanWithSubQuery(SharkConstants.ACT_CONTEXT_ + vName,
554                                  objectid_column_name,
555                                  "IN (SELECT Process FROM ActivityData"
556                                  +(this.usingStandardVariableModel?"":"WOB")
557                                  +" WHERE VariableValueLONG ",
558                                  vValue,
559                                  ") ");
560       return this;
561    }
562
563    public ActivityIteratorExpressionBuilder addVariableLessThan(String JavaDoc vName, long vValue) {
564       addLessThanWithSubQuery(SharkConstants.ACT_CONTEXT_ + vName,
565                               objectid_column_name,
566                               "IN (SELECT Process FROM ActivityData"
567                               +(this.usingStandardVariableModel?"":"WOB")
568                               +" WHERE VariableValueLONG ",
569                               vValue,
570                               ") ");
571       return this;
572    }
573
574    public ActivityIteratorExpressionBuilder addVariableEquals(String JavaDoc vName, double vValue) {
575       addEqualsWithSubQuery(SharkConstants.ACT_CONTEXT_ + vName,
576                             objectid_column_name,
577                             "IN (SELECT Process FROM ActivityData"
578                             +(this.usingStandardVariableModel?"":"WOB")
579                             +" WHERE VariableValueDBL = ",
580                             vValue,
581                             ") ");
582       return this;
583    }
584
585    public ActivityIteratorExpressionBuilder addVariableGreaterThan(String JavaDoc vName, double vValue) {
586       addGreaterThanWithSubQuery(SharkConstants.ACT_CONTEXT_ + vName,
587                                  objectid_column_name,
588                                  "IN (SELECT Process FROM ActivityData"
589                                  +(this.usingStandardVariableModel?"":"WOB")
590                                  +" WHERE VariableValueDBL ",
591                                  vValue,
592                                  ") ");
593       return this;
594    }
595
596    public ActivityIteratorExpressionBuilder addVariableLessThan(String JavaDoc vName, double vValue) {
597       addLessThanWithSubQuery(SharkConstants.ACT_CONTEXT_ + vName,
598                               objectid_column_name,
599                               "IN (SELECT Process FROM ActivityData"
600                               +(this.usingStandardVariableModel?"":"WOB")
601                               +" WHERE VariableValueDBL ",
602                               vValue,
603                               ") ");
604       return this;
605    }
606
607    public ActivityIteratorExpressionBuilder addActivitySetDefId(String JavaDoc arg) {
608       addEquals(SharkConstants.ACT_ACTIVITY_SET_DEFINITION_ID,
609                 sqlActivitySetDefId,
610                 arg);
611       return this;
612    }
613
614    public ActivityIteratorExpressionBuilder addDefinitionId(String JavaDoc arg) {
615       addEquals(SharkConstants.ACT_DEFINITION_ID,
616                 sqlActivityDefId,
617                 arg);
618       return this;
619    }
620
621    public ActivityIteratorExpressionBuilder addIsAccepted() {
622       this.not();
623       char _notPrecedes = appendOperator(true);
624       this.bshExpression.add(_notPrecedes + SharkConstants.ACT_ACCEPTED);
625       this.sqlExpression.add(" TheResource "
626                              + " IS " + (' ' == _notPrecedes ? "" : "NOT") + " NULL ");
627       if (!this.propertiesUsed.contains(SharkConstants.ACT_ACCEPTED)) {
628          this.propertiesUsed.add(SharkConstants.ACT_ACCEPTED);
629       }
630       return this;
631    }
632
633    public ActivityIteratorExpressionBuilder addResourceUsername(String JavaDoc arg) {
634       addEqualsWithSubQuery(SharkConstants.ACT_RESOURCE_USERNAME,
635                             " TheResource ",
636                             "IN (SELECT "
637                             + objectid_column_name
638                             + " FROM ResourcesTable WHERE Username = ",
639                             arg,
640                             ") ");
641       return this;
642    }
643
644    public ActivityIteratorExpressionBuilder addExpression(String JavaDoc exp) {
645       sqlComplete = false;
646       appendOperator(false);
647       this.bshExpression.add(exp);
648       return this;
649    }
650
651    public ActivityIteratorExpressionBuilder addExpression(ActivityIteratorExpressionBuilder eb) {
652       appendOperator(eb.isComplete());
653       this.bshExpression.add(eb);
654       this.sqlExpression.add(eb);
655       for (Iterator JavaDoc it = ((BasicExpressionBuilder)eb).propertiesUsed.iterator(); it.hasNext();) {
656          Object JavaDoc element = it.next();
657          if (!this.propertiesUsed.contains(element)) {
658             this.propertiesUsed.add(element);
659          }
660       }
661       sqlComplete |= eb.isComplete();
662       return this;
663    }
664
665    public ActivityIteratorExpressionBuilder setOrderById(boolean ascending) {
666       super.setOrderBy(sqlId, ascending);
667       return this;
668    }
669
670    public ActivityIteratorExpressionBuilder setOrderByActivitySetDefId(boolean ascending) {
671       super.setOrderBy(sqlActivitySetDefId, ascending);
672       return this;
673    }
674
675    public ActivityIteratorExpressionBuilder setOrderByDefinitionId(boolean ascending) {
676       super.setOrderBy(sqlActivityDefId, ascending);
677       return this;
678 }
679
680    public ActivityIteratorExpressionBuilder setOrderByProcessId(boolean ascending) {
681       super.setOrderBy(" ProcessId ", ascending);
682       return this;
683    }
684
685    public ActivityIteratorExpressionBuilder setOrderByResourceUsername(boolean ascending) {
686       super.setOrderBy(" ResourceId ", ascending);
687       return this;
688    }
689
690    public ActivityIteratorExpressionBuilder setOrderByProcessDefName(boolean ascending) {
691       super.setOrderBy(" PDefName ", ascending);
692       return this;
693    }
694
695    public ActivityIteratorExpressionBuilder setOrderByState(boolean ascending) {
696       super.setOrderBy(sqlState, ascending);
697       return this;
698    }
699
700    public ActivityIteratorExpressionBuilder setOrderByPerformer(boolean ascending) {
701       super.setOrderBy(" Performer ", ascending);
702       return this;
703    }
704
705    public ActivityIteratorExpressionBuilder setOrderByPriority(boolean ascending) {
706       super.setOrderBy(sqlPriority, ascending);
707       return this;
708    }
709
710    public ActivityIteratorExpressionBuilder setOrderByName(boolean ascending) {
711       super.setOrderBy(sqlName, ascending);
712       return this;
713    }
714
715    public ActivityIteratorExpressionBuilder setOrderByActivatedTime(boolean ascending) {
716       super.setOrderBy(sqlActivated, ascending);
717       return this;
718    }
719
720    public ActivityIteratorExpressionBuilder setOrderByAcceptedTime(boolean ascending) {
721       super.setOrderBy(sqlAccepted, ascending);
722       return this;
723    }
724
725    public ActivityIteratorExpressionBuilder setOrderByLastStateTime(boolean ascending) {
726       super.setOrderBy(sqlLastStateTime, ascending);
727       return this;
728    }
729 }
730
Popular Tags