001: package org.enhydra.shark;
002:
003: import org.enhydra.shark.api.client.timebase.UtcT;
004: import org.enhydra.shark.api.client.wfmc.wapi.WMSessionHandle;
005: import org.enhydra.shark.api.client.wfmodel.SourceNotAvailable;
006: import org.enhydra.shark.api.client.wfmodel.WfExecutionObject;
007: import org.enhydra.shark.api.client.wfservice.WfPackageEventAudit;
008: import org.enhydra.shark.persistence.PackageEventAuditPersistenceInterface;
009: import org.enhydra.shark.utilities.MiscUtilities;
010:
011: /**
012: * WfPackageEventAuditImpl - Workflow Event Audit implementation
013: */
014: public class WfPackageEventAuditImpl extends WfEventAuditWrapper
015: implements WfPackageEventAudit,
016: PackageEventAuditPersistenceInterface {
017:
018: protected String packageVersion;
019:
020: protected WfPackageEventAuditImpl(WMSessionHandle shandle,
021: org.enhydra.shark.xpdl.elements.Package pkg,
022: String eventType) throws Exception {
023: this .timeStamp = new UtcT(MiscUtilities
024: .getAbsoluteTimeInUTCFormat(), 0, (short) 0, (short) 0);
025: this .username = SharkEngineManager.getInstance()
026: .getCallbackUtilities().getUserId(shandle);
027: this .eventType = eventType;
028: this .packageId = pkg.getId();
029: this .packageVersion = pkg.getInternalVersion();
030:
031: persist(shandle);
032: }
033:
034: public String package_version() {
035: return packageVersion;
036: }
037:
038: public String resource_username() {
039: return username;
040: }
041:
042: public WfExecutionObject source() throws Exception,
043: SourceNotAvailable {
044: throw new SourceNotAvailable(
045: "The source of WfPackageEventAudit is not available!");
046: }
047:
048: // Interface used for Persistence
049:
050: /**
051: * Used to create object when restoring it from database.
052: */
053: public WfPackageEventAuditImpl() {
054: //
055: }
056:
057: public void setPackageVersion(String pkgVersion) {
058: packageVersion = pkgVersion;
059: }
060:
061: public String getPackageVersion() {
062: return packageVersion;
063: }
064:
065: public void setUsername(String resUsername) {
066: username = resUsername;
067: }
068:
069: public String getUsername() {
070: return username;
071: }
072:
073: public void setRecordedTime(long time) {
074: timeStamp = new UtcT(time, 0, (short) 0, (short) 0);
075: }
076:
077: public long getRecordedTime() {
078: return timeStamp.time;
079: }
080:
081: public void setType(String type) {
082: this .eventType = type;
083: }
084:
085: public String getType() {
086: return eventType;
087: }
088:
089: public void setActivityId(String aId) {
090: }
091:
092: public String getActivityId() {
093: return null;
094: }
095:
096: public void setActivityName(String an) {
097: }
098:
099: public String getActivityName() {
100: return null;
101: }
102:
103: public void setProcessId(String pId) {
104: }
105:
106: public String getProcessId() {
107: return null;
108: }
109:
110: public void setProcessName(String n) {
111: }
112:
113: public String getProcessName() {
114: return null;
115: }
116:
117: public void setProcessFactoryName(String pn) {
118: }
119:
120: public String getProcessFactoryName() {
121: return null;
122: }
123:
124: public void setProcessFactoryVersion(String pdv) {
125: }
126:
127: public String getProcessFactoryVersion() {
128: return null;
129: }
130:
131: public void setActivityDefinitionId(String adId) {
132: }
133:
134: public String getActivityDefinitionId() {
135: return null;
136: }
137:
138: public void setActivityDefinitionName(String adName) {
139: }
140:
141: public String getActivityDefinitionName() {
142: return null;
143: }
144:
145: public void setActivityDefinitionType(int adType) {
146: }
147:
148: public int getActivityDefinitionType() {
149: return -1;
150: }
151:
152: public void setProcessDefinitionId(String pdId) {
153: }
154:
155: public String getProcessDefinitionId() {
156: return null;
157: }
158:
159: public void setProcessDefinitionName(String pdName) {
160: }
161:
162: public String getProcessDefinitionName() {
163: return null;
164: }
165:
166: public void setPackageId(String pkgId) {
167: packageId = pkgId;
168: }
169:
170: public String getPackageId() {
171: return packageId;
172: }
173:
174: public void persist(WMSessionHandle sh) throws Exception {
175: String log = "UTCTime=" + getRecordedTime() + ",EventType="
176: + getType() + ",PackageId=" + getPackageId()
177: + ",PackageVersion=" + getPackageVersion()
178: + ",EventPerformedBy=" + getUsername();
179: SharkEngineManager.getInstance().getCallbackUtilities().info(
180: shandle, "PackageEventLogger", log);
181: }
182:
183: public void refresh() {
184: }
185:
186: public void delete(WMSessionHandle sh) throws Exception {
187: }
188:
189: }
|