From 146a0fb8b0e90f9196e569152f649baf60d6cc8f Mon Sep 17 00:00:00 2001
From: Joaquín Reñé <jrene@curisit.net>
Date: Tue, 07 Oct 2025 14:52:57 +0000
Subject: [PATCH] #4410 - Comments on classes
---
securis/src/main/java/net/curisit/securis/db/LicenseTypeMetadata.java | 179 +++++++++++++++++++++++++++++++++++++++++------------------
1 files changed, 125 insertions(+), 54 deletions(-)
diff --git a/securis/src/main/java/net/curisit/securis/db/LicenseTypeMetadata.java b/securis/src/main/java/net/curisit/securis/db/LicenseTypeMetadata.java
index e17ae8c..a004085 100644
--- a/securis/src/main/java/net/curisit/securis/db/LicenseTypeMetadata.java
+++ b/securis/src/main/java/net/curisit/securis/db/LicenseTypeMetadata.java
@@ -1,3 +1,6 @@
+/*
+* Copyright @ 2013 CurisTEC, S.A.S. All Rights Reserved.
+*/
package net.curisit.securis.db;
import java.io.Serializable;
@@ -21,80 +24,148 @@
import net.curisit.securis.db.common.Metadata;
/**
- * Entity implementation class for Entity: licensetype_metadata
- *
- */
+* LicenseTypeMetadata
+* <p>
+* Single metadata entry attached to a {@link LicenseType}.
+* Composite PK: (license_type_id, key).
+*
+* Mapping details:
+* - Table: licensetype_metadata
+* - @JsonBackReference to avoid recursion with LicenseType.metadata.
+* - NamedQuery: list-licensetype-metadata by license type id.
+*
+* @author JRA
+* Last reviewed by JRA on Oct 5, 2025.
+*/
@JsonAutoDetect
@JsonInclude(Include.NON_NULL)
@Entity
@Table(name = "licensetype_metadata")
@JsonIgnoreProperties(ignoreUnknown = true)
-@NamedQueries({ @NamedQuery(name = "list-licensetype-metadata", query = "SELECT a FROM LicenseTypeMetadata a where a.licenseType.id = :licenseTypeId") })
+@NamedQueries({
+ @NamedQuery(name = "list-licensetype-metadata",
+ query = "SELECT a FROM LicenseTypeMetadata a where a.licenseType.id = :licenseTypeId")
+})
public class LicenseTypeMetadata implements Serializable, Metadata {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
- @Id
- @ManyToOne
- @JsonBackReference
- @JoinColumn(name = "license_type_id")
- private LicenseType licenseType;
+ /** PK part: owning license type. */
+ @Id
+ @ManyToOne
+ @JsonBackReference
+ @JoinColumn(name = "license_type_id")
+ private LicenseType licenseType;
- @Id
- @Column(name = "\"key\"")
- private String key;
+ /** PK part: metadata key (quoted). */
+ @Id
+ @Column(name = "\"key\"")
+ private String key;
- private String value;
+ /** Metadata value. */
+ private String value;
- private boolean mandatory;
+ /** Whether this key is mandatory for the license type. */
+ private boolean mandatory;
- public LicenseType getLicenseType() {
- return licenseType;
- }
+ // ---------------- Getters & setters ----------------
- public void setLicenseType(LicenseType licenseType) {
- this.licenseType = licenseType;
- }
+ /**
+ * getLicenseType<p>
+ * Return owning license type.
+ *
+ * @return licenseType
+ */
+ public LicenseType getLicenseType() { return licenseType; }
- public String getValue() {
- return value;
- }
+ /**
+ * setLicenseType<p>
+ * Set owning license type.
+ *
+ * @param licenseType
+ */
+ public void setLicenseType(LicenseType licenseType) { this.licenseType = licenseType; }
- public void setValue(String value) {
- this.value = value;
- }
+ /**
+ * getValue<p>
+ * Return metadata value.
+ *
+ * @return value
+ */
+ public String getValue() { return value; }
- public String getKey() {
- return key;
- }
+ /**
+ * setValue<p>
+ * Set metadata value.
+ *
+ * @param value
+ */
+ public void setValue(String value) { this.value = value; }
- public void setKey(String key) {
- this.key = key;
- }
+ /**
+ * getKey<p>
+ * Return metadata key (PK part).
+ *
+ * @return key
+ */
+ public String getKey() { return key; }
- public boolean isMandatory() {
- return mandatory;
- }
+ /**
+ * setKey<p>
+ * Set metadata key (PK part).
+ *
+ * @param key
+ */
+ public void setKey(String key) { this.key = key; }
- public void setMandatory(boolean mandatory) {
- this.mandatory = mandatory;
- }
+ /**
+ * isMandatory<p>
+ * Return whether this entry is required.
+ *
+ * @return isMandatory
+ */
+ public boolean isMandatory() { return mandatory; }
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof LicenseTypeMetadata))
- return false;
- LicenseTypeMetadata other = (LicenseTypeMetadata) obj;
- return Objects.equals(key, other.key) && Objects.equals(licenseType, other.licenseType);
- }
+ /**
+ * setMandatory<p>
+ * Set whether this entry is required.
+ *
+ * @param mandatory
+ */
+ public void setMandatory(boolean mandatory) { this.mandatory = mandatory; }
- @Override
- public int hashCode() {
- return Objects.hash(key, licenseType);
- }
+ // ---------------- Object methods ----------------
- @Override
- public String toString() {
- return String.format("LTMD (%s: %s)", key, value);
- }
+ /**
+ * equals<p>
+ * Compare the current object with the given object
+ *
+ * @param object
+ * @return isEquals
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof LicenseTypeMetadata)) return false;
+ LicenseTypeMetadata other = (LicenseTypeMetadata) obj;
+ return Objects.equals(key, other.key) && Objects.equals(licenseType, other.licenseType);
+ }
+
+ /**
+ * hashCode<p>
+ * Get the object hashCode
+ *
+ * @return hashCode
+ */
+ @Override
+ public int hashCode() { return Objects.hash(key, licenseType); }
+
+ /**
+ * toString<p>
+ * Get the string describing the current object
+ *
+ * @return object string
+ */
+ @Override
+ public String toString() { return String.format("LTMD (%s: %s)", key, value); }
}
+
--
Gitblit v1.3.2