KickJava   Java API By Example, From Geeks To Geeks.

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


1 package org.enhydra.shark;
2
3
4 import org.enhydra.shark.api.SharkTransaction;
5 import org.enhydra.shark.api.TransactionException;
6 import org.enhydra.shark.api.client.wfbase.BaseException;
7 import org.enhydra.shark.api.common.SharkConstants;
8 import org.enhydra.shark.api.internal.eventaudit.CreateProcessEventAuditPersistenceInterface;
9 import org.enhydra.shark.api.internal.eventaudit.EventAuditException;
10 import org.enhydra.shark.api.internal.eventaudit.EventAuditManagerInterface;
11 import org.enhydra.shark.api.internal.eventaudit.EventAuditPersistenceInterface;
12 import org.enhydra.shark.api.internal.working.WfActivityInternal;
13 import org.enhydra.shark.api.internal.working.WfCreateProcessEventAuditInternal;
14 import org.enhydra.shark.api.internal.working.WfProcessInternal;
15 import org.enhydra.shark.api.internal.working.WfRequesterInternal;
16
17 /**
18  * WfCreateProcessEventAuditImpl - Workflow Event Audit implementation
19  *
20  * @author Sasa Bojanic
21  */

22 public class WfCreateProcessEventAuditWrapper extends WfEventAuditWrapper
23    implements WfCreateProcessEventAuditInternal {
24
25    private String JavaDoc pActivityId;
26    private String JavaDoc pProcessId;
27    private String JavaDoc pProcessName;
28    private String JavaDoc pProcessMgrName;
29    private String JavaDoc pProcessMgrVersion;
30    private String JavaDoc pActivityDefinitionId;
31    private String JavaDoc pActivitySetDefinitionId;
32    private String JavaDoc pProcessDefinitionId;
33    private String JavaDoc pPackageId;
34
35    protected WfCreateProcessEventAuditWrapper(SharkTransaction t,WfProcessInternal process,WfRequesterInternal requester)
36    throws BaseException {
37       super(t,process,SharkConstants.EVENT_PROCESS_CREATED);
38
39       try {
40          if ((requester!=null) && (requester instanceof WfActivityInternal)) {
41             WfActivityInternal req=(WfActivityInternal)requester;
42             pActivityId=req.key(t);
43             pProcessId=req.container(t).key(t);
44             pProcessName=req.container(t).name(t);
45             pProcessMgrName=req.container(t).manager_name(t);
46             pProcessMgrVersion=req.container(t).manager_version(t);
47             pActivityDefinitionId=req.activity_definition_id(t);
48             pActivitySetDefinitionId=req.activity_set_definition_id(t);
49             pProcessDefinitionId=req.container(t).process_definition_id(t);
50             pPackageId=req.container(t).package_id(t);
51          }
52          persist(t);
53       } catch (Exception JavaDoc pe) {
54          throw new BaseException(pe);
55       }
56    }
57
58    /**
59     * Used to create object when restoring it from database.
60     */

61    protected WfCreateProcessEventAuditWrapper (String JavaDoc userAuth,CreateProcessEventAuditPersistenceInterface po) {
62       super(userAuth,po);
63    }
64
65    public String JavaDoc p_activity_key () throws BaseException {
66       return pActivityId;
67    }
68
69    public String JavaDoc p_process_key () throws BaseException {
70       return pProcessId;
71    }
72
73    public String JavaDoc p_process_name () throws BaseException {
74       return pProcessName;
75    }
76
77    public String JavaDoc p_process_mgr_name () throws BaseException {
78       return pProcessMgrName;
79    }
80
81    public String JavaDoc p_process_mgr_version () throws BaseException {
82       return pProcessMgrVersion;
83    }
84
85    public String JavaDoc p_activity_definition_id () throws BaseException {
86       return pActivityDefinitionId;
87    }
88
89    public String JavaDoc p_activity_set_definition_id () throws BaseException {
90       return pActivitySetDefinitionId;
91    }
92    public String JavaDoc p_process_definition_id () throws BaseException {
93       return pProcessMgrVersion;
94    }
95
96    public String JavaDoc p_package_id () throws BaseException {
97       return pProcessMgrVersion;
98    }
99
100    public void persist (SharkTransaction t) throws TransactionException {
101       try {
102          EventAuditManagerInterface eam=SharkEngineManager.getInstance().getEventAuditManager();
103          if (null == eam)
104             return;
105          CreateProcessEventAuditPersistenceInterface po=
106             eam.createCreateProcessEventAudit();
107          fillPersistentObject(po);
108          eam.persist(po,t);
109       } catch (EventAuditException pe) {
110          throw new TransactionException(pe);
111       }
112    }
113
114    public void refresh () {
115       //
116
}
117
118    public void delete (SharkTransaction t) throws TransactionException {
119       //
120
}
121
122    protected void fillPersistentObject (EventAuditPersistenceInterface po) {
123       super.fillPersistentObject(po);
124       CreateProcessEventAuditPersistenceInterface cpo=(CreateProcessEventAuditPersistenceInterface)po;
125       cpo.setPActivityId(this.pActivityId);
126       cpo.setPProcessId(this.pProcessId);
127       cpo.setPProcessName(this.pProcessName);
128       cpo.setPProcessDefinitionName(this.pProcessMgrName);
129       cpo.setPProcessDefinitionVersion(this.pProcessMgrVersion);
130       cpo.setPActivityDefinitionId(this.pActivityDefinitionId);
131       cpo.setPActivitySetDefinitionId(this.pActivitySetDefinitionId);
132       cpo.setPProcessDefinitionId(this.pProcessDefinitionId);
133       cpo.setPPackageId(this.pPackageId);
134    }
135
136    protected void restore (EventAuditPersistenceInterface po) {
137       super.restore(po);
138       CreateProcessEventAuditPersistenceInterface cpo=(CreateProcessEventAuditPersistenceInterface)po;
139       this.pActivityId=cpo.getPActivityId();
140       this.pProcessId=cpo.getPProcessId();
141       this.pProcessName=cpo.getPProcessName();
142       this.pProcessMgrName=cpo.getPProcessDefinitionName();
143       this.pProcessMgrVersion=cpo.getPProcessDefinitionVersion();
144       this.pActivityDefinitionId=cpo.getPActivityDefinitionId();
145       this.pActivitySetDefinitionId=cpo.getPActivitySetDefinitionId();
146       this.pProcessDefinitionId=cpo.getPProcessDefinitionId();
147       this.pPackageId=cpo.getPPackageId();
148    }
149
150 }
151
Popular Tags