2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.onap.policy.rest.jpa;
24 import java.io.Serializable;
25 import java.util.Date;
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;
42 * The Entity class to persist a policy object configuration data
45 import com.fasterxml.jackson.annotation.JsonBackReference;
48 @Table(name="ConfigurationDataEntity")
50 @NamedQuery(name="ConfigurationDataEntity.findAll", query="SELECT e FROM ConfigurationDataEntity e "),
51 @NamedQuery(name="ConfigurationDataEntity.deleteAll", query="DELETE FROM ConfigurationDataEntity WHERE 1=1")
54 public class ConfigurationDataEntity implements Serializable {
55 private static final long serialVersionUID = 1L;
58 @GeneratedValue(strategy = GenerationType.AUTO)
59 @Column(name="configurationDataId")
61 private long configurationDataId;
63 @Column(name="configurationName", nullable=false, length=255)
64 private String configurationName = "";
67 @Column(name="version")
70 @Column(name="configType", nullable=false, length=255)
71 private String configType = "NoType";
74 @Column(name="configBody", nullable=false, columnDefinition="TEXT")
75 private String configBody = "NoBody";
77 @Column(name="created_by", nullable=false, length=255)
78 private String createdBy = "guest";
80 @Temporal(TemporalType.TIMESTAMP)
81 @Column(name="created_date", updatable=false)
82 private Date createdDate;
84 @Column(name="description", nullable=false, length=2048)
85 private String description = "NoDescription";
87 @Column(name="modified_by", nullable=false, length=255)
88 private String modifiedBy = "guest";
90 @Temporal(TemporalType.TIMESTAMP)
91 @Column(name="modified_date", nullable=false)
92 private Date modifiedDate;
94 @Column(name="deleted", nullable=false)
95 private boolean deleted = false;
97 public ConfigurationDataEntity() {
101 public void prePersist() {
102 Date date = new Date();
103 this.createdDate = date;
104 this.modifiedDate = date;
108 public void preUpdate() {
109 this.modifiedDate = new Date();
112 * @return the configurationDataId
114 public long getConfigurationDataId() {
115 return configurationDataId;
118 * @param configurationDataId the configurationDataId to set
120 public void setConfigurationName(String configurationName) {
121 this.configurationName = configurationName;
123 public String getConfigurationName(){
124 return this.configurationName;
127 * @return the configType
129 public String getConfigType() {
133 * @param configType the configType to set
135 public void setConfigType(String configType) {
136 this.configType = configType;
139 * @return the configBody
141 public String getConfigBody() {
145 * @param configBody the configBody to set
147 public void setConfigBody(String configBody) {
148 this.configBody = configBody;
151 * @return the createdBy
153 public String getCreatedBy() {
157 * @param createdBy the createdBy to set
159 public void setCreatedBy(String createdBy) {
160 this.createdBy = createdBy;
163 * @return the description
165 public String getDescription() {
169 * @param description the description to set
171 public void setDescription(String description) {
172 this.description = description;
175 * @return the modifiedBy
177 public String getModifiedBy() {
181 * @param modifiedBy the modifiedBy to set
183 public void setModifiedBy(String modifiedBy) {
184 this.modifiedBy = modifiedBy;
187 * @return the modifiedDate
189 public Date getModifiedDate() {
193 * @param modifiedDate the modifiedDate to set
195 public void setModifiedDate(Date modifiedDate) {
196 this.modifiedDate = modifiedDate;
199 * @return the version
201 public int getVersion() {
205 * @return the createdDate
207 public Date getCreatedDate() {
212 * @return the deleted
214 public boolean isDeleted() {
219 * @param deleted the deleted to set
221 public void setDeleted(boolean deleted) {
222 this.deleted = deleted;