3d7c7f67b306e1da09229255c933d43a6d486de9
[policy/engine.git] / ONAP-REST / src / main / java / org / onap / policy / rest / jpa / VNFType.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 import java.io.Serializable;
24 import java.util.Date;
25 import javax.persistence.Column;
26 import javax.persistence.Entity;
27 import javax.persistence.GeneratedValue;
28 import javax.persistence.GenerationType;
29 import javax.persistence.Id;
30 import javax.persistence.JoinColumn;
31 import javax.persistence.ManyToOne;
32 import javax.persistence.NamedQuery;
33 import javax.persistence.OrderBy;
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
40
41
42 @Entity
43 @Table(name="VNFType")
44 @NamedQuery(name="VNFType.findAll", query="SELECT v FROM VNFType v ")
45 public class VNFType 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="vnf_type", nullable=false, unique=true)
54     @OrderBy("asc")
55     private String vnftype;
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 VNFType() {
77         this.modifiedDate = new Date();
78     }
79
80     public UserInfo getUserCreatedBy() {
81         return userCreatedBy;
82     }
83
84     public void setUserCreatedBy(UserInfo userCreatedBy) {
85         this.userCreatedBy = userCreatedBy;
86     }
87
88     public UserInfo getUserModifiedBy() {
89         return userModifiedBy;
90     }
91
92     public void setUserModifiedBy(UserInfo userModifiedBy) {
93         this.userModifiedBy = userModifiedBy;
94     }
95
96     public String getVnftype() {
97         return vnftype;
98     }
99
100     public void setVnftype(String vnftype) {
101         this.vnftype = vnftype;
102     }
103
104     @PrePersist
105     public void prePersist() {
106         Date date = new Date();
107         this.createdDate = date;
108         this.modifiedDate = date;
109     }
110
111     @PreUpdate
112     public void preUpdate() {
113         this.modifiedDate = new Date();
114     }
115
116     public int getId() {
117         return this.id;
118     }
119
120     public void setId(int id) {
121         this.id = id;
122     }
123
124     public Date getCreatedDate() {
125         return this.createdDate;
126     }
127
128     public void setCreatedDate(Date createdDate) {
129         this.createdDate = createdDate;
130     }
131
132     public String getDescription() {
133         return this.description;
134     }
135
136     public void setDescription(String description) {
137         this.description = description;
138     }
139
140     public Date getModifiedDate() {
141         return this.modifiedDate;
142     }
143
144     public void setModifiedDate(Date modifiedDate) {
145         this.modifiedDate = modifiedDate;
146     }
147 }