| .. | .. |
|---|
| 8 | 8 | import javax.persistence.Column; |
|---|
| 9 | 9 | import javax.persistence.Entity; |
|---|
| 10 | 10 | import javax.persistence.FetchType; |
|---|
| 11 | +import javax.persistence.GeneratedValue; |
|---|
| 11 | 12 | import javax.persistence.Id; |
|---|
| 12 | 13 | import javax.persistence.JoinColumn; |
|---|
| 13 | 14 | import javax.persistence.ManyToOne; |
|---|
| .. | .. |
|---|
| 31 | 32 | @Table(name = "pack") |
|---|
| 32 | 33 | @NamedQueries( |
|---|
| 33 | 34 | { @NamedQuery(name = "list-packs", query = "SELECT pa FROM Pack pa"),// |
|---|
| 34 | | - @NamedQuery(name = "list-packs-by-org", query = "SELECT pa FROM Pack pa where pa.organization = :organization") }) |
|---|
| 35 | + @NamedQuery(name = "list-packs-by-orgs", query = "SELECT pa FROM Pack pa where pa.organization.id in :list_ids") }) |
|---|
| 35 | 36 | public class Pack implements Serializable { |
|---|
| 36 | 37 | |
|---|
| 37 | 38 | private static final long serialVersionUID = 1L; |
|---|
| 38 | 39 | |
|---|
| 39 | 40 | @Id |
|---|
| 41 | + @GeneratedValue |
|---|
| 40 | 42 | private int id; |
|---|
| 41 | 43 | |
|---|
| 42 | 44 | private String code; |
|---|
| 45 | + |
|---|
| 46 | + private String comments; |
|---|
| 43 | 47 | |
|---|
| 44 | 48 | @Column(name = "creation_timestamp") |
|---|
| 45 | 49 | private Date creationTimestamp; |
|---|
| .. | .. |
|---|
| 63 | 67 | @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "pack") |
|---|
| 64 | 68 | private Set<License> licenses; |
|---|
| 65 | 69 | |
|---|
| 66 | | - @JoinColumn(name = "num_licenses") |
|---|
| 70 | + @Column(name = "num_licenses") |
|---|
| 71 | + @JsonProperty("num_licenses") |
|---|
| 67 | 72 | private int numLicenses; |
|---|
| 68 | 73 | |
|---|
| 69 | 74 | public int getId() { |
|---|
| .. | .. |
|---|
| 190 | 195 | } |
|---|
| 191 | 196 | |
|---|
| 192 | 197 | @JsonProperty("license_type_id") |
|---|
| 198 | + public void setLicTypeId(Integer idLT) { |
|---|
| 199 | + if (idLT == null) { |
|---|
| 200 | + licenseType = null; |
|---|
| 201 | + } else { |
|---|
| 202 | + licenseType = new LicenseType(); |
|---|
| 203 | + licenseType.setId(idLT); |
|---|
| 204 | + } |
|---|
| 205 | + } |
|---|
| 206 | + |
|---|
| 207 | + @JsonProperty("license_type_id") |
|---|
| 193 | 208 | public Integer getLicTypeId() { |
|---|
| 194 | 209 | return licenseType == null ? null : licenseType.getId(); |
|---|
| 195 | 210 | } |
|---|
| .. | .. |
|---|
| 205 | 220 | createdBy.setUsername(username); |
|---|
| 206 | 221 | } |
|---|
| 207 | 222 | |
|---|
| 223 | + @JsonProperty("created_by_name") |
|---|
| 224 | + public String getCreatedByname() { |
|---|
| 225 | + return createdBy == null ? null : String.format("%s %s", createdBy.getFirstName(), createdBy.getFirstName()); |
|---|
| 226 | + } |
|---|
| 227 | + |
|---|
| 208 | 228 | @JsonProperty("licensetype_code") |
|---|
| 209 | 229 | public String getLicenseTypcode() { |
|---|
| 210 | 230 | return licenseType == null ? null : licenseType.getCode(); |
|---|
| 211 | 231 | } |
|---|
| 212 | 232 | |
|---|
| 233 | + public String getComments() { |
|---|
| 234 | + return comments; |
|---|
| 235 | + } |
|---|
| 236 | + |
|---|
| 237 | + public void setComments(String comments) { |
|---|
| 238 | + this.comments = comments; |
|---|
| 239 | + } |
|---|
| 240 | + |
|---|
| 213 | 241 | } |
|---|