rsanchez
2014-12-01 85e2a65874fcd41771b30ebfff93f86edd4f32b3
securis/src/main/java/net/curisit/securis/db/License.java
....@@ -55,6 +55,8 @@
5555 @Table(name = "license")
5656 @JsonIgnoreProperties(ignoreUnknown = true)
5757 @NamedQueries({
58
+ @NamedQuery(name = "license-by-code", query = "SELECT l FROM License l where l.code = :code"),
59
+ @NamedQuery(name = "last-code-suffix-used-in-pack", query = "SELECT max(l.codeSuffix) FROM License l where l.pack.id = :packId"),
5860 @NamedQuery(name = "list-licenses-by-pack", query = "SELECT l FROM License l where l.pack.id = :packId"),
5961 @NamedQuery(name = "list-licenses-by-req-data", query = "SELECT l FROM License l where l.reqDataHash = :hash"),
6062 @NamedQuery(name = "list-active-licenses-by-req-data", query = "SELECT l FROM License l where l.reqDataHash = :hash and l.status in ('AC', 'PA')")
....@@ -70,6 +72,10 @@
7072 private int id;
7173
7274 private String code;
75
+
76
+ @Column(name = "code_suffix")
77
+ @JsonProperty("code_suffix")
78
+ private Integer codeSuffix;
7379
7480 @JsonIgnore
7581 @ManyToOne
....@@ -372,4 +378,12 @@
372378 }
373379 }
374380
381
+ public Integer getCodeSuffix() {
382
+ return codeSuffix;
383
+ }
384
+
385
+ public void setCodeSuffix(Integer codeSuffix) {
386
+ this.codeSuffix = codeSuffix;
387
+ }
388
+
375389 }