1 |
|
package org.europa.together.domain; |
2 |
|
|
3 |
|
import java.io.Serializable; |
4 |
|
import java.util.Objects; |
5 |
|
import jakarta.persistence.Column; |
6 |
|
import jakarta.persistence.Entity; |
7 |
|
import jakarta.persistence.Id; |
8 |
|
import jakarta.persistence.Index; |
9 |
|
import jakarta.persistence.PrePersist; |
10 |
|
import jakarta.persistence.Table; |
11 |
|
import jakarta.persistence.UniqueConstraint; |
12 |
|
import org.europa.together.application.LogbackLogger; |
13 |
|
import org.europa.together.business.Logger; |
14 |
|
import org.europa.together.utils.StringUtils; |
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
@Entity |
22 |
|
@Table(name = "APP_CONFIG", |
23 |
|
|
24 |
|
indexes = { |
25 |
|
@Index(columnList = "CONF_KEY", name = "configuration_key"), |
26 |
|
@Index(columnList = "MODUL_NAME", name = "modul_name"), |
27 |
|
@Index(columnList = "CONF_SET", name = "configuration_set") |
28 |
|
}, |
29 |
|
|
30 |
|
uniqueConstraints = { |
31 |
|
@UniqueConstraint(columnNames |
32 |
|
= {"MODUL_NAME", "SERVICE_VERSION", "CONF_KEY"}) |
33 |
|
} |
34 |
|
) |
|
|
| 100% |
Uncovered Elements: 0 (81) |
Complexity: 32 |
Complexity Density: 0.65 |
|
35 |
|
public class ConfigurationDO implements Serializable { |
36 |
|
|
37 |
|
private static final long serialVersionUID = 102L; |
38 |
|
private static final Logger LOGGER = new LogbackLogger(ConfigurationDO.class); |
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
public static final String TABLE_NAME = "APP_CONFIG"; |
44 |
|
|
45 |
|
@Id |
46 |
|
@Column(name = "IDX") |
47 |
|
private String uuid; |
48 |
|
|
49 |
|
@Column(name = "CONF_KEY", nullable = false) |
50 |
|
private String key; |
51 |
|
|
52 |
|
@Column(name = "CONF_VALUE") |
53 |
|
private String value; |
54 |
|
|
55 |
|
@Column(name = "DEFAULT_VALUE", nullable = false) |
56 |
|
private String defaultValue; |
57 |
|
|
58 |
|
@Column(name = "MODUL_NAME", nullable = false) |
59 |
|
private String modulName; |
60 |
|
|
61 |
|
@Column(name = "SERVICE_VERSION", nullable = false) |
62 |
|
private String version; |
63 |
|
|
64 |
|
@Column(name = "CONF_SET", nullable = false) |
65 |
|
private String configurationSet; |
66 |
|
|
67 |
|
@Column(name = "DEPRECATED", nullable = false) |
68 |
|
private boolean deprecated; |
69 |
|
|
70 |
|
@Column(name = "MANDATORY", nullable = false) |
71 |
|
private boolean mandatory; |
72 |
|
|
73 |
|
@Column(name = "COMMENT") |
74 |
|
private String comment; |
75 |
|
|
76 |
|
|
77 |
|
|
78 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
79 |
316 |
public ConfigurationDO() {... |
80 |
|
|
81 |
316 |
this.uuid = StringUtils.generateUUID(); |
82 |
|
} |
83 |
|
|
84 |
|
|
85 |
|
|
86 |
|
|
87 |
|
@param |
88 |
|
@param |
89 |
|
@param |
90 |
|
@param |
91 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 1 |
Complexity Density: 0.1 |
|
92 |
10 |
public ConfigurationDO(final String key, final String value, final String modulName,... |
93 |
|
final String version) { |
94 |
|
|
95 |
10 |
this.uuid = StringUtils.generateUUID(); |
96 |
|
|
97 |
10 |
this.modulName = modulName; |
98 |
10 |
this.version = version; |
99 |
10 |
this.key = key; |
100 |
10 |
this.value = value; |
101 |
|
|
102 |
10 |
this.configurationSet = "default"; |
103 |
10 |
this.defaultValue = "NIL"; |
104 |
10 |
this.deprecated = false; |
105 |
10 |
this.mandatory = false; |
106 |
10 |
this.comment = ""; |
107 |
|
} |
108 |
|
|
109 |
|
|
110 |
|
|
111 |
|
|
112 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
113 |
8 |
@PrePersist... |
114 |
|
public void prePersist() { |
115 |
8 |
this.configurationSet = "default"; |
116 |
8 |
this.defaultValue = "NIL"; |
117 |
8 |
this.deprecated = false; |
118 |
8 |
this.mandatory = false; |
119 |
8 |
LOGGER.log("@PrePersist [ConfigurationDO]", LogLevel.INFO); |
120 |
|
} |
121 |
|
|
122 |
|
|
123 |
|
|
124 |
|
|
125 |
|
|
126 |
|
@return |
127 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
128 |
2 |
public boolean isDeprecated() {... |
129 |
2 |
return deprecated; |
130 |
|
} |
131 |
|
|
132 |
|
|
133 |
|
|
134 |
|
|
135 |
|
@return |
136 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
137 |
5 |
public boolean isMandatory() {... |
138 |
5 |
return mandatory; |
139 |
|
} |
140 |
|
|
141 |
|
|
142 |
|
|
143 |
|
|
144 |
|
@param |
145 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
146 |
3 |
public void setComment(final String comment) {... |
147 |
3 |
this.comment = comment; |
148 |
|
} |
149 |
|
|
150 |
|
|
151 |
|
|
152 |
|
|
153 |
|
@param |
154 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
155 |
36 |
public void setConfigurationSet(final String configurationSet) {... |
156 |
36 |
this.configurationSet = configurationSet; |
157 |
|
} |
158 |
|
|
159 |
|
|
160 |
|
|
161 |
|
|
162 |
|
@param |
163 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
164 |
36 |
public void setDefaultValue(final String defaultValue) {... |
165 |
36 |
this.defaultValue = defaultValue; |
166 |
|
} |
167 |
|
|
168 |
|
|
169 |
|
|
170 |
|
|
171 |
|
@param |
172 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
173 |
2 |
public void setDeprecated(final boolean deprecated) {... |
174 |
2 |
this.deprecated = deprecated; |
175 |
|
} |
176 |
|
|
177 |
|
|
178 |
|
|
179 |
|
|
180 |
|
@param |
181 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
182 |
2 |
public void setMandatory(final boolean mandatory) {... |
183 |
2 |
this.mandatory = mandatory; |
184 |
|
} |
185 |
|
|
186 |
|
|
187 |
|
|
188 |
|
|
189 |
|
@param |
190 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
191 |
45 |
public void setKey(final String key) {... |
192 |
45 |
this.key = key; |
193 |
|
} |
194 |
|
|
195 |
|
|
196 |
|
|
197 |
|
|
198 |
|
@param |
199 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
200 |
45 |
public void setModulName(final String modulName) {... |
201 |
45 |
this.modulName = modulName; |
202 |
|
} |
203 |
|
|
204 |
|
|
205 |
|
|
206 |
|
|
207 |
|
@param |
208 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
209 |
34 |
public void setUuid(final String uuid) {... |
210 |
34 |
this.uuid = uuid; |
211 |
|
} |
212 |
|
|
213 |
|
|
214 |
|
|
215 |
|
|
216 |
|
@param |
217 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
218 |
53 |
public void setValue(final String value) {... |
219 |
53 |
this.value = value; |
220 |
|
} |
221 |
|
|
222 |
|
|
223 |
|
|
224 |
|
|
225 |
|
@param |
226 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
227 |
43 |
public void setVersion(final String version) {... |
228 |
43 |
this.version = version; |
229 |
|
} |
230 |
|
|
231 |
|
|
232 |
|
|
233 |
|
|
234 |
|
@return |
235 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
236 |
3 |
public String getComment() {... |
237 |
3 |
return comment; |
238 |
|
} |
239 |
|
|
240 |
|
|
241 |
|
|
242 |
|
|
243 |
|
@return |
244 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
245 |
3 |
public String getConfigurationSet() {... |
246 |
3 |
return configurationSet; |
247 |
|
} |
248 |
|
|
249 |
|
|
250 |
|
|
251 |
|
|
252 |
|
@return |
253 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
254 |
65 |
public String getDefaultValue() {... |
255 |
65 |
return defaultValue; |
256 |
|
} |
257 |
|
|
258 |
|
|
259 |
|
|
260 |
|
|
261 |
|
@return |
262 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
263 |
286 |
public String getKey() {... |
264 |
286 |
return key; |
265 |
|
} |
266 |
|
|
267 |
|
|
268 |
|
|
269 |
|
|
270 |
|
@return |
271 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
272 |
2 |
public String getModulName() {... |
273 |
2 |
return modulName; |
274 |
|
} |
275 |
|
|
276 |
|
|
277 |
|
|
278 |
|
|
279 |
|
@return |
280 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
281 |
85 |
public String getUuid() {... |
282 |
85 |
return uuid; |
283 |
|
} |
284 |
|
|
285 |
|
|
286 |
|
|
287 |
|
|
288 |
|
@return |
289 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
290 |
122 |
public String getValue() {... |
291 |
122 |
return value; |
292 |
|
} |
293 |
|
|
294 |
|
|
295 |
|
|
296 |
|
|
297 |
|
@return |
298 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
299 |
8 |
public String getVersion() {... |
300 |
8 |
return version; |
301 |
|
} |
302 |
|
|
303 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (14) |
Complexity: 7 |
Complexity Density: 0.88 |
|
304 |
23 |
@Override... |
305 |
|
public boolean equals(final Object obj) { |
306 |
|
|
307 |
23 |
boolean success = false; |
308 |
23 |
if (obj != null && obj instanceof ConfigurationDO) { |
309 |
|
|
310 |
21 |
if (this == obj) { |
311 |
1 |
success = true; |
312 |
|
} else { |
313 |
|
|
314 |
20 |
final ConfigurationDO other = (ConfigurationDO) obj; |
315 |
20 |
if (Objects.equals(this.key, other.key) |
316 |
|
&& Objects.equals(this.modulName, other.modulName) |
317 |
|
&& Objects.equals(this.version, other.version)) { |
318 |
7 |
success = true; |
319 |
|
} |
320 |
|
} |
321 |
|
} |
322 |
23 |
return success; |
323 |
|
} |
324 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
325 |
6 |
@Override... |
326 |
|
public int hashCode() { |
327 |
6 |
int hash = Objects.hashCode(this.key); |
328 |
6 |
hash += Objects.hashCode(this.modulName); |
329 |
6 |
hash += Objects.hashCode(this.version); |
330 |
6 |
return hash; |
331 |
|
} |
332 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
333 |
41 |
@Override... |
334 |
|
public String toString() { |
335 |
41 |
return "ConfigurationDO{" + "uuid=" + uuid |
336 |
|
+ ", key=" + key |
337 |
|
+ ", value=" + value |
338 |
|
+ ", defaultValue=" + defaultValue |
339 |
|
+ ", modulName=" + modulName |
340 |
|
+ ", configurationSet=" + configurationSet |
341 |
|
+ ", version=" + version |
342 |
|
+ ", deprecated=" + deprecated |
343 |
|
+ ", mandatory=" + mandatory |
344 |
|
+ ", comment=" + comment + '}'; |
345 |
|
} |
346 |
|
} |