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=========================================================
20 package org.onap.policy.rest.jpa;
23 import java.io.Serializable;
24 import java.util.Date;
26 import javax.persistence.Column;
27 import javax.persistence.Entity;
28 import javax.persistence.GeneratedValue;
29 import javax.persistence.GenerationType;
30 import javax.persistence.Id;
31 import javax.persistence.Lob;
32 import javax.persistence.NamedQueries;
33 import javax.persistence.NamedQuery;
34 import javax.persistence.PrePersist;
35 import javax.persistence.PreUpdate;
36 import javax.persistence.Table;
37 import javax.persistence.Temporal;
38 import javax.persistence.TemporalType;
39 import javax.persistence.Version;
41 * The Entity class to persist a policy object Action Body
44 import com.fasterxml.jackson.annotation.JsonBackReference;
47 @Table(name="ActionBodyEntity")
49 @NamedQuery(name=" ActionBodyEntity.findAll", query="SELECT e FROM ActionBodyEntity e "),
50 @NamedQuery(name="ActionBodyEntity.deleteAll", query="DELETE FROM ActionBodyEntity WHERE 1=1")
53 public class ActionBodyEntity implements Serializable {
54 private static final long serialVersionUID = 1L;
57 @GeneratedValue(strategy = GenerationType.AUTO)
58 @Column(name="actionBodyId")
60 private long actionBodyId;
62 @Column(name="actionBodyName", nullable=false, length=255)
63 private String actionBodyName = "";
66 @Column(name="version")
70 @Column(name="actionBody", nullable=false, columnDefinition="TEXT")
71 private String actionBody = "NoBody";
73 @Column(name="created_by", nullable=false, length=255)
74 private String createdBy = "guest";
76 @Temporal(TemporalType.TIMESTAMP)
77 @Column(name="created_date", updatable=false)
78 private Date createdDate;
80 @Column(name="modified_by", nullable=false, length=255)
81 private String modifiedBy = "guest";
83 @Temporal(TemporalType.TIMESTAMP)
84 @Column(name="modified_date", nullable=false)
85 private Date modifiedDate;
87 @Column(name="deleted", nullable=false)
88 private boolean deleted = false;
90 public ActionBodyEntity() {
94 public void prePersist() {
95 Date date = new Date();
96 this.createdDate = date;
97 this.modifiedDate = date;
101 public void preUpdate() {
102 this.modifiedDate = new Date();
105 * @return the configurationDataId
107 public long getActionBodyId() {
111 * @param configurationDataId the configurationDataId to set
113 public void setActionBodyName(String name) {
114 this.actionBodyName = name;
116 public String getActionBodyName(){
117 return this.actionBodyName;
121 * @return the actionBody
123 public String getActionBody() {
127 * @param configBody the configBody to set
129 public void setActionBody(String body) {
130 this.actionBody = body;
133 * @return the createdBy
135 public String getCreatedBy() {
139 * @param createdBy the createdBy to set
141 public void setCreatedBy(String createdBy) {
142 this.createdBy = createdBy;
146 * @return the modifiedBy
148 public String getModifiedBy() {
152 * @param modifiedBy the modifiedBy to set
154 public void setModifiedBy(String modifiedBy) {
155 this.modifiedBy = modifiedBy;
158 * @return the modifiedDate
160 public Date getModifiedDate() {
164 * @param modifiedDate the modifiedDate to set
166 public void setModifiedDate(Date modifiedDate) {
167 this.modifiedDate = modifiedDate;
170 * @return the version
172 public int getVersion() {
176 * @return the createdDate
178 public Date getCreatedDate() {
183 * @return the deleted
185 public boolean isDeleted() {
190 * @param deleted the deleted to set
192 public void setDeleted(boolean deleted) {
193 this.deleted = deleted;