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.openecomp.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.SequenceGenerator;
38 import javax.persistence.Table;
39 import javax.persistence.Temporal;
40 import javax.persistence.TemporalType;
41 import javax.persistence.Version;
43 * The Entity class to persist a policy object configuration data
46 import com.fasterxml.jackson.annotation.JsonBackReference;
49 @Table(name="ConfigurationDataEntity")
51 @NamedQuery(name="ConfigurationDataEntity.findAll", query="SELECT e FROM ConfigurationDataEntity e "),
52 @NamedQuery(name="ConfigurationDataEntity.deleteAll", query="DELETE FROM ConfigurationDataEntity WHERE 1=1")
54 //@SequenceGenerator(name="seqConfig", initialValue=1, allocationSize=1)
56 public class ConfigurationDataEntity implements Serializable {
57 private static final long serialVersionUID = 1L;
60 //@GeneratedValue(strategy = GenerationType.SEQUENCE, generator="seqConfig")
61 @GeneratedValue(strategy = GenerationType.AUTO)
62 @Column(name="configurationDataId")
64 private long configurationDataId;
66 @Column(name="configurationName", nullable=false, length=255)
67 private String configurationName = "";
70 @Column(name="version")
73 @Column(name="configType", nullable=false, length=255)
74 private String configType = "NoType";
77 @Column(name="configBody", nullable=false, columnDefinition="TEXT")
78 private String configBody = "NoBody";
80 @Column(name="created_by", nullable=false, length=255)
81 private String createdBy = "guest";
83 @Temporal(TemporalType.TIMESTAMP)
84 @Column(name="created_date", updatable=false)
85 private Date createdDate;
87 @Column(name="description", nullable=false, length=2048)
88 private String description = "NoDescription";
90 @Column(name="modified_by", nullable=false, length=255)
91 private String modifiedBy = "guest";
93 @Temporal(TemporalType.TIMESTAMP)
94 @Column(name="modified_date", nullable=false)
95 private Date modifiedDate;
97 @Column(name="deleted", nullable=false)
98 private boolean deleted = false;
100 public ConfigurationDataEntity() {
104 public void prePersist() {
105 Date date = new Date();
106 this.createdDate = date;
107 this.modifiedDate = date;
111 public void preUpdate() {
112 this.modifiedDate = new Date();
115 * @return the configurationDataId
117 public long getConfigurationDataId() {
118 return configurationDataId;
121 * @param configurationDataId the configurationDataId to set
123 public void setConfigurationName(String configurationName) {
124 this.configurationName = configurationName;
126 public String getConfigurationName(){
127 return this.configurationName;
130 * @return the configType
132 public String getConfigType() {
136 * @param configType the configType to set
138 public void setConfigType(String configType) {
139 this.configType = configType;
142 * @return the configBody
144 public String getConfigBody() {
148 * @param configBody the configBody to set
150 public void setConfigBody(String configBody) {
151 this.configBody = configBody;
154 * @return the createdBy
156 public String getCreatedBy() {
160 * @param createdBy the createdBy to set
162 public void setCreatedBy(String createdBy) {
163 this.createdBy = createdBy;
166 * @return the description
168 public String getDescription() {
172 * @param description the description to set
174 public void setDescription(String description) {
175 this.description = description;
178 * @return the modifiedBy
180 public String getModifiedBy() {
184 * @param modifiedBy the modifiedBy to set
186 public void setModifiedBy(String modifiedBy) {
187 this.modifiedBy = modifiedBy;
190 * @return the modifiedDate
192 public Date getModifiedDate() {
196 * @param modifiedDate the modifiedDate to set
198 public void setModifiedDate(Date modifiedDate) {
199 this.modifiedDate = modifiedDate;
202 * @return the version
204 public int getVersion() {
208 * @return the createdDate
210 public Date getCreatedDate() {
215 * @return the deleted
217 public boolean isDeleted() {
222 * @param deleted the deleted to set
224 public void setDeleted(boolean deleted) {
225 this.deleted = deleted;