2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * Modifications Copyright (C) 2019 Nordix Foundation.
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.onap.policy.rest.jpa;
24 import com.fasterxml.jackson.annotation.JsonBackReference;
28 import java.io.Serializable;
29 import java.util.Date;
31 import javax.persistence.Column;
32 import javax.persistence.Entity;
33 import javax.persistence.GeneratedValue;
34 import javax.persistence.GenerationType;
35 import javax.persistence.Id;
36 import javax.persistence.Lob;
37 import javax.persistence.NamedQueries;
38 import javax.persistence.NamedQuery;
39 import javax.persistence.PrePersist;
40 import javax.persistence.PreUpdate;
41 import javax.persistence.Table;
42 import javax.persistence.Temporal;
43 import javax.persistence.TemporalType;
44 import javax.persistence.Version;
46 * The Entity class to persist a policy object configuration data
49 import lombok.EqualsAndHashCode;
52 * The Class ConfigurationDataEntity.
56 @Table(name = "ConfigurationDataEntity")
59 @NamedQuery(name = "ConfigurationDataEntity.findAll", query = "SELECT e FROM ConfigurationDataEntity e "),
60 @NamedQuery(name = "ConfigurationDataEntity.deleteAll", query = "DELETE FROM ConfigurationDataEntity WHERE 1=1")
66 public class ConfigurationDataEntity implements Serializable {
67 private static final long serialVersionUID = 1L;
70 @GeneratedValue(strategy = GenerationType.AUTO)
71 @Column(name = "configurationDataId")
73 private long configurationDataId;
75 @Column(name = "configurationName", nullable = false, length = 255)
76 private String configurationName = "";
79 @Column(name = "version")
82 @Column(name = "configType", nullable = false, length = 255)
83 private String configType = "NoType";
86 @Column(name = "configBody", nullable = false, columnDefinition = "TEXT")
87 private String configBody = "NoBody";
89 @Column(name = "created_by", nullable = false, length = 255)
90 private String createdBy = "guest";
92 @Temporal(TemporalType.TIMESTAMP)
93 @Column(name = "created_date", updatable = false)
94 private Date createdDate;
96 @Column(name = "description", nullable = false, length = 2048)
97 private String description = "NoDescription";
99 @Column(name = "modified_by", nullable = false, length = 255)
100 private String modifiedBy = "guest";
102 @Temporal(TemporalType.TIMESTAMP)
103 @Column(name = "modified_date", nullable = false)
104 private Date modifiedDate;
106 @Column(name = "deleted", nullable = false)
107 private boolean deleted = false;
110 * Instantiates a new configuration data entity.
112 public ConfigurationDataEntity() {
113 // An empty constructor
120 public void prePersist() {
121 Date date = new Date();
122 this.createdDate = date;
123 this.modifiedDate = date;
130 public void preUpdate() {
131 this.modifiedDate = new Date();
135 * Gets the configuration data id.
137 * @return the configurationDataId
139 public long getConfigurationDataId() {
140 return configurationDataId;
144 * Sets the configuration name.
146 * @param configurationName the new configuration name
148 public void setConfigurationName(String configurationName) {
149 this.configurationName = configurationName;
153 * Gets the configuration name.
155 * @return the configuration name
157 public String getConfigurationName() {
158 return this.configurationName;
162 * Gets the config type.
164 * @return the configType
166 public String getConfigType() {
171 * Sets the config type.
173 * @param configType the configType to set
175 public void setConfigType(String configType) {
176 this.configType = configType;
180 * Gets the config body.
182 * @return the configBody
184 public String getConfigBody() {
189 * Sets the config body.
191 * @param configBody the configBody to set
193 public void setConfigBody(String configBody) {
194 this.configBody = configBody;
198 * Gets the created by.
200 * @return the createdBy
202 public String getCreatedBy() {
207 * Sets the created by.
209 * @param createdBy the createdBy to set
211 public void setCreatedBy(String createdBy) {
212 this.createdBy = createdBy;
216 * Gets the description.
218 * @return the description
220 public String getDescription() {
225 * Sets the description.
227 * @param description the description to set
229 public void setDescription(String description) {
230 this.description = description;
234 * Gets the modified by.
236 * @return the modifiedBy
238 public String getModifiedBy() {
243 * Sets the modified by.
245 * @param modifiedBy the modifiedBy to set
247 public void setModifiedBy(String modifiedBy) {
248 this.modifiedBy = modifiedBy;
252 * Gets the modified date.
254 * @return the modifiedDate
256 public Date getModifiedDate() {
261 * Sets the modified date.
263 * @param modifiedDate the modifiedDate to set
265 public void setModifiedDate(Date modifiedDate) {
266 this.modifiedDate = modifiedDate;
272 * @return the version
274 public int getVersion() {
279 * Gets the created date.
281 * @return the createdDate
283 public Date getCreatedDate() {
288 * Checks if is deleted.
290 * @return the deleted
292 public boolean isDeleted() {
299 * @param deleted the deleted to set
301 public void setDeleted(boolean deleted) {
302 this.deleted = deleted;