KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > shark > eventaudit > HibernateDataEventAudit


1 /*
2  * Shark Hibernate persistent layer - Open Wide
3  */

4
5
6 package org.enhydra.shark.eventaudit;
7
8 import java.util.HashMap JavaDoc;
9 import java.util.Iterator JavaDoc;
10 import java.util.Map JavaDoc;
11
12 import org.enhydra.shark.api.internal.eventaudit.*;
13
14 /**
15  * Simple Hibernate POJO class
16  * @author Vladislav Pernin
17  */

18 public class HibernateDataEventAudit extends HibernateEventAudit implements DataEventAuditPersistenceInterface {
19
20     private Map JavaDoc oldData;
21     private Map JavaDoc newData;
22     
23     public HibernateDataEventAudit(){
24         oldData = new HashMap JavaDoc();
25         newData = new HashMap JavaDoc();
26     }
27
28     public void setOldData(Map JavaDoc od) {
29         this.oldData = od;
30     }
31
32     public Map JavaDoc getOldData() {
33         return oldData;
34     }
35
36     public void setNewData(Map JavaDoc nd) {
37         this.newData = nd;
38     }
39
40     public Map JavaDoc getNewData() {
41         return newData;
42     }
43
44     public String JavaDoc toString() {
45         StringBuffer JavaDoc strBuffer = new StringBuffer JavaDoc();
46         strBuffer.append("IdDB = " + this.dbId + "\n");
47         strBuffer.append("timeStamp = " + this.getUTCTime() + "\n");
48         strBuffer.append("eventType = " + this.getType() + "\n");
49         strBuffer.append("activityId = " + this.getActivityId() + "\n");
50         strBuffer.append("activityName = " + this.getActivityName() + "\n");
51         strBuffer.append("processId = " + this.getProcessId() + "\n");
52         strBuffer.append("processName = " + this.getProcessName() + "\n");
53         strBuffer.append("processMgrName = " + this.getProcessDefinitionName() + "\n");
54         strBuffer.append("processMgrVersion = " + this.getProcessDefinitionVersion() + "\n");
55         strBuffer.append("activityDefinitionId = " + this.getActivityDefinitionId() + "\n");
56         strBuffer.append("processDefinitionId = " + this.getProcessDefinitionId() + "\n");
57         strBuffer.append("packageId = " + this.getPackageId() + "\n");
58         if (oldData != null){
59             strBuffer.append("olddata = \n");
60             Iterator JavaDoc it = this.oldData.entrySet().iterator();
61             while (it.hasNext()) {
62                 Map.Entry JavaDoc me = (Map.Entry JavaDoc) it.next();
63                 String JavaDoc vdId = (String JavaDoc) me.getKey();
64                 Object JavaDoc val = me.getValue();
65                 strBuffer.append("\t Entry : " + vdId + "->" + val + "\n");
66             }
67         } else {
68             strBuffer.append("\nolddata = empty\n");
69         }
70         if (newData != null){
71             strBuffer.append("newdata = \n");
72             Iterator JavaDoc it2 = this.newData.entrySet().iterator();
73             while (it2.hasNext()) {
74                 Map.Entry JavaDoc me = (Map.Entry JavaDoc) it2.next();
75                 String JavaDoc vdId = (String JavaDoc) me.getKey();
76                 Object JavaDoc val = me.getValue();
77                 strBuffer.append("\t Entry : " + vdId + "->" + val + "\n");
78             }
79         } else {
80             strBuffer.append("newdata = empty\n");
81         }
82         
83
84         return strBuffer.toString();
85     }
86
87 }
Popular Tags