From 85e2a65874fcd41771b30ebfff93f86edd4f32b3 Mon Sep 17 00:00:00 2001
From: rsanchez <rsanchez@curisit.net>
Date: Mon, 01 Dec 2014 14:59:34 +0000
Subject: [PATCH] #396 fix - Added automated license code generation and other minor fixes

---
 securis/src/main/java/net/curisit/securis/db/License.java |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/securis/src/main/java/net/curisit/securis/db/License.java b/securis/src/main/java/net/curisit/securis/db/License.java
index de6973b..b8ce30f 100644
--- a/securis/src/main/java/net/curisit/securis/db/License.java
+++ b/securis/src/main/java/net/curisit/securis/db/License.java
@@ -55,6 +55,8 @@
 @Table(name = "license")
 @JsonIgnoreProperties(ignoreUnknown = true)
 @NamedQueries({
+        @NamedQuery(name = "license-by-code", query = "SELECT l FROM License l where l.code = :code"),
+        @NamedQuery(name = "last-code-suffix-used-in-pack", query = "SELECT max(l.codeSuffix) FROM License l where l.pack.id = :packId"),
         @NamedQuery(name = "list-licenses-by-pack", query = "SELECT l FROM License l where l.pack.id = :packId"),
         @NamedQuery(name = "list-licenses-by-req-data", query = "SELECT l FROM License l where l.reqDataHash = :hash"),
         @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 @@
     private int id;
 
     private String code;
+
+    @Column(name = "code_suffix")
+    @JsonProperty("code_suffix")
+    private Integer codeSuffix;
 
     @JsonIgnore
     @ManyToOne
@@ -372,4 +378,12 @@
         }
     }
 
+    public Integer getCodeSuffix() {
+        return codeSuffix;
+    }
+
+    public void setCodeSuffix(Integer codeSuffix) {
+        this.codeSuffix = codeSuffix;
+    }
+
 }

--
Gitblit v1.3.2