View Javadoc

1   /*
2    * SymmetricDS is an open source database synchronization solution.
3    *   
4    * Copyright (C) Chris Henson <chenson42@users.sourceforge.net>,
5    *               Eric Long <erilong@users.sourceforge.net>
6    *
7    * This library is free software; you can redistribute it and/or
8    * modify it under the terms of the GNU Lesser General Public
9    * License as published by the Free Software Foundation; either
10   * version 3 of the License, or (at your option) any later version.
11   *
12   * This library is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15   * Lesser General Public License for more details.
16   *
17   * You should have received a copy of the GNU Lesser General Public
18   * License along with this library; if not, see
19   * <http://www.gnu.org/licenses/>.
20   */
21  
22  package org.jumpmind.symmetric.model;
23  
24  import java.io.Serializable;
25  import java.util.Date;
26  
27  import org.jumpmind.symmetric.util.AppUtils;
28  
29  public class OutgoingBatchHistory implements Serializable {
30  
31      private static final long serialVersionUID = 1L;
32  
33      private static String thisHostName;
34  
35      public enum Status {
36          OK, ER, SK, SE, NE;
37      }
38  
39      private long batchId;
40  
41      private String nodeId;
42  
43      private Status status;
44  
45      private Date startTime;
46  
47      private Date endTime;
48  
49      private long networkMillis;
50  
51      private long filterMillis;
52  
53      private long databaseMillis;
54  
55      private String hostName;
56  
57      private long byteCount;
58  
59      private long dataEventCount;
60  
61      private long failedDataId;
62  
63      private String sqlState;
64  
65      private int sqlCode;
66  
67      private String sqlMessage;
68  
69      static {
70          thisHostName = AppUtils.getServerId();
71      }
72  
73      public OutgoingBatchHistory() {
74          this.hostName = thisHostName;
75          this.status = Status.NE;
76          this.startTime = new Date();
77      }
78  
79      public OutgoingBatchHistory(OutgoingBatch batch) {
80          this();
81          this.batchId = batch.getBatchId();
82          this.nodeId = batch.getNodeId();
83      }
84  
85      public OutgoingBatchHistory(BatchInfo batch) {
86          this();
87          this.batchId = new Long(batch.getBatchId());
88          this.nodeId = batch.getNodeId();
89          this.status = batch.isOk() ? Status.OK : Status.ER;
90          this.networkMillis = batch.getNetworkMillis();
91          this.filterMillis = batch.getFilterMillis();
92          this.databaseMillis = batch.getDatabaseMillis();
93          this.byteCount = batch.getByteCount();
94          this.sqlState = batch.getSqlState();
95          this.sqlCode = batch.getSqlCode();
96          this.sqlMessage = batch.getSqlMessage();
97      }
98  
99      public long getBatchId() {
100         return batchId;
101     }
102 
103     public void setBatchId(long batchId) {
104         this.batchId = batchId;
105     }
106 
107     public long getDataEventCount() {
108         return dataEventCount;
109     }
110 
111     public void setDataEventCount(long dataEventCount) {
112         this.dataEventCount = dataEventCount;
113     }
114 
115     public long getFailedDataId() {
116         return failedDataId;
117     }
118 
119     public void setFailedDataId(long failedDataId) {
120         this.failedDataId = failedDataId;
121     }
122 
123     public Status getStatus() {
124         return status;
125     }
126 
127     public void setStatus(Status status) {
128         this.status = status;
129     }
130 
131     public long getByteCount() {
132         return byteCount;
133     }
134 
135     public void setByteCount(long byteCount) {
136         this.byteCount = byteCount;
137     }
138 
139     public long getDatabaseMillis() {
140         return databaseMillis;
141     }
142 
143     public void setDatabaseMillis(long databaseMillis) {
144         this.databaseMillis = databaseMillis;
145     }
146 
147     public Date getEndTime() {
148         return endTime;
149     }
150 
151     public void setEndTime(Date endTime) {
152         this.endTime = endTime;
153     }
154 
155     public long getFilterMillis() {
156         return filterMillis;
157     }
158 
159     public void setFilterMillis(long filterMillis) {
160         this.filterMillis = filterMillis;
161     }
162 
163     public String getNodeId() {
164         return nodeId;
165     }
166 
167     public void setNodeId(String nodeId) {
168         this.nodeId = nodeId;
169     }
170 
171     public int getSqlCode() {
172         return sqlCode;
173     }
174 
175     public void setSqlCode(int sqlCode) {
176         this.sqlCode = sqlCode;
177     }
178 
179     public String getSqlMessage() {
180         return sqlMessage;
181     }
182 
183     public void setSqlMessage(String sqlMessage) {
184         this.sqlMessage = sqlMessage;
185     }
186 
187     public String getSqlState() {
188         return sqlState;
189     }
190 
191     public void setSqlState(String sqlState) {
192         this.sqlState = sqlState;
193     }
194 
195     public Date getStartTime() {
196         return startTime;
197     }
198 
199     public void setStartTime(Date startTime) {
200         this.startTime = startTime;
201     }
202 
203     public String getHostName() {
204         return hostName;
205     }
206 
207     public void setHostName(String hostName) {
208         this.hostName = hostName;
209     }
210 
211     public long getNetworkMillis() {
212         return networkMillis;
213     }
214 
215     public void setNetworkMillis(long networkMillis) {
216         this.networkMillis = networkMillis;
217     }
218 
219 }