KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ofbiz > shark > instance > AndJoinEntry


1 /*
2  * $Id: AndJoinEntry.java 5462 2005-08-05 18:35:48Z jonesde $
3  *
4  * Copyright (c) 2004 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.instance;
26
27 import org.ofbiz.entity.GenericDelegator;
28 import org.ofbiz.entity.GenericValue;
29 import org.ofbiz.entity.GenericEntityException;
30 import org.ofbiz.base.util.UtilMisc;
31 import org.ofbiz.base.util.Debug;
32 import org.ofbiz.shark.container.SharkContainer;
33
34 import org.enhydra.shark.api.internal.instancepersistence.*;
35
36 /**
37  * Persistance Object
38  *
39  * @author <a HREF="mailto:jaz@ofbiz.org">Andy Zeneski</a>
40  * @version $Rev: 5462 $
41  * @since 3.1
42  */

43 public class AndJoinEntry extends InstanceEntityObject implements AndJoinEntryInterface {
44
45     public static final String JavaDoc module = AndJoinEntry.class.getName();
46
47     protected GenericValue andJoin = null;
48     protected boolean newValue = false;
49
50     protected AndJoinEntry(EntityPersistentMgr mgr, GenericDelegator delegator, String JavaDoc andJoinId) {
51         super(mgr, delegator);
52         if (this.delegator != null) {
53             try {
54                 this.andJoin = delegator.findByPrimaryKey("WfAndJoin", UtilMisc.toMap("andJoinId", andJoinId));
55             } catch (GenericEntityException e) {
56                 Debug.logError(e, module);
57             }
58         } else {
59             Debug.logError("Invalid delegator object passed", module);
60         }
61     }
62
63     protected AndJoinEntry(EntityPersistentMgr mgr, GenericValue andJoin) {
64         super(mgr, andJoin.getDelegator());
65         this.andJoin = andJoin;
66     }
67
68     public AndJoinEntry(EntityPersistentMgr mgr, GenericDelegator delegator) {
69         super(mgr, delegator);
70         this.newValue = true;
71         this.andJoin = delegator.makeValue("WfAndJoin", UtilMisc.toMap("andJoinId", delegator.getNextSeqId("WfAndJoin")));
72     }
73
74     public static AndJoinEntry getInstance(EntityPersistentMgr mgr, GenericValue andJoin) {
75         AndJoinEntry var = new AndJoinEntry(mgr, andJoin);
76         if (var.isLoaded()) {
77             return var;
78         }
79         return null;
80     }
81
82     public static AndJoinEntry getInstance(EntityPersistentMgr mgr, String JavaDoc andJoinId) {
83         AndJoinEntry var = new AndJoinEntry(mgr, SharkContainer.getDelegator(), andJoinId);
84         if (var.isLoaded()) {
85             return var;
86         }
87         return null;
88     }
89
90     public boolean isLoaded() {
91         if (andJoin == null) {
92             return false;
93         }
94         return true;
95     }
96
97     public void setProcessId(String JavaDoc procId) {
98         andJoin.set("processId", procId);
99     }
100
101     public String JavaDoc getProcessId() {
102         return andJoin.getString("processId");
103     }
104
105     public void setActivitySetDefinitionId(String JavaDoc asdId) {
106         andJoin.set("activitySetDefId", asdId);
107     }
108
109     public String JavaDoc getActivitySetDefinitionId() {
110         return andJoin.getString("activitySetDefId");
111     }
112
113     public void setActivityDefinitionId(String JavaDoc adId) {
114         andJoin.set("activityDefId", adId);
115     }
116
117     public String JavaDoc getActivityDefinitionId() {
118         return andJoin.getString("activityDefId");
119     }
120
121     public void setActivityId(String JavaDoc actId) {
122         andJoin.set("activityId", actId);
123     }
124
125     public String JavaDoc getActivityId() {
126         return andJoin.getString("activityId");
127     }
128
129     public void store() throws GenericEntityException {
130         if (newValue) {
131             newValue = false;
132             delegator.createOrStore(andJoin);
133         } else {
134             delegator.store(andJoin);
135         }
136     }
137
138     public void reload() throws GenericEntityException {
139         if (!newValue) {
140             andJoin.refresh();
141         }
142     }
143
144     public void remove() throws GenericEntityException {
145         if (!newValue) {
146             delegator.removeValue(andJoin);
147         }
148     }
149 }
150
Popular Tags