View Javadoc

1   /*
2    * SymmetricDS is an open source database synchronization solution.
3    *   
4    * Copyright (C) Chris Henson <chenson42@users.sourceforge.net>
5    *
6    * This library is free software; you can redistribute it and/or
7    * modify it under the terms of the GNU Lesser General Public
8    * License as published by the Free Software Foundation; either
9    * version 3 of the License, or (at your option) any later version.
10   *
11   * This library is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14   * Lesser General Public License for more details.
15   *
16   * You should have received a copy of the GNU Lesser General Public
17   * License along with this library; if not, see
18   * <http://www.gnu.org/licenses/>.
19   */
20  
21  package org.jumpmind.symmetric.model;
22  
23  import java.util.Date;
24  
25  /***
26   * This is the data that changed due to a data sync trigger firing.
27   * 
28   * @author chenson
29   */
30  public class Data {
31  
32      // PK
33      private long dataId;
34  
35      /***
36       * Comma deliminated primary key data.
37       */
38      private String pkData;
39  
40      /***
41       * Comma deliminated row data.
42       */
43      private String rowData;
44      
45      /***
46       * To support column-level sync and conflict resolution.
47       * Comma delimited old row data from an update.
48       */
49  
50      private String oldData;
51  
52      /***
53       * This is a reference to the audit row the trigger refered to when the data
54       * event fired.
55       */
56      private TriggerHistory audit;
57  
58      private DataEventType eventType;
59  
60      private String tableName;
61  
62      /***
63       * This is populated by the trigger when the event happens. It will be
64       * useful for research.
65       */
66      private Date createTime;
67  
68      public Data(long dataId, String pkData, String rowData, DataEventType eventType, String tableName, Date createTime,
69              TriggerHistory audit) {
70          super();
71          this.dataId = dataId;
72          this.pkData = pkData;
73          this.rowData = rowData;
74          this.eventType = eventType;
75          this.tableName = tableName;
76          this.createTime = createTime;
77          this.audit = audit;
78      }
79  
80      public Data(String tableName, DataEventType eventType, String rowData, String pkData, TriggerHistory audit) {
81          this.tableName = tableName;
82          this.eventType = eventType;
83          this.rowData = rowData;
84          this.pkData = pkData;
85          this.audit = audit;
86      }
87  
88      public long getDataId() {
89          return dataId;
90      }
91  
92      public void setDataId(long dataId) {
93          this.dataId = dataId;
94      }
95  
96      public DataEventType getEventType() {
97          return eventType;
98      }
99  
100     public void setEventType(DataEventType eventType) {
101         this.eventType = eventType;
102     }
103 
104     public String getPkData() {
105         return pkData;
106     }
107 
108     public void setPkData(String pkData) {
109         this.pkData = pkData;
110     }
111 
112     public String getRowData() {
113         return rowData;
114     }
115 
116     public void setRowData(String rowData) {
117         this.rowData = rowData;
118     }
119 
120     public String getTableName() {
121         return tableName;
122     }
123 
124     public void setTableName(String tableName) {
125         this.tableName = tableName;
126     }
127 
128     public Date getCreateTime() {
129         return createTime;
130     }
131 
132     public void setCreateTime(Date createTime) {
133         this.createTime = createTime;
134     }
135 
136     public TriggerHistory getAudit() {
137         return audit;
138     }
139 
140     public void setAudit(TriggerHistory audit) {
141         this.audit = audit;
142     }
143 
144     public String getOldData() {
145         return oldData;
146     }
147 
148     public void setOldData(String oldData) {
149         this.oldData = oldData;
150     }
151 
152 }