[POLICY-73] replace openecomp for policy-engine
[policy/engine.git] / ONAP-REST / src / main / java / org / onap / policy / rest / jpa / ConfigurationDataEntity.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP-REST
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.policy.rest.jpa;
22 /*
23  */
24 import java.io.Serializable;
25 import java.util.Date;
26
27 import javax.persistence.Column;
28 import javax.persistence.Entity;
29 import javax.persistence.GeneratedValue;
30 import javax.persistence.GenerationType;
31 import javax.persistence.Id;
32 import javax.persistence.Lob;
33 import javax.persistence.NamedQueries;
34 import javax.persistence.NamedQuery;
35 import javax.persistence.PrePersist;
36 import javax.persistence.PreUpdate;
37 import javax.persistence.Table;
38 import javax.persistence.Temporal;
39 import javax.persistence.TemporalType;
40 import javax.persistence.Version;
41 /*
42  * The Entity class to persist a policy object configuration data
43  */
44
45 import com.fasterxml.jackson.annotation.JsonBackReference;
46
47 @Entity
48 @Table(name="ConfigurationDataEntity")
49 @NamedQueries({
50         @NamedQuery(name="ConfigurationDataEntity.findAll", query="SELECT e FROM ConfigurationDataEntity e "),
51         @NamedQuery(name="ConfigurationDataEntity.deleteAll", query="DELETE FROM ConfigurationDataEntity WHERE 1=1")
52 })
53
54 public class ConfigurationDataEntity implements Serializable {
55         private static final long serialVersionUID = 1L;
56
57         @Id
58         @GeneratedValue(strategy = GenerationType.AUTO)
59         @Column(name="configurationDataId")
60         @JsonBackReference
61         private long configurationDataId;
62         
63         @Column(name="configurationName", nullable=false, length=255)
64         private String configurationName = "";
65         
66         @Version 
67         @Column(name="version")
68         private int version;
69         
70         @Column(name="configType", nullable=false, length=255)
71         private String configType = "NoType";
72         
73         @Lob
74         @Column(name="configBody", nullable=false, columnDefinition="TEXT")
75         private String configBody = "NoBody";
76         
77         @Column(name="created_by", nullable=false, length=255)
78         private String createdBy = "guest";
79
80         @Temporal(TemporalType.TIMESTAMP)
81         @Column(name="created_date", updatable=false)
82         private Date createdDate;
83
84         @Column(name="description", nullable=false, length=2048)
85         private String description = "NoDescription";
86
87         @Column(name="modified_by", nullable=false, length=255)
88         private String modifiedBy = "guest";
89
90         @Temporal(TemporalType.TIMESTAMP)
91         @Column(name="modified_date", nullable=false)
92         private Date modifiedDate;
93         
94         @Column(name="deleted", nullable=false)
95         private boolean deleted = false;
96
97         public ConfigurationDataEntity() {
98         }
99
100         @PrePersist
101         public void     prePersist() {
102                 Date date = new Date();
103                 this.createdDate = date;
104                 this.modifiedDate = date;
105         }
106
107         @PreUpdate
108         public void preUpdate() {
109                 this.modifiedDate = new Date();
110         }
111         /**
112          * @return the configurationDataId
113          */
114         public long getConfigurationDataId() {
115                 return configurationDataId;
116         }
117         /**
118          * @param configurationDataId the configurationDataId to set
119          */
120         public void setConfigurationName(String configurationName) {
121                 this.configurationName = configurationName;
122         }
123         public String getConfigurationName(){
124                 return this.configurationName;
125         }
126         /**
127          * @return the configType
128          */
129         public String getConfigType() {
130                 return configType;
131         }
132         /**
133          * @param configType the configType to set
134          */
135         public void setConfigType(String configType) {
136                 this.configType = configType;
137         }
138         /**
139          * @return the configBody
140          */
141         public String getConfigBody() {
142                 return configBody;
143         }
144         /**
145          * @param configBody the configBody to set
146          */
147         public void setConfigBody(String configBody) {
148                 this.configBody = configBody;
149         }
150         /**
151          * @return the createdBy
152          */
153         public String getCreatedBy() {
154                 return createdBy;
155         }
156         /**
157          * @param createdBy the createdBy to set
158          */
159         public void setCreatedBy(String createdBy) {
160                 this.createdBy = createdBy;
161         }
162         /**
163          * @return the description
164          */
165         public String getDescription() {
166                 return description;
167         }
168         /**
169          * @param description the description to set
170          */
171         public void setDescription(String description) {
172                 this.description = description;
173         }
174         /**
175          * @return the modifiedBy
176          */
177         public String getModifiedBy() {
178                 return modifiedBy;
179         }
180         /**
181          * @param modifiedBy the modifiedBy to set
182          */
183         public void setModifiedBy(String modifiedBy) {
184                 this.modifiedBy = modifiedBy;
185         }
186         /**
187          * @return the modifiedDate
188          */
189         public Date getModifiedDate() {
190                 return modifiedDate;
191         }
192         /**
193          * @param modifiedDate the modifiedDate to set
194          */
195         public void setModifiedDate(Date modifiedDate) {
196                 this.modifiedDate = modifiedDate;
197         }
198         /**
199          * @return the version
200          */
201         public int getVersion() {
202                 return version;
203         }
204         /**
205          * @return the createdDate
206          */
207         public Date getCreatedDate() {
208                 return createdDate;
209         }
210
211         /**
212          * @return the deleted
213          */
214         public boolean isDeleted() {
215                 return deleted;
216         }
217
218         /**
219          * @param deleted the deleted to set
220          */
221         public void setDeleted(boolean deleted) {
222                 this.deleted = deleted;
223         }
224 }