1
2
3
4
5
6 package fr.ifremer.quadrige3.core.dao.system.rule;
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 import java.io.Serializable;
29 import java.sql.Timestamp;
30
31
32
33
34
35 public abstract class RuleParameter
36 implements Serializable, Comparable<RuleParameter>
37 {
38
39
40
41 private static final long serialVersionUID = -329413034752799987L;
42
43
44 private Integer ruleParId;
45
46
47
48
49
50 public Integer getRuleParId()
51 {
52 return this.ruleParId;
53 }
54
55
56
57
58
59 public void setRuleParId(Integer ruleParIdIn)
60 {
61 this.ruleParId = ruleParIdIn;
62 }
63
64 private String ruleParValue;
65
66
67
68
69
70 public String getRuleParValue()
71 {
72 return this.ruleParValue;
73 }
74
75
76
77
78
79 public void setRuleParValue(String ruleParValueIn)
80 {
81 this.ruleParValue = ruleParValueIn;
82 }
83
84 private Timestamp updateDt;
85
86
87
88
89
90 public Timestamp getUpdateDt()
91 {
92 return this.updateDt;
93 }
94
95
96
97
98
99 public void setUpdateDt(Timestamp updateDtIn)
100 {
101 this.updateDt = updateDtIn;
102 }
103
104
105 private FunctionParameter functionParameter;
106
107
108
109
110
111 public FunctionParameter getFunctionParameter()
112 {
113 return this.functionParameter;
114 }
115
116
117
118
119
120 public void setFunctionParameter(FunctionParameter functionParameterIn)
121 {
122 this.functionParameter = functionParameterIn;
123 }
124
125 private Rule rule;
126
127
128
129
130
131 public Rule getRule()
132 {
133 return this.rule;
134 }
135
136
137
138
139
140 public void setRule(Rule ruleIn)
141 {
142 this.rule = ruleIn;
143 }
144
145
146
147
148
149 @Override
150 public boolean equals(Object object)
151 {
152 if (this == object)
153 {
154 return true;
155 }
156 if (!(object instanceof RuleParameter))
157 {
158 return false;
159 }
160 final RuleParameter that = (RuleParameter)object;
161 if (this.ruleParId == null || that.getRuleParId() == null || !this.ruleParId.equals(that.getRuleParId()))
162 {
163 return false;
164 }
165 return true;
166 }
167
168
169
170
171 @Override
172 public int hashCode()
173 {
174 int hashCode = 0;
175 hashCode = 29 * hashCode + (this.ruleParId == null ? 0 : this.ruleParId.hashCode());
176
177 return hashCode;
178 }
179
180
181
182
183 public static final class Factory
184 {
185
186
187
188
189 public static RuleParameter newInstance()
190 {
191 return new RuleParameterImpl();
192 }
193
194
195
196
197
198
199
200
201
202 public static RuleParameter newInstance(String ruleParValue, FunctionParameter functionParameter, Rule rule)
203 {
204 final RuleParameter entity = new RuleParameterImpl();
205 entity.setRuleParValue(ruleParValue);
206 entity.setFunctionParameter(functionParameter);
207 entity.setRule(rule);
208 return entity;
209 }
210
211
212
213
214
215
216
217
218
219
220 public static RuleParameter newInstance(String ruleParValue, Timestamp updateDt, FunctionParameter functionParameter, Rule rule)
221 {
222 final RuleParameter entity = new RuleParameterImpl();
223 entity.setRuleParValue(ruleParValue);
224 entity.setUpdateDt(updateDt);
225 entity.setFunctionParameter(functionParameter);
226 entity.setRule(rule);
227 return entity;
228 }
229 }
230
231
232
233
234 public int compareTo(RuleParameter o)
235 {
236 int cmp = 0;
237 if (this.getRuleParId() != null)
238 {
239 cmp = this.getRuleParId().compareTo(o.getRuleParId());
240 }
241 else
242 {
243 if (this.getRuleParValue() != null)
244 {
245 cmp = (cmp != 0 ? cmp : this.getRuleParValue().compareTo(o.getRuleParValue()));
246 }
247 if (this.getUpdateDt() != null)
248 {
249 cmp = (cmp != 0 ? cmp : this.getUpdateDt().compareTo(o.getUpdateDt()));
250 }
251 }
252 return cmp;
253 }
254
255
256 }