/
FileTriggerRouter.java
193 lines (150 loc) · 5.19 KB
/
FileTriggerRouter.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
/**
* Licensed to JumpMind Inc under one or more contributor
* license agreements. See the NOTICE file distributed
* with this work for additional information regarding
* copyright ownership. JumpMind Inc licenses this file
* to you under the GNU General Public License, version 3.0 (GPLv3)
* (the "License"); you may not use this file except in compliance
* with the License.
*
* You should have received a copy of the GNU General Public License,
* version 3.0 (GPLv3) along with this library; if not, see
* <http://www.gnu.org/licenses/>.
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jumpmind.symmetric.model;
import java.io.Serializable;
import java.util.Date;
public class FileTriggerRouter implements Serializable {
private static final long serialVersionUID = 1L;
private FileTrigger fileTrigger;
private Router router;
private boolean enabled = true;
private boolean initialLoadEnabled;
private String targetBaseDir;
private FileConflictStrategy conflictStrategy = FileConflictStrategy.SOURCE_WINS;
private String conflictStrategyString;
private Date createTime = new Date();
private String lastUpdateBy;
private Date lastUpdateTime;
public FileTriggerRouter(FileTrigger fileTrigger, Router router) {
this.fileTrigger = fileTrigger;
this.router = router;
}
public FileTriggerRouter() {
}
public void setFileTrigger(FileTrigger fileTrigger) {
this.fileTrigger = fileTrigger;
}
public FileTrigger getFileTrigger() {
return fileTrigger;
}
public void setRouter(Router router) {
this.router = router;
}
public Router getRouter() {
return router;
}
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public void setInitialLoadEnabled(boolean initialLoadEnabled) {
this.initialLoadEnabled = initialLoadEnabled;
}
public boolean isInitialLoadEnabled() {
return initialLoadEnabled;
}
public String getTargetBaseDir() {
return targetBaseDir;
}
public void setTargetBaseDir(String targetBaseDir) {
this.targetBaseDir = targetBaseDir;
}
public FileConflictStrategy getConflictStrategy() {
return conflictStrategy;
}
public void setConflictStrategy(FileConflictStrategy conflictStrategy) {
this.conflictStrategy = conflictStrategy;
this.conflictStrategyString = conflictStrategy.name();
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getLastUpdateBy() {
return lastUpdateBy;
}
public void setLastUpdateBy(String lastUpdateBy) {
this.lastUpdateBy = lastUpdateBy;
}
public Date getLastUpdateTime() {
return lastUpdateTime;
}
public void setLastUpdateTime(Date lastUpdateTime) {
this.lastUpdateTime = lastUpdateTime;
}
public String getConflictStrategyString() {
return conflictStrategyString;
}
public void setConflictStrategyString(String conflictStrategyString) {
this.conflictStrategyString = conflictStrategyString;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((fileTrigger == null) ? 0 : fileTrigger.hashCode());
result = prime * result + ((router == null) ? 0 : router.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
FileTriggerRouter other = (FileTriggerRouter) obj;
if (fileTrigger == null) {
if (other.fileTrigger != null)
return false;
} else if (!fileTrigger.equals(other.fileTrigger))
return false;
if (router == null) {
if (other.router != null)
return false;
} else if (!router.equals(other.router))
return false;
return true;
}
public String getTriggerId() {
return this.fileTrigger != null ? this.fileTrigger.getTriggerId() : null;
}
public String getRouterId() {
return this.router != null ? this.router.getRouterId() : null;
}
public void setTriggerId(String triggerId) {
if (this.fileTrigger == null) {
this.fileTrigger = new FileTrigger();
}
this.fileTrigger.setTriggerId(triggerId);
}
public void setRouterId(String routerId) {
if (this.router == null) {
this.router = new Router();
}
this.router.setRouterId(routerId);
}
}