rsanchez
2014-10-14 fb1b6755a9ecd43601dc4fbef9166d11d8a86f24
securis/src/main/java/net/curisit/securis/db/ApplicationMetadata.java
....@@ -2,21 +2,16 @@
22
33 import java.io.Serializable;
44 import java.util.Date;
5
-import java.util.Set;
65
76 import javax.persistence.Column;
87 import javax.persistence.Entity;
9
-import javax.persistence.FetchType;
108 import javax.persistence.GeneratedValue;
119 import javax.persistence.Id;
1210 import javax.persistence.JoinColumn;
1311 import javax.persistence.ManyToOne;
1412 import javax.persistence.NamedQueries;
1513 import javax.persistence.NamedQuery;
16
-import javax.persistence.OneToMany;
1714 import javax.persistence.Table;
18
-
19
-import net.curisit.securis.beans.MetadataType;
2015
2116 import org.codehaus.jackson.annotate.JsonAutoDetect;
2217 import org.codehaus.jackson.annotate.JsonIgnore;
....@@ -38,31 +33,22 @@
3833
3934 private static final long serialVersionUID = 1L;
4035
41
- @Id
42
- @GeneratedValue
43
- private int id;
44
-
45
- private String key;
46
-
47
- private String description;
48
-
49
- private MetadataType dataType;
50
-
5136 @JsonIgnore
37
+ @Id
5238 @ManyToOne
5339 @JoinColumn(name = "application_id")
5440 private Application application;
5541
42
+ @Id
43
+ private String key;
44
+
45
+ private String value;
46
+
47
+ private boolean mandatory;
48
+
5649 @Column(name = "creation_timestamp")
5750 private Date creationTimestamp;
5851
59
- public int getId() {
60
- return id;
61
- }
62
-
63
- public void setId(int id) {
64
- this.id = id;
65
- }
6652
6753 public String getKey() {
6854 return key;
....@@ -70,22 +56,6 @@
7056
7157 public void setKey(String key) {
7258 this.key = key;
73
- }
74
-
75
- public String getDescription() {
76
- return description;
77
- }
78
-
79
- public void setDescription(String description) {
80
- this.description = description;
81
- }
82
-
83
- public MetadataType getDataType() {
84
- return dataType;
85
- }
86
-
87
- public void setDataType(MetadataType dataType) {
88
- this.dataType = dataType;
8959 }
9060
9161 public Application getApplication() {
....@@ -120,4 +90,34 @@
12090 }
12191 }
12292
93
+ public String getValue() {
94
+ return value;
95
+ }
96
+
97
+ public void setValue(String value) {
98
+ this.value = value;
99
+ }
100
+
101
+ public boolean isMandatory() {
102
+ return mandatory;
103
+ }
104
+
105
+ public void setMandatory(boolean mandatory) {
106
+ this.mandatory = mandatory;
107
+ }
108
+
109
+ @Override
110
+ public boolean equals(Object obj) {
111
+ if (!(obj instanceof ApplicationMetadata))
112
+ return false;
113
+ ApplicationMetadata other = (ApplicationMetadata)obj;
114
+ return key.equals(other.key) && (application == null || application.equals(other.application));
115
+ }
116
+
117
+ @Override
118
+ public int hashCode() {
119
+
120
+ return key.hashCode() + (application == null ? 0 : application.hashCode());
121
+ }
122
+
123123 }