Joaquín Reñé
2026-03-27 4ee50e257b32f6ec0f72907305d1f2b1212808a4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/*
* Copyright @ 2013 CurisTEC, S.A.S. All Rights Reserved.
*/
package net.curisit.securis.db;
import java.io.Serializable;
import java.util.Objects;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.NamedQueries;
import jakarta.persistence.NamedQuery;
import jakarta.persistence.Table;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import net.curisit.securis.db.common.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")
})
public class LicenseTypeMetadata implements Serializable, Metadata {
    private static final long serialVersionUID = 1L;
    /** PK part: owning license type. */
    @Id
    @ManyToOne
    @JsonBackReference
    @JoinColumn(name = "license_type_id")
    private LicenseType licenseType;
    /** PK part: metadata key (quoted). */
    @Id
    @Column(name = "\"key\"")
    private String key;
    /** Metadata value. */
    private String value;
    /** Whether this key is mandatory for the license type. */
    private boolean mandatory;
    // ---------------- Getters & setters ----------------
    /** 
     * getLicenseType<p>
     * Return owning license type. 
     * 
     * @return licenseType
     */
    public LicenseType getLicenseType() { return licenseType; }
    /** 
     * setLicenseType<p>
     * Set owning license type. 
     * 
     * @param licenseType
     */
    public void setLicenseType(LicenseType licenseType) { this.licenseType = licenseType; }
    /** 
     * getValue<p>
     * Return metadata value. 
     * 
     * @return value
     */
    public String getValue() { return value; }
    /** 
     * setValue<p>
     * Set metadata value. 
     * 
     * @param value
     */
    public void setValue(String value) { this.value = value; }
    /** 
     * getKey<p>
     * Return metadata key (PK part). 
     * 
     * @return key
     */
    public String getKey() { return key; }
    /** 
     * setKey<p>
     * Set metadata key (PK part). 
     * 
     * @param key
     */
    public void setKey(String key) { this.key = key; }
    /** 
     * isMandatory<p>
     * Return whether this entry is required. 
     * 
     * @return isMandatory
     */
    public boolean isMandatory() { return mandatory; }
    /** 
     * setMandatory<p>
     * Set whether this entry is required. 
     * 
     * @param mandatory
     */
    public void setMandatory(boolean mandatory) { this.mandatory = mandatory; }
    // ---------------- Object methods ----------------
    /**
     * 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); }
}