rsanchez
2014-10-17 5805f0a08e69de728bd891d1c09ff32fc297977a
#2021 feature - Added changes on Pack management (in Beta) 
1 files added
10 files modified
changed files
securis/src/main/java/net/curisit/securis/db/Application.java patch | view | blame | history
securis/src/main/java/net/curisit/securis/db/License.java patch | view | blame | history
securis/src/main/java/net/curisit/securis/db/LicenseType.java patch | view | blame | history
securis/src/main/java/net/curisit/securis/db/Organization.java patch | view | blame | history
securis/src/main/java/net/curisit/securis/db/Pack.java patch | view | blame | history
securis/src/main/java/net/curisit/securis/db/PackStatus.java patch | view | blame | history
securis/src/main/java/net/curisit/securis/db/User.java patch | view | blame | history
securis/src/main/resources/db/schema.sql patch | view | blame | history
securis/src/main/resources/static/js/catalogs.json patch | view | blame | history
securis/src/main/resources/static/js/licenses.js patch | view | blame | history
securis/src/main/resources/static/licenses.html patch | view | blame | history
securis/src/main/java/net/curisit/securis/db/Application.java
....@@ -42,7 +42,12 @@
4242 private String name;
4343 private String description;
4444
45
+ @Column(name = "license_filename")
46
+ @JsonProperty("license_filename")
47
+ private String licenseFilename;
48
+
4549 @Column(name = "creation_timestamp")
50
+ @JsonProperty("creation_timestamp")
4651 private Date creationTimestamp;
4752
4853 @JsonIgnore
....@@ -54,11 +59,11 @@
5459 @OneToMany(fetch = FetchType.LAZY, mappedBy = "application")
5560 private Set<ApplicationMetadata> metadata;
5661
57
- public int getId() {
62
+ public Integer getId() {
5863 return id;
5964 }
6065
61
- public void setId(int id) {
66
+ public void setId(Integer id) {
6267 this.id = id;
6368 }
6469
....@@ -117,4 +122,12 @@
117122
118123 return (id == null ? 0 : id.hashCode());
119124 }
125
+
126
+ public String getLicenseFilename() {
127
+ return licenseFilename;
128
+ }
129
+
130
+ public void setLicenseFilename(String licenseFilename) {
131
+ this.licenseFilename = licenseFilename;
132
+ }
120133 }
securis/src/main/java/net/curisit/securis/db/License.java
....@@ -80,15 +80,19 @@
8080 private String licenseData;
8181
8282 @Column(name = "creation_timestamp")
83
+ @JsonProperty("creation_timestamp")
8384 private Date creationTimestamp;
8485
8586 @Column(name = "modification_timestamp")
87
+ @JsonProperty("modification_timestamp")
8688 private Date modificationTimestamp;
8789
8890 @Column(name = "last_access_timestamp")
91
+ @JsonProperty("last_access_timestamp")
8992 private Date lastAccessTimestamp;
9093
9194 @Column(name = "expiration_date")
95
+ @JsonProperty("expiration_date")
9296 private Date expirationDate;
9397
9498 private String comments;
securis/src/main/java/net/curisit/securis/db/LicenseType.java
....@@ -52,6 +52,7 @@
5252 private String description;
5353
5454 @Column(name = "creation_timestamp")
55
+ @JsonProperty("creation_timestamp")
5556 private Date creationTimestamp;
5657
5758 @JsonIgnore
....@@ -70,7 +71,7 @@
7071 this.metadata = metadata;
7172 }
7273
73
- public int getId() {
74
+ public Integer getId() {
7475 return id;
7576 }
7677
securis/src/main/java/net/curisit/securis/db/Organization.java
....@@ -50,13 +50,14 @@
5050
5151 @Id
5252 @GeneratedValue
53
- private int id;
53
+ private Integer id;
5454
5555 private String code;
5656 private String name;
5757 private String description;
5858
5959 @Column(name = "creation_timestamp")
60
+ @JsonProperty("creation_timestamp")
6061 private Date creationTimestamp;
6162
6263 @JsonIgnore
....@@ -82,11 +83,11 @@
8283 @OneToMany(fetch = FetchType.LAZY, mappedBy = "parentOrganization")
8384 private Set<Organization> childOrganizations;
8485
85
- public int getId() {
86
+ public Integer getId() {
8687 return id;
8788 }
8889
89
- public void setId(int id) {
90
+ public void setId(Integer id) {
9091 this.id = id;
9192 }
9293
securis/src/main/java/net/curisit/securis/db/Pack.java
....@@ -49,6 +49,7 @@
4949 private String comments;
5050
5151 @Column(name = "creation_timestamp")
52
+ @JsonProperty("creation_timestamp")
5253 private Date creationTimestamp;
5354
5455 @JsonIgnore
....@@ -82,7 +83,7 @@
8283 @JsonProperty("end_valid_date")
8384 private Date endValidDate;
8485
85
- private String status;
86
+ private PackStatus status;
8687
8788 @Column(name = "license_preactivation")
8889 @JsonProperty("license_preactivation")
....@@ -91,11 +92,11 @@
9192 @OneToMany(fetch = FetchType.LAZY, mappedBy = "pack")
9293 private Set<PackMetadata> metadata;
9394
94
- public int getId() {
95
+ public Integer getId() {
9596 return id;
9697 }
9798
98
- public void setId(int id) {
99
+ public void setId(Integer id) {
99100 this.id = id;
100101 }
101102
....@@ -281,11 +282,11 @@
281282 this.metadata = metadata;
282283 }
283284
284
- public String getStatus() {
285
+ public PackStatus getStatus() {
285286 return status;
286287 }
287288
288
- public void setStatus(String status) {
289
+ public void setStatus(PackStatus status) {
289290 this.status = status;
290291 }
291292
securis/src/main/java/net/curisit/securis/db/PackStatus.java
....@@ -0,0 +1,24 @@
1
+package net.curisit.securis.db;
2
+
3
+import org.codehaus.jackson.annotate.JsonCreator;
4
+
5
+public enum PackStatus {
6
+ PENDING("PE"), ACTIVE("AC"), ON_HOLD("OH"), EXPIRED("EX"), CANCELLED("CA");
7
+
8
+ private final String code;
9
+ PackStatus(String code ) {
10
+ this.code = code;
11
+ }
12
+ public String getCode() {
13
+ return code;
14
+ }
15
+
16
+ @JsonCreator
17
+ public static PackStatus valueFromCode(String code) {
18
+ for (PackStatus ps : PackStatus.values()) {
19
+ if (ps.code.equals(code)) return ps;
20
+ }
21
+ return null;
22
+ }
23
+
24
+}
securis/src/main/java/net/curisit/securis/db/User.java
....@@ -62,6 +62,7 @@
6262 private Date modificationTimestamp;
6363
6464 @Column(name = "creation_timestamp")
65
+ @JsonProperty("creation_timestamp")
6566 private Date creationTimestamp;
6667
6768 private String lang;
securis/src/main/resources/db/schema.sql
....@@ -22,6 +22,7 @@
2222 CREATE TABLE IF NOT EXISTS application (
2323 id INT NOT NULL auto_increment,
2424 name VARCHAR(45) NOT NULL ,
25
+ license_filename VARCHAR(100) NOT NULL ,
2526 description VARCHAR(500) NULL ,
2627 creation_timestamp DATETIME NULL ,
2728 PRIMARY KEY (id));
securis/src/main/resources/static/js/catalogs.json
....@@ -22,7 +22,13 @@
2222 "maxlength" : 500,
2323 "multiline" : 2
2424 }, {
25
- "name" : "creationTimestamp",
25
+ "name" : "license_filename",
26
+ "display" : "License filename",
27
+ "type" : "string",
28
+ "maxlength" : 100,
29
+ "mandatory" : true
30
+ }, {
31
+ "name" : "creation_timestamp",
2632 "display" : "Creation date",
2733 "autogenerate" : true,
2834 "type" : "date",
....@@ -70,7 +76,7 @@
7076 "type" : "select",
7177 "onchange": "updateMetadata"
7278 }, {
73
- "name" : "creationTimestamp",
79
+ "name" : "creation_timestamp",
7480 "display" : "Creation date",
7581 "autogenerate" : true,
7682 "type" : "date",
....@@ -125,7 +131,7 @@
125131 "resource" : "user",
126132 "type" : "multiselect"
127133 }, {
128
- "name" : "creationTimestamp",
134
+ "name" : "creation_timestamp",
129135 "display" : "Creation date",
130136 "autogenerate" : true,
131137 "type" : "date",
....@@ -181,7 +187,7 @@
181187 "type" : "date",
182188 "readOnly" : true
183189 }, {
184
- "name" : "creationTimestamp",
190
+ "name" : "creation_timestamp",
185191 "display" : "Creation date",
186192 "autogenerate" : true,
187193 "type" : "date",
securis/src/main/resources/static/js/licenses.js
....@@ -112,6 +112,9 @@
112112 $scope.mandatory = {
113113 code: true,
114114 num_licenses: true,
115
+ init_valid_date: true,
116
+ end_valid_date: true,
117
+ status: true,
115118 organization_id: true,
116119 license_type_id: true
117120 }
securis/src/main/resources/static/licenses.html
....@@ -198,7 +198,7 @@
198198 <label i18n class="col-md-3 control-label">Creation date</label>
199199 <div class="col-md-8">
200200 <p class="form-control-static"
201
- ng-bind="pack.creationTimestamp | date:'medium'"></p>
201
+ ng-bind="pack.creation_timestamp | date:'medium'"></p>
202202 </div>
203203 </div>
204204
....@@ -476,7 +476,7 @@
476476 <label class="col-md-3 control-label" i18n>Creation date</label>
477477 <div class="col-md-8">
478478 <p class="form-control-static"
479
- ng-bind="license.creationTimestamp | date:'medium'"></p>
479
+ ng-bind="license.creation_timestamp | date:'medium'"></p>
480480 </div>
481481 </div>
482482