62c36e5723f467828445e93d4bf2ca6afeef99e6
[policy/engine.git] / ONAP-REST / src / main / java / org / onap / policy / rest / jpa / VSCLAction.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 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.JoinColumn;
32 import javax.persistence.ManyToOne;
33 import javax.persistence.NamedQuery;
34 import javax.persistence.OrderBy;
35 import javax.persistence.PrePersist;
36 import javax.persistence.PreUpdate;
37 import javax.persistence.Table;
38 import javax.persistence.Temporal;
39 import javax.persistence.TemporalType;
40
41
42 @Entity
43 @Table(name="VSCLAction")
44 @NamedQuery(name="VSCLAction.findAll", query="SELECT v FROM VSCLAction v ")
45 public class VSCLAction implements Serializable  {
46         private static final long serialVersionUID = 1L;
47
48         @Id
49         @GeneratedValue(strategy = GenerationType.AUTO)
50         @Column(name="id")
51         private int id;
52         
53         @Column(name="vscl_action", nullable=false, unique=true)
54         @OrderBy("asc")
55         private String vsclaction;
56
57         @Temporal(TemporalType.TIMESTAMP)
58         @Column(name="created_date", updatable=false)
59         private Date createdDate;
60
61         @Column(name="description", nullable=true, length=2048)
62         private String description;
63         
64         @Temporal(TemporalType.TIMESTAMP)
65         @Column(name="modified_date", nullable=false)
66         private Date modifiedDate;
67
68         @ManyToOne(optional = false)
69         @JoinColumn(name="created_by")
70         private UserInfo userCreatedBy;
71
72         @ManyToOne(optional = false)
73         @JoinColumn(name="modified_by")
74         private UserInfo userModifiedBy;
75         
76         public UserInfo getUserCreatedBy() {
77                 return userCreatedBy;
78         }
79
80         public void setUserCreatedBy(UserInfo userCreatedBy) {
81                 this.userCreatedBy = userCreatedBy;
82         }
83
84         public UserInfo getUserModifiedBy() {
85                 return userModifiedBy;
86         }
87
88         public void setUserModifiedBy(UserInfo userModifiedBy) {
89                 this.userModifiedBy = userModifiedBy;
90         }
91         
92         @PrePersist
93         public void     prePersist() {
94                 Date date = new Date();
95                 this.createdDate = date;
96                 this.modifiedDate = date;
97         }
98
99         @PreUpdate
100         public void preUpdate() {
101                 this.modifiedDate = new Date();
102         }
103         
104         public int getId() {
105                 return this.id;
106         }
107
108         public void setId(int id) {
109                 this.id = id;
110         }
111         
112         public String getVsclaction() {
113                 return vsclaction;
114         }
115
116         public void setVsclaction(String vsclaction) {
117                 this.vsclaction = vsclaction;
118         }
119         
120
121         public Date getCreatedDate() {
122                 return this.createdDate;
123         }
124
125         public void setCreatedDate(Date createdDate) {
126                 this.createdDate = createdDate;
127         }
128
129         public String getDescription() {
130                 return this.description;
131         }
132
133         public void setDescription(String description) {
134                 this.description = description;
135         }
136
137         public Date getModifiedDate() {
138                 return this.modifiedDate;
139         }
140
141         public void setModifiedDate(Date modifiedDate) {
142                 this.modifiedDate = modifiedDate;
143         }
144 }