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