KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ofbiz > shark > audit > EventAudit


1 /*
2  * $Id: EventAudit.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.audit;
26
27 import org.ofbiz.base.util.Debug;
28 import org.ofbiz.base.util.UtilMisc;
29 import org.ofbiz.entity.GenericDelegator;
30 import org.ofbiz.entity.GenericEntityException;
31 import org.ofbiz.entity.GenericValue;
32
33 import org.enhydra.shark.api.internal.eventaudit.EventAuditPersistenceInterface;
34
35 /**
36  * Persistance Object
37  *
38  * @author <a HREF="mailto:jaz@ofbiz.org">Andy Zeneski</a>
39  * @version $Rev: 5462 $
40  * @since 3.1
41  */

42 public class EventAudit extends AuditEntityObject implements EventAuditPersistenceInterface {
43
44     public static final String JavaDoc module = EventAudit.class.getName();
45
46     protected String JavaDoc eventAuditId = null;
47     private GenericValue eventAudit = null;
48     private boolean newValue = false;
49
50     public EventAudit(EntityAuditMgr mgr, GenericDelegator delegator, String JavaDoc eventAuditId) {
51         super(mgr, delegator);
52         this.eventAuditId = eventAuditId;
53         if (this.delegator != null) {
54             try {
55                 this.eventAudit = delegator.findByPrimaryKey("WfEventAudit", UtilMisc.toMap("eventAuditId", eventAuditId));
56             } catch (GenericEntityException e) {
57                 Debug.logError(e, module);
58             }
59         } else {
60             Debug.logError("Invalid delegator object passed", module);
61         }
62     }
63
64     public EventAudit(EntityAuditMgr mgr, GenericDelegator delegator) {
65         super(mgr, delegator);
66         this.newValue = true;
67         this.eventAuditId = delegator.getNextSeqId("WfEventAudit");
68         this.eventAudit = delegator.makeValue("WfEventAudit", UtilMisc.toMap("eventAuditId", eventAuditId));
69     }
70
71     public EventAudit(EntityAuditMgr mgr, GenericValue eventAudit) {
72         super(mgr, eventAudit.getDelegator());
73         this.eventAuditId = eventAudit.getString("eventAuditId");
74         this.eventAudit = eventAudit;
75     }
76
77     public String JavaDoc getEventAuditId() {
78         return eventAudit.getString("eventAuditId");
79     }
80
81     public void setUTCTime(String JavaDoc ts) {
82         eventAudit.set("auditTime", ts);
83     }
84
85     public String JavaDoc getUTCTime() {
86         return eventAudit.getString("auditTime");
87     }
88
89     public void setType(String JavaDoc t) {
90         eventAudit.set("auditType", t);
91     }
92
93     public String JavaDoc getType() {
94         return eventAudit.getString("auditType");
95     }
96
97     public void setActivityId(String JavaDoc aId) {
98         eventAudit.set("activityId", aId);
99     }
100
101     public String JavaDoc getActivityId() {
102         return eventAudit.getString("activityId");
103     }
104
105     public void setActivityName(String JavaDoc an) {
106         eventAudit.set("activityName", an);
107     }
108
109     public String JavaDoc getActivityName() {
110         return eventAudit.getString("activityName");
111     }
112
113     public void setProcessId(String JavaDoc pId) {
114         eventAudit.set("processId", pId);
115     }
116
117     public String JavaDoc getProcessId() {
118         return eventAudit.getString("processId");
119     }
120
121     public void setProcessName(String JavaDoc pn) {
122         eventAudit.set("processName", pn);
123     }
124
125     public String JavaDoc getProcessName() {
126         return eventAudit.getString("processName");
127     }
128
129     public void setProcessDefinitionName(String JavaDoc pdn) {
130         eventAudit.set("processDefName", pdn);
131     }
132
133     public String JavaDoc getProcessDefinitionName() {
134         return eventAudit.getString("processDefName");
135     }
136
137     public void setProcessDefinitionVersion(String JavaDoc pdv) {
138         eventAudit.set("processDefVer", pdv);
139     }
140
141     public String JavaDoc getProcessDefinitionVersion() {
142         return eventAudit.getString("processDefVer");
143     }
144
145     public void setActivityDefinitionId(String JavaDoc adId) {
146         eventAudit.set("activityDefId", adId);
147     }
148
149     public String JavaDoc getActivityDefinitionId() {
150         return eventAudit.getString("activityDefId");
151     }
152
153     public void setActivitySetDefinitionId(String JavaDoc s) {
154         // TODO: Implement Me!
155
}
156
157     public String JavaDoc getActivitySetDefinitionId() {
158         return null; // TODO: Implement Me!
159
}
160
161     public void setProcessDefinitionId(String JavaDoc pdId) {
162         eventAudit.set("processDefId", pdId);
163     }
164
165     public String JavaDoc getProcessDefinitionId() {
166         return eventAudit.getString("processDefId");
167     }
168
169     public void setPackageId(String JavaDoc pkgId) {
170         eventAudit.set("packageId", pkgId);
171     }
172
173     public String JavaDoc getPackageId() {
174         return eventAudit.getString("packageId");
175     }
176
177     public void store() throws GenericEntityException {
178         if (newValue) {
179             newValue = false;
180             delegator.createOrStore(eventAudit);
181         } else {
182             delegator.store(eventAudit);
183         }
184     }
185
186     public void reload() throws GenericEntityException {
187         if (!newValue) {
188             eventAudit.refresh();
189         }
190     }
191
192     public void remove() throws GenericEntityException {
193         if (!newValue) {
194             delegator.removeValue(eventAudit);
195         }
196     }
197 }
198
Popular Tags