Joaquín Reñé
2025-10-07 146a0fb8b0e90f9196e569152f649baf60d6cc8f
securis/src/main/java/net/curisit/securis/db/LicenseTypeMetadata.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;
....@@ -21,80 +24,148 @@
2124 import net.curisit.securis.db.common.Metadata;
2225
2326 /**
24
- * Entity implementation class for Entity: licensetype_metadata
25
- *
26
- */
27
+* LicenseTypeMetadata
28
+* <p>
29
+* Single metadata entry attached to a {@link LicenseType}.
30
+* Composite PK: (license_type_id, key).
31
+*
32
+* Mapping details:
33
+* - Table: licensetype_metadata
34
+* - @JsonBackReference to avoid recursion with LicenseType.metadata.
35
+* - NamedQuery: list-licensetype-metadata by license type id.
36
+*
37
+* @author JRA
38
+* Last reviewed by JRA on Oct 5, 2025.
39
+*/
2740 @JsonAutoDetect
2841 @JsonInclude(Include.NON_NULL)
2942 @Entity
3043 @Table(name = "licensetype_metadata")
3144 @JsonIgnoreProperties(ignoreUnknown = true)
32
-@NamedQueries({ @NamedQuery(name = "list-licensetype-metadata", query = "SELECT a FROM LicenseTypeMetadata a where a.licenseType.id = :licenseTypeId") })
45
+@NamedQueries({
46
+ @NamedQuery(name = "list-licensetype-metadata",
47
+ query = "SELECT a FROM LicenseTypeMetadata a where a.licenseType.id = :licenseTypeId")
48
+})
3349 public class LicenseTypeMetadata implements Serializable, Metadata {
3450
35
- private static final long serialVersionUID = 1L;
51
+ private static final long serialVersionUID = 1L;
3652
37
- @Id
38
- @ManyToOne
39
- @JsonBackReference
40
- @JoinColumn(name = "license_type_id")
41
- private LicenseType licenseType;
53
+ /** PK part: owning license type. */
54
+ @Id
55
+ @ManyToOne
56
+ @JsonBackReference
57
+ @JoinColumn(name = "license_type_id")
58
+ private LicenseType licenseType;
4259
43
- @Id
44
- @Column(name = "\"key\"")
45
- private String key;
60
+ /** PK part: metadata key (quoted). */
61
+ @Id
62
+ @Column(name = "\"key\"")
63
+ private String key;
4664
47
- private String value;
65
+ /** Metadata value. */
66
+ private String value;
4867
49
- private boolean mandatory;
68
+ /** Whether this key is mandatory for the license type. */
69
+ private boolean mandatory;
5070
51
- public LicenseType getLicenseType() {
52
- return licenseType;
53
- }
71
+ // ---------------- Getters & setters ----------------
5472
55
- public void setLicenseType(LicenseType licenseType) {
56
- this.licenseType = licenseType;
57
- }
73
+ /**
74
+ * getLicenseType<p>
75
+ * Return owning license type.
76
+ *
77
+ * @return licenseType
78
+ */
79
+ public LicenseType getLicenseType() { return licenseType; }
5880
59
- public String getValue() {
60
- return value;
61
- }
81
+ /**
82
+ * setLicenseType<p>
83
+ * Set owning license type.
84
+ *
85
+ * @param licenseType
86
+ */
87
+ public void setLicenseType(LicenseType licenseType) { this.licenseType = licenseType; }
6288
63
- public void setValue(String value) {
64
- this.value = value;
65
- }
89
+ /**
90
+ * getValue<p>
91
+ * Return metadata value.
92
+ *
93
+ * @return value
94
+ */
95
+ public String getValue() { return value; }
6696
67
- public String getKey() {
68
- return key;
69
- }
97
+ /**
98
+ * setValue<p>
99
+ * Set metadata value.
100
+ *
101
+ * @param value
102
+ */
103
+ public void setValue(String value) { this.value = value; }
70104
71
- public void setKey(String key) {
72
- this.key = key;
73
- }
105
+ /**
106
+ * getKey<p>
107
+ * Return metadata key (PK part).
108
+ *
109
+ * @return key
110
+ */
111
+ public String getKey() { return key; }
74112
75
- public boolean isMandatory() {
76
- return mandatory;
77
- }
113
+ /**
114
+ * setKey<p>
115
+ * Set metadata key (PK part).
116
+ *
117
+ * @param key
118
+ */
119
+ public void setKey(String key) { this.key = key; }
78120
79
- public void setMandatory(boolean mandatory) {
80
- this.mandatory = mandatory;
81
- }
121
+ /**
122
+ * isMandatory<p>
123
+ * Return whether this entry is required.
124
+ *
125
+ * @return isMandatory
126
+ */
127
+ public boolean isMandatory() { return mandatory; }
82128
83
- @Override
84
- public boolean equals(Object obj) {
85
- if (!(obj instanceof LicenseTypeMetadata))
86
- return false;
87
- LicenseTypeMetadata other = (LicenseTypeMetadata) obj;
88
- return Objects.equals(key, other.key) && Objects.equals(licenseType, other.licenseType);
89
- }
129
+ /**
130
+ * setMandatory<p>
131
+ * Set whether this entry is required.
132
+ *
133
+ * @param mandatory
134
+ */
135
+ public void setMandatory(boolean mandatory) { this.mandatory = mandatory; }
90136
91
- @Override
92
- public int hashCode() {
93
- return Objects.hash(key, licenseType);
94
- }
137
+ // ---------------- Object methods ----------------
95138
96
- @Override
97
- public String toString() {
98
- return String.format("LTMD (%s: %s)", key, value);
99
- }
139
+ /**
140
+ * equals<p>
141
+ * Compare the current object with the given object
142
+ *
143
+ * @param object
144
+ * @return isEquals
145
+ */
146
+ @Override
147
+ public boolean equals(Object obj) {
148
+ if (!(obj instanceof LicenseTypeMetadata)) return false;
149
+ LicenseTypeMetadata other = (LicenseTypeMetadata) obj;
150
+ return Objects.equals(key, other.key) && Objects.equals(licenseType, other.licenseType);
151
+ }
152
+
153
+ /**
154
+ * hashCode<p>
155
+ * Get the object hashCode
156
+ *
157
+ * @return hashCode
158
+ */
159
+ @Override
160
+ public int hashCode() { return Objects.hash(key, licenseType); }
161
+
162
+ /**
163
+ * toString<p>
164
+ * Get the string describing the current object
165
+ *
166
+ * @return object string
167
+ */
168
+ @Override
169
+ public String toString() { return String.format("LTMD (%s: %s)", key, value); }
100170 }
171
+