KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ofbiz > shark > expression > ProcessMgrIteratorCondExprBldr


1 /*
2  * $Id: ProcessMgrIteratorCondExprBldr.java 5462 2005-08-05 18:35:48Z jonesde $
3  *
4  * Copyright (c) 2001-2005 The Open For Business Project - www.ofbiz.org
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the "Software"),
8  * to deal in the Software without restriction, including without limitation
9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  * and/or sell copies of the Software, and to permit persons to whom the
11  * Software is furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included
14  * in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
21  * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
22  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  *
24  */

25 package org.ofbiz.shark.expression;
26
27 import org.enhydra.shark.api.common.ProcessMgrIteratorExpressionBuilder;
28 import org.ofbiz.entity.condition.EntityExpr;
29 import org.ofbiz.entity.condition.EntityOperator;
30
31 /**
32  *
33  * @author <a HREF="mailto:jaz@ofbiz.org">Andy Zeneski</a>
34  * @version $Rev: 5462 $
35  * @since 3.3
36  */

37 public class ProcessMgrIteratorCondExprBldr extends BaseEntityCondExprBldr implements ProcessMgrIteratorExpressionBuilder {
38
39     public ProcessMgrIteratorCondExprBldr() {
40         this.addEntity("WFPM", "WfProcessMgr");
41         this.addAllFields("WFPM");
42     }
43
44     public ProcessMgrIteratorExpressionBuilder and() {
45         this.setOr(false);
46         return this;
47     }
48
49     public ProcessMgrIteratorExpressionBuilder or() {
50         this.setOr(true);
51         return this;
52     }
53
54     public ProcessMgrIteratorExpressionBuilder not() {
55         this.setNot(true);
56         return this;
57     }
58
59     public ProcessMgrIteratorExpressionBuilder addPackageIdEquals(String JavaDoc s) {
60         this.addCondition(new EntityExpr("packageId", isNotSet ? EntityOperator.NOT_EQUAL : EntityOperator.EQUALS, s));
61         return this;
62     }
63
64     public ProcessMgrIteratorExpressionBuilder addProcessDefIdEquals(String JavaDoc s) {
65         this.addCondition(new EntityExpr("definitionId", isNotSet ? EntityOperator.NOT_EQUAL : EntityOperator.EQUALS, s));
66         return this;
67     }
68
69     public ProcessMgrIteratorExpressionBuilder addNameEquals(String JavaDoc s) {
70         this.addCondition(new EntityExpr("mgrName", isNotSet ? EntityOperator.NOT_EQUAL : EntityOperator.EQUALS, s));
71         return this;
72     }
73
74     public ProcessMgrIteratorExpressionBuilder addVersionEquals(String JavaDoc s) {
75         this.addCondition(new EntityExpr("packageVer", isNotSet ? EntityOperator.NOT_EQUAL : EntityOperator.EQUALS, s));
76         return this;
77     }
78
79     public ProcessMgrIteratorExpressionBuilder addIsEnabled() {
80         this.addCondition(new EntityExpr("currentState", isNotSet ? EntityOperator.NOT_EQUAL : EntityOperator.EQUALS, new Long JavaDoc(0)));
81         return this;
82     }
83
84     public ProcessMgrIteratorExpressionBuilder addExpression(String JavaDoc s) {
85         ProcessMgrIteratorExpressionBuilder builder = (ProcessMgrIteratorExpressionBuilder) BaseEntityCondExprBldr.getBuilder(s);
86         if (builder != null) {
87             return this.addExpression(builder);
88         } else {
89             return this;
90         }
91     }
92
93     public ProcessMgrIteratorExpressionBuilder addExpression(ProcessMgrIteratorExpressionBuilder builder) {
94         if (!(builder instanceof BaseEntityCondExprBldr)) {
95             throw new UnsupportedOperationException JavaDoc("Unsupported implementation");
96         } else {
97             this.addCondition(((BaseEntityCondExprBldr) builder).getCondition());
98         }
99         return this;
100     }
101 }
102
Popular Tags