KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > shark > WfPackageEventAuditImpl


1 package org.enhydra.shark;
2
3 import org.enhydra.shark.api.SharkTransaction;
4 import org.enhydra.shark.api.TransactionException;
5 import org.enhydra.shark.api.client.timebase.UtcT;
6 import org.enhydra.shark.api.client.wfbase.BaseException;
7 import org.enhydra.shark.api.client.wfmodel.SourceNotAvailable;
8 import org.enhydra.shark.api.client.wfmodel.WfExecutionObject;
9 import org.enhydra.shark.api.client.wfservice.WfPackageEventAudit;
10 import org.enhydra.shark.persistence.PackageEventAuditPersistenceInterface;
11 import org.enhydra.shark.utilities.MiscUtilities;
12
13
14 /**
15  * WfPackageEventAuditImpl - Workflow Event Audit implementation
16  */

17 public class WfPackageEventAuditImpl extends WfEventAuditWrapper
18    implements WfPackageEventAudit, PackageEventAuditPersistenceInterface {
19
20    private String JavaDoc packageVersion;
21    private String JavaDoc resourceUsername;
22
23    protected WfPackageEventAuditImpl(org.enhydra.shark.xpdl.elements.Package pkg,
24                                      String JavaDoc eventType,String JavaDoc resourceUsername) throws BaseException{
25       this.timeStamp = new UtcT(
26          MiscUtilities.getAbsoluteTimeInUTCFormat(),0,(short)0,(short)0);
27       this.eventType=eventType;
28       this.packageId=pkg.getId();
29       this.packageVersion=pkg.getInternalVersion();
30       this.resourceUsername=resourceUsername;
31       try {
32          persist(null);
33       } catch (Exception JavaDoc ex) {
34          throw new BaseException(ex);
35       }
36    }
37
38    public String JavaDoc package_version () {
39       return packageVersion;
40    }
41
42    public String JavaDoc resource_username () {
43       return resourceUsername;
44    }
45
46    public WfExecutionObject source () throws BaseException, SourceNotAvailable {
47       throw new SourceNotAvailable("The source of WfPackageEventAudit is not available!");
48    }
49
50    // Interface used for Persistence
51

52    /**
53     * Used to create object when restoring it from database.
54     */

55    public WfPackageEventAuditImpl () {
56       //
57
}
58
59    public void setPackageVersion (String JavaDoc pkgVersion) {
60       packageVersion=pkgVersion;
61    }
62
63    public String JavaDoc getPackageVersion () {
64       return packageVersion;
65    }
66
67    public void setResourceUsername (String JavaDoc resUsername) {
68       resourceUsername=resUsername;
69    }
70
71    public String JavaDoc getResourceUsername () {
72       return resourceUsername;
73    }
74
75    public void setUTCTime (String JavaDoc time) {
76       try {
77          timeStamp = new UtcT(Long.parseLong(time),0,(short)0,(short)0);
78       } catch (Exception JavaDoc ex) {}
79    }
80
81    public String JavaDoc getUTCTime () {
82       return String.valueOf(timeStamp.time);
83    }
84
85    public void setType (String JavaDoc type) {
86       this.eventType=type;
87    }
88
89    public String JavaDoc getType () {
90       return eventType;
91    }
92
93    public void setActivityId (String JavaDoc aId) {}
94
95    public String JavaDoc getActivityId () {
96       return null;
97    }
98
99    public void setActivityName (String JavaDoc an) {}
100
101    public String JavaDoc getActivityName () {
102       return null;
103    }
104
105    public void setProcessId (String JavaDoc pId) {}
106
107    public String JavaDoc getProcessId () {
108       return null;
109    }
110
111    public void setProcessName (String JavaDoc n) {}
112
113    public String JavaDoc getProcessName () {
114       return null;
115    }
116
117    public void setProcessDefinitionName (String JavaDoc pn) {}
118
119    public String JavaDoc getProcessDefinitionName () {
120       return null;
121    }
122
123    public void setProcessDefinitionVersion (String JavaDoc pdv) {}
124
125    public String JavaDoc getProcessDefinitionVersion () {
126       return null;
127    }
128
129    public void setActivityDefinitionId (String JavaDoc adId) {}
130
131    public String JavaDoc getActivityDefinitionId () {
132       return null;
133    }
134
135    public void setActivitySetDefinitionId (String JavaDoc asdId) {}
136
137    public String JavaDoc getActivitySetDefinitionId () {
138       return null;
139    }
140
141    public void setProcessDefinitionId (String JavaDoc pdId) {}
142
143    public String JavaDoc getProcessDefinitionId () {
144       return null;
145    }
146
147    public void setPackageId (String JavaDoc pkgId) {
148       packageId=pkgId;
149    }
150
151    public String JavaDoc getPackageId () {
152       return packageId;
153    }
154
155    public void persist (SharkTransaction t) throws TransactionException {
156       String JavaDoc log="UTCTime="+getUTCTime()+",EventType="+getType()+
157          ",PackageId="+getPackageId()+",PackageVersion="+getPackageVersion()+
158          ",EventPerformedBy="+getResourceUsername();
159       SharkEngineManager.getInstance().getCallbackUtilities().info("PackageEventLogger",log);
160    }
161
162    public void refresh () {
163    }
164
165    public void delete (SharkTransaction t) throws TransactionException {
166    }
167
168 }
169
Popular Tags