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/LicenseType.java |  302 +++++++++++++++++++++++++++++++++----------------
 1 files changed, 203 insertions(+), 99 deletions(-)

diff --git a/securis/src/main/java/net/curisit/securis/db/LicenseType.java b/securis/src/main/java/net/curisit/securis/db/LicenseType.java
index 1733787..b2553cd 100644
--- a/securis/src/main/java/net/curisit/securis/db/LicenseType.java
+++ b/securis/src/main/java/net/curisit/securis/db/LicenseType.java
@@ -1,3 +1,6 @@
+/*
+* Copyright @ 2013 CurisTEC, S.A.S. All Rights Reserved.
+*/
 package net.curisit.securis.db;
 
 import java.io.Serializable;
@@ -29,135 +32,236 @@
 import com.fasterxml.jackson.annotation.JsonProperty;
 
 /**
- * Entity implementation class for Entity: license_type
- * 
- */
+* LicenseType
+* <p>
+* Describes a license category within an application. Owns metadata entries.
+*
+* Mapping details:
+* - Table: license_type
+* - Many-to-one to Application (lazy).
+* - One-to-many metadata with cascade PERSIST/REMOVE/REFRESH.
+* - Named queries for listing and filtering by application(s).
+* 
+* @author JRA
+* Last reviewed by JRA on Oct 5, 2025.
+*/
 @JsonAutoDetect
 @JsonInclude(Include.NON_NULL)
 @JsonIgnoreProperties(ignoreUnknown = true)
 @Entity
 @Table(name = "license_type")
-@NamedQueries({ @NamedQuery(name = "list-license_types", query = "SELECT lt FROM LicenseType lt"),
-		@NamedQuery(name = "list-license_types-by_apps-id", query = "SELECT lt FROM LicenseType lt where lt.application.id in :list_ids"),
-		@NamedQuery(name = "list-application-license_types", query = "SELECT lt FROM LicenseType lt where lt.application.id = :appId") })
+@NamedQueries({
+    @NamedQuery(name = "list-license_types", query = "SELECT lt FROM LicenseType lt"),
+    @NamedQuery(name = "list-license_types-by_apps-id", query = "SELECT lt FROM LicenseType lt where lt.application.id in :list_ids"),
+    @NamedQuery(name = "list-application-license_types", query = "SELECT lt FROM LicenseType lt where lt.application.id = :appId")
+})
 public class LicenseType implements Serializable {
 
-	@SuppressWarnings("unused")
-	private static final Logger LOG = LogManager.getLogger(LicenseType.class);
-	private static final long serialVersionUID = 1L;
+    @SuppressWarnings("unused")
+    private static final Logger LOG = LogManager.getLogger(LicenseType.class);
+    private static final long serialVersionUID = 1L;
 
-	@Id
-	@GeneratedValue
-	private Integer id;
+    @Id
+    @GeneratedValue
+    private Integer id;
 
-	private String code;
-	private String name;
-	private String description;
+    private String code;
+    private String name;
+    private String description;
 
-	@Column(name = "creation_timestamp")
-	@JsonProperty("creation_timestamp")
-	private Date creationTimestamp;
+    @Column(name = "creation_timestamp")
+    @JsonProperty("creation_timestamp")
+    private Date creationTimestamp;
 
-	@JsonIgnore
-	@ManyToOne(fetch = FetchType.LAZY)
-	@JoinColumn(name = "application_id")
-	private Application application;
+    @JsonIgnore
+    @ManyToOne(fetch = FetchType.LAZY)
+    @JoinColumn(name = "application_id")
+    private Application application;
 
-	@OneToMany(fetch = FetchType.LAZY, cascade = { CascadeType.PERSIST, CascadeType.REMOVE, CascadeType.REFRESH }, mappedBy = "licenseType")
-	@JsonManagedReference
-	private Set<LicenseTypeMetadata> metadata;
+    @OneToMany(fetch = FetchType.LAZY, cascade = { CascadeType.PERSIST, CascadeType.REMOVE, CascadeType.REFRESH }, mappedBy = "licenseType")
+    @JsonManagedReference
+    private Set<LicenseTypeMetadata> metadata;
 
-	public Set<LicenseTypeMetadata> getMetadata() {
-		return metadata;
-	}
+    // ---------------- Getters & setters ----------------
 
-	public void setMetadata(Set<LicenseTypeMetadata> metadata) {
-		this.metadata = metadata;
-	}
+    /** 
+     * getMetadata<p>
+     * Return associated metadata entries.
+     * 
+     * @return metadata
+     */
+    public Set<LicenseTypeMetadata> getMetadata() { return metadata; }
 
-	public Integer getId() {
-		return id;
-	}
+    /** 
+     * setMetadata<p>
+     * Set associated metadata entries. 
+     * 
+     * @param metadata
+     */
+    public void setMetadata(Set<LicenseTypeMetadata> metadata) { this.metadata = metadata; }
 
-	public void setId(Integer id) {
-		this.id = id;
-	}
+    /** 
+     * getId<p>
+     * Return primary key. 
+     * 
+     * @return id
+     */
+    public Integer getId() { return id; }
 
-	public String getName() {
-		return name;
-	}
+    /** 
+     * setId<p>
+     * Set primary key. 
+     * 
+     * @param id
+     */
+    public void setId(Integer id) { this.id = id; }
 
-	public void setName(String name) {
-		this.name = name;
-	}
+    /** 
+     * getName<p>
+     * Return display name. 
+     * 
+     * @return name
+     */
+    public String getName() { return name; }
 
-	public String getDescription() {
-		return description;
-	}
+    /** 
+     * setName<p>
+     * Set display name. 
+     * 
+     * @param name
+     */
+    public void setName(String name) { this.name = name; }
 
-	public void setDescription(String description) {
-		this.description = description;
-	}
+    /** 
+     * getDescription<p>
+     * Return description. 
+     * 
+     * @return description
+     */
+    public String getDescription() { return description; }
 
-	public String getCode() {
-		return code;
-	}
+    /** 
+     * setDescription<p>
+     * Set description. 
+     * 
+     * @param description
+     */
+    public void setDescription(String description) { this.description = description; }
 
-	public void setCode(String code) {
-		this.code = code;
-	}
+    /** 
+     * getCode<p>
+     * Return short code. 
+     * 
+     * @return code
+     */
+    public String getCode() { return code; }
 
-	public Application getApplication() {
-		return application;
-	}
+    /** 
+     * setCode<p>
+     * Set short code. 
+     * 
+     * @param code
+     */
+    public void setCode(String code) { this.code = code; }
 
-	@JsonProperty("application_name")
-	public String getApplicationName() {
-		return application == null ? null : application.getName();
-	}
+    /** 
+     * getApplication<p>
+     * Return owning application (entity). 
+     * 
+     * @return application
+     */
+    public Application getApplication() { return application; }
 
-	@JsonProperty("application_id")
-	public Integer getApplicationId() {
-		return application == null ? null : application.getId();
-	}
+    /** 
+     * getApplicationName<p>
+     * Expose app name for JSON. 
+     * 
+     * @return appName
+     */
+    @JsonProperty("application_name")
+    public String getApplicationName() { return application == null ? null : application.getName(); }
 
-	@JsonProperty("application_id")
-	public void setApplicationId(Integer appId) {
-		if (appId == null) {
-			application = null;
-		} else {
-			application = new Application();
-			application.setId(appId);
-		}
-	}
+    /** 
+     * getApplicationId<p>
+     * Expose app id for JSON. 
+     * 
+     * @return appId
+     */
+    @JsonProperty("application_id")
+    public Integer getApplicationId() { return application == null ? null : application.getId(); }
 
-	public void setApplication(Application application) {
-		this.application = application;
-	}
+    /** 
+     * setApplicationId<p>
+     * Setter by id for JSON binding (creates shallow Application). 
+     * 
+     * @param appId
+     */
+    @JsonProperty("application_id")
+    public void setApplicationId(Integer appId) {
+        if (appId == null) {
+            application = null;
+        } else {
+            application = new Application();
+            application.setId(appId);
+        }
+    }
 
-	public Date getCreationTimestamp() {
-		return creationTimestamp;
-	}
+    /** 
+     * setApplication<p>
+     * Set owning application (entity). 
+     * 
+     * @param application
+     */
+    public void setApplication(Application application) { this.application = application; }
 
-	public void setCreationTimestamp(Date creationTimestamp) {
-		this.creationTimestamp = creationTimestamp;
-	}
+    /** 
+     * getCreationTimestamp<p>
+     * Return creation timestamp. 
+     * 
+     * @return creationTimestamp
+     */
+    public Date getCreationTimestamp() { return creationTimestamp; }
 
-	@Override
-	public boolean equals(Object obj) {
-		if (!(obj instanceof LicenseType))
-			return false;
-		LicenseType other = (LicenseType) obj;
-		return id.equals(other.id);
-	}
+    /** 
+     * setCreationTimestamp<p>
+     * Set creation timestamp. 
+     * 
+     * @param creationTimestamp
+     */
+    public void setCreationTimestamp(Date creationTimestamp) { this.creationTimestamp = creationTimestamp; }
 
-	@Override
-	public int hashCode() {
-		return (id == null ? 0 : id.hashCode());
-	}
+    // ---------------- Object methods ----------------
 
-	@Override
-	public String toString() {
-		return String.format("LT: ID: %d, code: %s", id, code);
-	}
+    /**
+     * equals<p>
+     * Compare the current object with the given object
+     * 
+     * @param object
+     * @return isEquals
+     */
+    @Override
+    public boolean equals(Object obj) {
+        if (!(obj instanceof LicenseType)) return false;
+        LicenseType other = (LicenseType) obj;
+        return id != null && id.equals(other.id);
+    }
+
+    /**
+     * hashCode<p>
+     * Get the object hashCode
+     * 
+     * @return hashCode
+     */
+    @Override
+    public int hashCode() { return (id == null ? 0 : id.hashCode()); }
+
+    /**
+     * toString<p>
+     * Get the string describing the current object
+     * 
+     * @return object string
+     */
+    @Override
+    public String toString() { return String.format("LT: ID: %d, code: %s", id, code); }
 }
+

--
Gitblit v1.3.2