[POLICY-73] replace openecomp for policy-engine
[policy/engine.git] / ONAP-REST / src / main / java / org / onap / policy / rest / jpa / ActionBodyEntity.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP-REST
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20 package org.onap.policy.rest.jpa;
21 /*
22  */
23 import java.io.Serializable;
24 import java.util.Date;
25
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;
40 /*
41  * The Entity class to persist a policy object Action Body
42  */
43
44 import com.fasterxml.jackson.annotation.JsonBackReference;
45
46 @Entity
47 @Table(name="ActionBodyEntity")
48 @NamedQueries({
49         @NamedQuery(name=" ActionBodyEntity.findAll", query="SELECT e FROM ActionBodyEntity e "),
50         @NamedQuery(name="ActionBodyEntity.deleteAll", query="DELETE FROM ActionBodyEntity WHERE 1=1")
51 })
52
53 public class ActionBodyEntity implements Serializable {
54         private static final long serialVersionUID = 1L;
55
56         @Id
57         @GeneratedValue(strategy = GenerationType.AUTO)
58         @Column(name="actionBodyId")
59         @JsonBackReference
60         private long actionBodyId;
61         
62         @Column(name="actionBodyName", nullable=false, length=255)
63         private String actionBodyName = "";
64         
65         @Version 
66         @Column(name="version")
67         private int version;
68         
69         @Lob
70         @Column(name="actionBody", nullable=false, columnDefinition="TEXT")
71         private String actionBody = "NoBody";
72         
73         @Column(name="created_by", nullable=false, length=255)
74         private String createdBy = "guest";
75
76         @Temporal(TemporalType.TIMESTAMP)
77         @Column(name="created_date", updatable=false)
78         private Date createdDate;
79
80         @Column(name="modified_by", nullable=false, length=255)
81         private String modifiedBy = "guest";
82
83         @Temporal(TemporalType.TIMESTAMP)
84         @Column(name="modified_date", nullable=false)
85         private Date modifiedDate;
86         
87         @Column(name="deleted", nullable=false)
88         private boolean deleted = false;
89
90         public ActionBodyEntity() {
91         }
92
93         @PrePersist
94         public void     prePersist() {
95                 Date date = new Date();
96                 this.createdDate = date;
97                 this.modifiedDate = date;
98         }
99
100         @PreUpdate
101         public void preUpdate() {
102                 this.modifiedDate = new Date();
103         }
104         /**
105          * @return the configurationDataId
106          */
107         public long getActionBodyId() {
108                 return actionBodyId;
109         }
110         /**
111          * @param configurationDataId the configurationDataId to set
112          */
113         public void setActionBodyName(String name) {
114                 this.actionBodyName = name;
115         }
116         public String getActionBodyName(){
117                 return this.actionBodyName;
118         }
119         
120         /**
121          * @return the actionBody
122          */
123         public String getActionBody() {
124                 return actionBody;
125         }
126         /**
127          * @param configBody the configBody to set
128          */
129         public void setActionBody(String body) {
130                 this.actionBody = body;
131         }
132         /**
133          * @return the createdBy
134          */
135         public String getCreatedBy() {
136                 return createdBy;
137         }
138         /**
139          * @param createdBy the createdBy to set
140          */
141         public void setCreatedBy(String createdBy) {
142                 this.createdBy = createdBy;
143         }
144         
145         /**
146          * @return the modifiedBy
147          */
148         public String getModifiedBy() {
149                 return modifiedBy;
150         }
151         /**
152          * @param modifiedBy the modifiedBy to set
153          */
154         public void setModifiedBy(String modifiedBy) {
155                 this.modifiedBy = modifiedBy;
156         }
157         /**
158          * @return the modifiedDate
159          */
160         public Date getModifiedDate() {
161                 return modifiedDate;
162         }
163         /**
164          * @param modifiedDate the modifiedDate to set
165          */
166         public void setModifiedDate(Date modifiedDate) {
167                 this.modifiedDate = modifiedDate;
168         }
169         /**
170          * @return the version
171          */
172         public int getVersion() {
173                 return version;
174         }
175         /**
176          * @return the createdDate
177          */
178         public Date getCreatedDate() {
179                 return createdDate;
180         }
181
182         /**
183          * @return the deleted
184          */
185         public boolean isDeleted() {
186                 return deleted;
187         }
188
189         /**
190          * @param deleted the deleted to set
191          */
192         public void setDeleted(boolean deleted) {
193                 this.deleted = deleted;
194         }
195 }