Joaquín Reñé
2025-10-07 146a0fb8b0e90f9196e569152f649baf60d6cc8f
securis/src/main/java/net/curisit/securis/db/Application.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;
....@@ -30,9 +33,25 @@
3033 import com.fasterxml.jackson.annotation.JsonProperty;
3134
3235 /**
33
- * Entity implementation class for Entity: application
34
- *
35
- */
36
+* Application
37
+* <p>
38
+* JPA entity that represents an application registered in the licensing server.
39
+* Includes descriptive fields and relationships to <code>LicenseType</code>,
40
+* <code>ApplicationMetadata</code> and <code>User</code>.
41
+*
42
+* Mapping details:
43
+* <ul>
44
+* <li>Table: <code>application</code></li>
45
+* <li>Named queries: <code>list-applications</code>, <code>list-applications-by_ids</code></li>
46
+* <li>Relationships:
47
+* <ul>
48
+* <li><code>@OneToMany</code> <b>licenseTypes</b> (mappedBy="application")</li>
49
+* <li><code>@OneToMany</code> <b>metadata</b> with cascade PERSIST/REMOVE/REFRESH</li>
50
+* <li><code>@ManyToMany</code> <b>users</b> via join table <code>user_application</code></li>
51
+* </ul>
52
+* </li>
53
+* </ul>
54
+*/
3655 @JsonAutoDetect
3756 @JsonInclude(Include.NON_NULL)
3857 @JsonIgnoreProperties(ignoreUnknown = true)
....@@ -46,32 +65,57 @@
4665
4766 private static final long serialVersionUID = 1L;
4867
68
+ // ------------------------------------------------------------------
69
+ // Columns
70
+ // ------------------------------------------------------------------
71
+
72
+
73
+ /** Surrogate primary key. */
4974 @Id
5075 @GeneratedValue
5176 private Integer id;
5277
78
+ /** Unique short code for the application (business identifier). */
5379 private String code;
80
+
81
+ /** Human-friendly application name. */
5482 private String name;
83
+
84
+ /** Optional description. */
5585 private String description;
5686
87
+ /** Default license file name suggested for downloads/exports. */
5788 @Column(name = "license_filename")
5889 @JsonProperty("license_filename")
5990 private String licenseFilename;
6091
92
+ /** Creation timestamp (server-side). */
6193 @Column(name = "creation_timestamp")
6294 @JsonProperty("creation_timestamp")
6395 private Date creationTimestamp;
6496
65
- // We don't include the referenced entities to limit the size of each row at
66
- // // the listing
97
+ // ----------------------- Relationships ---------------------------
98
+
99
+
100
+ /**
101
+ * License types attached to this application (ignored in default JSON to keep listings small).
102
+ *
103
+ * We don't include the referenced entities to limit the size of each row at the listing
104
+ */
67105 @JsonIgnore
68106 @OneToMany(fetch = FetchType.LAZY, mappedBy = "application")
69107 private Set<LicenseType> licenseTypes;
70108
109
+ /**
110
+ * Metadata key/value entries for this application.
111
+ */
71112 @OneToMany(fetch = FetchType.LAZY, cascade = { CascadeType.PERSIST, CascadeType.REMOVE, CascadeType.REFRESH }, mappedBy = "application")
72113 @JsonManagedReference
73114 private Set<ApplicationMetadata> metadata;
74115
116
+ /**
117
+ * Users that have access/relationship with this application (ignored in JSON listings).
118
+ */
75119 @JsonIgnore
76120 // We don't include the users to limit the size of each row a the listing
77121 @ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
....@@ -80,73 +124,180 @@
80124 inverseJoinColumns = { @JoinColumn(name = "username", referencedColumnName = "username") })
81125 private Set<User> users;
82126
127
+ // ------------------------------------------------------------------
128
+ // Getters & setters
129
+ // ------------------------------------------------------------------
130
+
131
+ /**
132
+ * getId<p>
133
+ * Return the primary key.
134
+ *
135
+ * @return id
136
+ */
83137 public Integer getId() {
84138 return id;
85139 }
86140
141
+ /**
142
+ * setId<p>
143
+ * Set the primary key
144
+ *
145
+ * @param id
146
+ */
87147 public void setId(Integer id) {
88148 this.id = id;
89149 }
90150
151
+ /**
152
+ * getName<p>
153
+ * Get the name
154
+ *
155
+ * @return name
156
+ */
91157 public String getName() {
92158 return name;
93159 }
94160
161
+ /**
162
+ * setName<p>
163
+ * Set the name
164
+ *
165
+ * @param name
166
+ */
95167 public void setName(String name) {
96168 this.name = name;
97169 }
98170
171
+ /**
172
+ * getDescription<p>
173
+ * Get the description
174
+ *
175
+ * @return description
176
+ */
99177 public String getDescription() {
100178 return description;
101179 }
102180
181
+ /**
182
+ * setDescription<p>
183
+ * Set the description
184
+ *
185
+ * @param description
186
+ */
103187 public void setDescription(String description) {
104188 this.description = description;
105189 }
106190
191
+ /**
192
+ * getCreationTimestamp<p>
193
+ * Get the creation timestamp
194
+ *
195
+ * @return creationTimestamp
196
+ */
107197 public Date getCreationTimestamp() {
108198 return creationTimestamp;
109199 }
110200
201
+ /**
202
+ * setCreationTimestamp<p>
203
+ * Set the creation timestamp
204
+ *
205
+ * @param creationTimestamp
206
+ */
111207 public void setCreationTimestamp(Date creationTimestamp) {
112208 this.creationTimestamp = creationTimestamp;
113209 }
114210
211
+ /**
212
+ * getApplicationMetadata<p>
213
+ * Set the application metadata
214
+ *
215
+ * @return appMetadata
216
+ */
115217 @JsonProperty("metadata")
116218 public Set<ApplicationMetadata> getApplicationMetadata() {
117219 return metadata;
118220 }
119221
222
+ /**
223
+ * setApplicationMetadata<p>
224
+ * Set the application metadata
225
+ *
226
+ * @param metadata
227
+ */
120228 @JsonProperty("metadata")
121229 public void setApplicationMetadata(Set<ApplicationMetadata> metadata) {
122230 this.metadata = metadata;
123231 }
124232
233
+ /**
234
+ * getLicenseFilename<p>
235
+ * Get the license file name
236
+ *
237
+ * @return licenseFilename
238
+ */
125239 public String getLicenseFilename() {
126240 return licenseFilename;
127241 }
128242
243
+ /**
244
+ * setLicenseFilename<p>
245
+ * Set the license file name
246
+ *
247
+ * @param licenseFilename
248
+ */
129249 public void setLicenseFilename(String licenseFilename) {
130250 this.licenseFilename = licenseFilename;
131251 }
132252
253
+ /**
254
+ * getLicenseTypes<p>
255
+ * Get the license types
256
+ *
257
+ * @return licenseTypes
258
+ */
133259 public Set<LicenseType> getLicenseTypes() {
134260 LOG.info("Getting list license types!!!!");
135261 return licenseTypes;
136262 }
137263
264
+ /**
265
+ * setLicenseTypes<p>
266
+ * Set the license types
267
+ *
268
+ * @param licenseTypes
269
+ */
138270 public void setLicenseTypes(Set<LicenseType> licenseTypes) {
139271 this.licenseTypes = licenseTypes;
140272 }
141273
274
+ /**
275
+ * getCode<p>
276
+ * Get the application code
277
+ *
278
+ * @return code
279
+ */
142280 public String getCode() {
143281 return code;
144282 }
145283
284
+ /**
285
+ * setCode<p>
286
+ * Set the application code
287
+ *
288
+ * @param code
289
+ */
146290 public void setCode(String code) {
147291 this.code = code;
148292 }
149293
294
+ /**
295
+ * equals<p>
296
+ * Compares the current object with the given object
297
+ *
298
+ * @param object
299
+ * @return isEquals
300
+ */
150301 @Override
151302 public boolean equals(Object obj) {
152303 if (!(obj instanceof Application))
....@@ -155,6 +306,12 @@
155306 return id.equals(other.id);
156307 }
157308
309
+ /**
310
+ * hashCode<p>
311
+ * Get the object hashCode
312
+ *
313
+ * @param hashCode
314
+ */
158315 @Override
159316 public int hashCode() {
160317