ae01999a36f6bb7f6ae69f6278ca21088ce9043a
[policy/engine.git] / ONAP-REST / src / main / java / org / onap / policy / rest / jpa / PEPOptions.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP-REST
4  * ================================================================================
5  * Copyright (C) 2017-2018 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
21 package org.onap.policy.rest.jpa;
22 /*
23  * 
24  * */
25 import java.io.Serializable;
26 import java.util.Date;
27
28 import javax.persistence.Column;
29 import javax.persistence.Entity;
30 import javax.persistence.GeneratedValue;
31 import javax.persistence.GenerationType;
32 import javax.persistence.Id;
33 import javax.persistence.JoinColumn;
34 import javax.persistence.ManyToOne;
35 import javax.persistence.NamedQuery;
36 import javax.persistence.OrderBy;
37 import javax.persistence.PrePersist;
38 import javax.persistence.PreUpdate;
39 import javax.persistence.Table;
40 import javax.persistence.Temporal;
41 import javax.persistence.TemporalType;
42
43
44 @Entity
45 @Table(name = "PEPOptions")
46 @NamedQuery(name = "PEPOptions.findAll", query= "Select p from PEPOptions p")
47 public class PEPOptions implements Serializable {
48         private static final long serialVersionUID = 1L;
49         @Id
50         @GeneratedValue(strategy = GenerationType.AUTO)
51         @Column(name = "Id")
52         private int id;
53
54         @Column(name="PEP_NAME", nullable=false)
55         @OrderBy("asc")
56         private String pepName;
57
58         @Column(name="description", nullable=true, length=2048)
59         private String description;
60
61         @Column(name="Actions", nullable=true)
62         @OrderBy("asc")
63         private String actions;
64
65         @Temporal(TemporalType.TIMESTAMP)
66         @Column(name="created_date", updatable=false)
67         private Date createdDate;
68
69         @Temporal(TemporalType.TIMESTAMP)
70         @Column(name="modified_date", nullable=false)
71         private Date modifiedDate;
72
73         @ManyToOne(optional = false)
74         @JoinColumn(name="created_by")
75         private UserInfo userCreatedBy;
76
77         @ManyToOne(optional = false)
78         @JoinColumn(name="modified_by")
79         private UserInfo userModifiedBy;
80         
81         public UserInfo getUserCreatedBy() {
82                 return userCreatedBy;
83         }
84
85         public void setUserCreatedBy(UserInfo userCreatedBy) {
86                 this.userCreatedBy = userCreatedBy;
87         }
88
89         public UserInfo getUserModifiedBy() {
90                 return userModifiedBy;
91         }
92
93         public void setUserModifiedBy(UserInfo userModifiedBy) {
94                 this.userModifiedBy = userModifiedBy;
95         }
96                 
97         
98         @PrePersist
99         public void     prePersist() {
100                 Date date = new Date();
101                 this.createdDate = date;
102                 this.modifiedDate = date;
103         }
104         
105         @PreUpdate
106         public void preUpdate() {
107                 this.modifiedDate = new Date();
108         }
109         
110         public int getId() {
111                 return this.id;
112         }
113         public void setId(int id) {
114                 this.id = id;
115         }
116         
117         public String getPepName() {
118                 return pepName;
119         }
120
121         public void setPepName(String pepName) {
122                 this.pepName = pepName;
123         }
124
125         public String getActions() {
126                 return actions;
127         }
128
129         public void setActions(String actions) {
130                 this.actions = actions;
131         }
132         
133         public Date getCreatedDate() {
134                 return this.createdDate;
135         }
136         
137         public void setCreatedDate(Date createdDate) {
138                 this.createdDate = createdDate;
139         }
140         
141         public String getDescription() {
142                 return this.description;
143         }
144         
145         public void setDescription(String description) {
146                 this.description = description;
147         }
148         
149         public Date getModifiedDate() {
150                 return this.modifiedDate;
151         }
152         
153         public void setModifiedDate(Date modifiedDate) {
154                 this.modifiedDate = modifiedDate;
155         }
156
157 }