2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.onap.policy.rest.jpa;
23 import java.io.Serializable;
24 import java.util.Date;
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;
44 @Table(name="VNFType")
45 @NamedQuery(name="VNFType.findAll", query="SELECT v FROM VNFType v ")
46 public class VNFType implements Serializable {
47 private static final long serialVersionUID = 1L;
50 @GeneratedValue(strategy = GenerationType.AUTO)
54 @Column(name="vnf_type", nullable=false, unique=true)
56 private String vnftype;
58 @Temporal(TemporalType.TIMESTAMP)
59 @Column(name="created_date", updatable=false)
60 private Date createdDate;
62 @Column(name="description", nullable=true, length=2048)
63 private String description;
65 @Temporal(TemporalType.TIMESTAMP)
66 @Column(name="modified_date", nullable=false)
67 private Date modifiedDate;
69 @ManyToOne(optional = false)
70 @JoinColumn(name="created_by")
71 private UserInfo userCreatedBy;
73 @ManyToOne(optional = false)
74 @JoinColumn(name="modified_by")
75 private UserInfo userModifiedBy;
77 public UserInfo getUserCreatedBy() {
81 public void setUserCreatedBy(UserInfo userCreatedBy) {
82 this.userCreatedBy = userCreatedBy;
85 public UserInfo getUserModifiedBy() {
86 return userModifiedBy;
89 public void setUserModifiedBy(UserInfo userModifiedBy) {
90 this.userModifiedBy = userModifiedBy;
93 public String getVnftype() {
97 public void setVnftype(String vnftype) {
98 this.vnftype = vnftype;
102 public void prePersist() {
103 Date date = new Date();
104 this.createdDate = date;
105 this.modifiedDate = date;
109 public void preUpdate() {
110 this.modifiedDate = new Date();
117 public void setId(int id) {
121 public Date getCreatedDate() {
122 return this.createdDate;
125 public void setCreatedDate(Date createdDate) {
126 this.createdDate = createdDate;
129 public String getDescription() {
130 return this.description;
133 public void setDescription(String description) {
134 this.description = description;
137 public Date getModifiedDate() {
138 return this.modifiedDate;
141 public void setModifiedDate(Date modifiedDate) {
142 this.modifiedDate = modifiedDate;