Joaquín Reñé
2025-10-07 146a0fb8b0e90f9196e569152f649baf60d6cc8f
securis/src/main/java/net/curisit/securis/db/Settings.java
....@@ -1,3 +1,6 @@
1
+/*
2
+* Copyright @ 2013 CurisTEC, S.A.S. All Rights Reserved.
3
+*/
14 package net.curisit.securis.db;
25
36 import java.io.Serializable;
....@@ -20,63 +23,103 @@
2023 import com.fasterxml.jackson.annotation.JsonProperty;
2124
2225 /**
23
- * Entity implementation class for Entity: settings settings is a table that has
24
- * rows with 3 columns: "key", "value", "timestamp"
25
- *
26
- */
27
-@Entity()
28
-@EntityListeners({
29
- ModificationTimestampListener.class
30
-})
26
+* Settings
27
+* <p>
28
+* Simple key/value store with last modification timestamp.
29
+* Table rows have columns: "key", "value", "modification_timestamp".
30
+*
31
+* Mapping details:
32
+* - Table: settings
33
+* - Listeners: {@link ModificationTimestampListener}
34
+* - NamedQuery: get-param by key
35
+*
36
+* @author JRA
37
+* Last reviewed by JRA on Oct 5, 2025.
38
+*/
39
+@Entity
40
+@EntityListeners({ ModificationTimestampListener.class })
3141 @Table(name = "settings")
3242 @NamedQueries({
3343 @NamedQuery(name = "get-param", query = "SELECT p FROM Settings p where p.key = :key")
3444 })
3545 public class Settings implements ModificationTimestampEntity, Serializable {
46
+
3647 @SuppressWarnings("unused")
3748 private static final Logger LOG = LogManager.getLogger(Settings.class);
3849
3950 private static final long serialVersionUID = 1L;
4051
52
+ /** Primary key: setting key. */
4153 @Id
4254 String key;
4355
56
+ /** Setting value as string. */
4457 String value;
4558
59
+ /** Last modification timestamp. */
4660 @Column(name = "modification_timestamp")
4761 @JsonProperty("modification_timestamp")
4862 private Date modificationTimestamp;
4963
50
- public String getKey() {
51
- return key;
52
- }
64
+ // -------- Getters/setters --------
5365
54
- public void setKey(String key) {
55
- this.key = key;
56
- }
66
+ /**
67
+ * getKey<p>
68
+ * Return setting key.
69
+ *
70
+ * @return key
71
+ */
72
+ public String getKey() { return key; }
5773
58
- public String getValue() {
59
- return value;
60
- }
74
+ /**
75
+ * setKey<p>
76
+ * Set setting key.
77
+ *
78
+ * @param key
79
+ */
80
+ public void setKey(String key) { this.key = key; }
6181
62
- public void setValue(String value) {
63
- this.value = value;
64
- }
82
+ /**
83
+ * getValue<p>
84
+ * Return value.
85
+ *
86
+ * @return value
87
+ */
88
+ public String getValue() { return value; }
6589
90
+ /**
91
+ * setValue<p>
92
+ * Set value.
93
+ *
94
+ * @param value
95
+ */
96
+ public void setValue(String value) { this.value = value; }
97
+
98
+ /**
99
+ * getModificationTimestamp<p>
100
+ * Required by ModificationTimestampEntity.
101
+ *
102
+ * @return modificationTimestamp
103
+ */
66104 @Override
67
- public Date getModificationTimestamp() {
68
- return modificationTimestamp;
69
- }
105
+ public Date getModificationTimestamp() { return modificationTimestamp; }
70106
107
+ /**
108
+ * setModificationTimestamp<p>
109
+ * Required by ModificationTimestampEntity.
110
+ *
111
+ * @param modificationTimestamp
112
+ */
71113 @Override
72
- public void setModificationTimestamp(Date modificationTimestamp) {
73
- this.modificationTimestamp = modificationTimestamp;
74
- }
114
+ public void setModificationTimestamp(Date modificationTimestamp) { this.modificationTimestamp = modificationTimestamp; }
75115
116
+ /**
117
+ * toString<p>
118
+ * Get the string describing the current object
119
+ *
120
+ * @return object string
121
+ */
76122 @Override
77
- public String toString() {
78
-
79
- return String.format("{key: %s, value: %s, ts: %s}", key, value, modificationTimestamp);
80
- }
81
-
123
+ public String toString() { return String.format("{key: %s, value: %s, ts: %s}", key, value, modificationTimestamp); }
82124 }
125
+