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
50 import lombok.NoArgsConstructor;
52 import lombok.ToString;
55 * The Class ConfigurationDataEntity.
59 @Table(name = "ConfigurationDataEntity")
62 @NamedQuery(name = "ConfigurationDataEntity.findAll", query = "SELECT e FROM ConfigurationDataEntity e "),
63 @NamedQuery(name = "ConfigurationDataEntity.deleteAll", query = "DELETE FROM ConfigurationDataEntity WHERE 1=1")
72 public class ConfigurationDataEntity implements Serializable {
73 private static final long serialVersionUID = 1L;
76 @GeneratedValue(strategy = GenerationType.AUTO)
77 @Column(name = "configurationDataId")
79 private long configurationDataId;
81 @Column(name = "configurationName", nullable = false, length = 255)
82 private String configurationName = "";
85 @Column(name = "version")
88 @Column(name = "configType", nullable = false, length = 255)
89 private String configType = "NoType";
92 @Column(name = "configBody", nullable = false, columnDefinition = "TEXT")
93 private String configBody = "NoBody";
95 @Column(name = "created_by", nullable = false, length = 255)
96 private String createdBy = "guest";
98 @Temporal(TemporalType.TIMESTAMP)
99 @Column(name = "created_date", updatable = false)
100 private Date createdDate;
102 @Column(name = "description", nullable = false, length = 2048)
103 private String description = "NoDescription";
105 @Column(name = "modified_by", nullable = false, length = 255)
106 private String modifiedBy = "guest";
108 @Temporal(TemporalType.TIMESTAMP)
109 @Column(name = "modified_date", nullable = false)
110 private Date modifiedDate;
112 @Column(name = "deleted", nullable = false)
113 private boolean deleted = false;
119 public void prePersist() {
120 Date date = new Date();
121 this.createdDate = date;
122 this.modifiedDate = date;
129 public void preUpdate() {
130 this.modifiedDate = new Date();