| .. | .. |
|---|
| 1 | +/* |
|---|
| 2 | +* Copyright @ 2013 CurisTEC, S.A.S. All Rights Reserved. |
|---|
| 3 | +*/ |
|---|
| 1 | 4 | package net.curisit.securis.db; |
|---|
| 2 | 5 | |
|---|
| 3 | 6 | import java.io.Serializable; |
|---|
| .. | .. |
|---|
| 21 | 24 | import com.fasterxml.jackson.annotation.JsonProperty; |
|---|
| 22 | 25 | |
|---|
| 23 | 26 | /** |
|---|
| 24 | | - * Entity implementation class for Entity: license |
|---|
| 25 | | - * |
|---|
| 26 | | - */ |
|---|
| 27 | +* LicenseHistory |
|---|
| 28 | +* <p> |
|---|
| 29 | +* Audit trail entries for a given license (who/what/when). |
|---|
| 30 | +* |
|---|
| 31 | +* Mapping details: |
|---|
| 32 | +* - Table: license_history |
|---|
| 33 | +* - Many-to-one to License and User (ignored in JSON). |
|---|
| 34 | +* - NamedQuery: list-license-history by license id. |
|---|
| 35 | +* |
|---|
| 36 | +* @author JRA |
|---|
| 37 | +* Last reviewed by JRA on Oct 5, 2025. |
|---|
| 38 | +*/ |
|---|
| 27 | 39 | @JsonAutoDetect |
|---|
| 28 | 40 | @JsonInclude(Include.NON_NULL) |
|---|
| 29 | 41 | @Entity |
|---|
| 30 | 42 | @Table(name = "license_history") |
|---|
| 31 | 43 | @JsonIgnoreProperties(ignoreUnknown = true) |
|---|
| 32 | 44 | @NamedQueries({ |
|---|
| 33 | | - @NamedQuery(name = "list-license-history", query = "SELECT lh FROM LicenseHistory lh where lh.license.id = :licId") |
|---|
| 45 | + @NamedQuery(name = "list-license-history", |
|---|
| 46 | + query = "SELECT lh FROM LicenseHistory lh where lh.license.id = :licId") |
|---|
| 34 | 47 | }) |
|---|
| 35 | 48 | public class LicenseHistory implements Serializable { |
|---|
| 36 | 49 | |
|---|
| .. | .. |
|---|
| 57 | 70 | @JsonProperty("creation_timestamp") |
|---|
| 58 | 71 | private Date creationTimestamp; |
|---|
| 59 | 72 | |
|---|
| 60 | | - public int getId() { |
|---|
| 61 | | - return id; |
|---|
| 62 | | - } |
|---|
| 73 | + // ---------------- Getters & setters ---------------- |
|---|
| 63 | 74 | |
|---|
| 64 | | - public License getLicense() { |
|---|
| 65 | | - return license; |
|---|
| 66 | | - } |
|---|
| 75 | + /** |
|---|
| 76 | + * getId<p> |
|---|
| 77 | + * Return primary key. |
|---|
| 78 | + * |
|---|
| 79 | + * @return id |
|---|
| 80 | + */ |
|---|
| 81 | + public int getId() { return id; } |
|---|
| 67 | 82 | |
|---|
| 68 | | - public void setLicense(License license) { |
|---|
| 69 | | - this.license = license; |
|---|
| 70 | | - } |
|---|
| 83 | + /** |
|---|
| 84 | + * getLicense<p> |
|---|
| 85 | + * Return parent license (entity). |
|---|
| 86 | + * |
|---|
| 87 | + * @return license |
|---|
| 88 | + */ |
|---|
| 89 | + public License getLicense() { return license; } |
|---|
| 71 | 90 | |
|---|
| 72 | | - public User getUser() { |
|---|
| 73 | | - return user; |
|---|
| 74 | | - } |
|---|
| 91 | + /** |
|---|
| 92 | + * setLicense<p> |
|---|
| 93 | + * Set parent license (entity). |
|---|
| 94 | + * |
|---|
| 95 | + * @return license |
|---|
| 96 | + */ |
|---|
| 97 | + public void setLicense(License license) { this.license = license; } |
|---|
| 75 | 98 | |
|---|
| 99 | + /** |
|---|
| 100 | + * getUser<p> |
|---|
| 101 | + * Return actor user (entity). |
|---|
| 102 | + * |
|---|
| 103 | + * @return user |
|---|
| 104 | + */ |
|---|
| 105 | + public User getUser() { return user; } |
|---|
| 106 | + |
|---|
| 107 | + /** |
|---|
| 108 | + * getUsername<p> |
|---|
| 109 | + * Expose username for JSON. |
|---|
| 110 | + * |
|---|
| 111 | + * @return username |
|---|
| 112 | + */ |
|---|
| 76 | 113 | @JsonProperty("username") |
|---|
| 77 | | - public String getUsername() { |
|---|
| 78 | | - return user == null ? null : user.getUsername(); |
|---|
| 79 | | - } |
|---|
| 114 | + public String getUsername() { return user == null ? null : user.getUsername(); } |
|---|
| 80 | 115 | |
|---|
| 81 | | - public void setUser(User user) { |
|---|
| 82 | | - this.user = user; |
|---|
| 83 | | - } |
|---|
| 116 | + /** |
|---|
| 117 | + * setUser<p> |
|---|
| 118 | + * Set actor user (entity). |
|---|
| 119 | + * |
|---|
| 120 | + * @param user |
|---|
| 121 | + */ |
|---|
| 122 | + public void setUser(User user) { this.user = user; } |
|---|
| 84 | 123 | |
|---|
| 85 | | - public String getAction() { |
|---|
| 86 | | - return action; |
|---|
| 87 | | - } |
|---|
| 124 | + /** |
|---|
| 125 | + * getAction<p> |
|---|
| 126 | + * Return action key (e.g., "activate"). |
|---|
| 127 | + * |
|---|
| 128 | + * @return action |
|---|
| 129 | + */ |
|---|
| 130 | + public String getAction() { return action; } |
|---|
| 88 | 131 | |
|---|
| 89 | | - public void setAction(String action) { |
|---|
| 90 | | - this.action = action; |
|---|
| 91 | | - } |
|---|
| 132 | + /** |
|---|
| 133 | + * setAction<p> |
|---|
| 134 | + * Set action key. |
|---|
| 135 | + * |
|---|
| 136 | + * @param action |
|---|
| 137 | + */ |
|---|
| 138 | + public void setAction(String action) { this.action = action; } |
|---|
| 92 | 139 | |
|---|
| 93 | | - public String getComments() { |
|---|
| 94 | | - return comments; |
|---|
| 95 | | - } |
|---|
| 140 | + /** |
|---|
| 141 | + * getComments<p> |
|---|
| 142 | + * Return optional comments. |
|---|
| 143 | + * |
|---|
| 144 | + * @return comments |
|---|
| 145 | + */ |
|---|
| 146 | + public String getComments() { return comments; } |
|---|
| 96 | 147 | |
|---|
| 97 | | - public void setComments(String comments) { |
|---|
| 98 | | - this.comments = comments; |
|---|
| 99 | | - } |
|---|
| 148 | + /** |
|---|
| 149 | + * setComments<p> |
|---|
| 150 | + * Set optional comments. |
|---|
| 151 | + * |
|---|
| 152 | + * @param comments |
|---|
| 153 | + */ |
|---|
| 154 | + public void setComments(String comments) { this.comments = comments; } |
|---|
| 100 | 155 | |
|---|
| 101 | | - public void setId(int id) { |
|---|
| 102 | | - this.id = id; |
|---|
| 103 | | - } |
|---|
| 156 | + /** |
|---|
| 157 | + * setId<p> |
|---|
| 158 | + * Set primary key (normally framework-managed) |
|---|
| 159 | + * |
|---|
| 160 | + * @param id. |
|---|
| 161 | + */ |
|---|
| 162 | + public void setId(int id) { this.id = id; } |
|---|
| 104 | 163 | |
|---|
| 105 | | - public Date getCreationTimestamp() { |
|---|
| 106 | | - return creationTimestamp; |
|---|
| 107 | | - } |
|---|
| 164 | + /** |
|---|
| 165 | + * getCreationTimestamp<p> |
|---|
| 166 | + * Return timestamp. |
|---|
| 167 | + * |
|---|
| 168 | + * @return creationTimestamp |
|---|
| 169 | + */ |
|---|
| 170 | + public Date getCreationTimestamp() { return creationTimestamp; } |
|---|
| 108 | 171 | |
|---|
| 109 | | - public void setCreationTimestamp(Date creationTimestamp) { |
|---|
| 110 | | - this.creationTimestamp = creationTimestamp; |
|---|
| 111 | | - } |
|---|
| 172 | + /** |
|---|
| 173 | + * setCreationTimestamp<p> |
|---|
| 174 | + * Set timestamp. |
|---|
| 175 | + * |
|---|
| 176 | + * @param creationTimestamp |
|---|
| 177 | + */ |
|---|
| 178 | + public void setCreationTimestamp(Date creationTimestamp) { this.creationTimestamp = creationTimestamp; } |
|---|
| 112 | 179 | |
|---|
| 180 | + /** |
|---|
| 181 | + * Actions<p> |
|---|
| 182 | + * Catalog of action names. |
|---|
| 183 | + */ |
|---|
| 113 | 184 | public static class Actions { |
|---|
| 114 | 185 | public static final String CREATE = "creation"; |
|---|
| 115 | 186 | public static final String ADD_REQUEST = "request"; |
|---|
| .. | .. |
|---|
| 125 | 196 | public static final String DELETE = "delete"; |
|---|
| 126 | 197 | } |
|---|
| 127 | 198 | } |
|---|
| 199 | + |
|---|