314a4ee9b13d17f68b7a951e3bbda1ec8b7700d3
[policy/engine.git] / ONAP-REST / src / main / java / org / onap / policy / rest / jpa / FWTagPicker.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 package org.onap.policy.rest.jpa;
21
22 import java.io.Serializable;
23 import java.util.Date;
24
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 @Entity
41 @Table(name = "FWTagPicker")
42 @NamedQuery(name = "FWTagPicker.findAll", query= "Select p from FWTagPicker p")
43 public class FWTagPicker implements Serializable {
44         private static final long serialVersionUID = 1L;
45         @Id
46         @GeneratedValue(strategy = GenerationType.AUTO)
47         @Column(name = "Id")
48         private int id;
49
50         @Column(name="tagPickerName", nullable=false)
51         @OrderBy("asc")
52         private String tagPickerName;
53
54         @Column(name="description", nullable=true, length=2048)
55         private String description;
56         
57         @Column(name="networkRole", nullable=true)
58         private String networkRole;
59
60         @Column(name="tags", nullable=true)
61         @OrderBy("asc")
62         private String tagValues;
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         @PrePersist
81         public void     prePersist() {
82                 Date date = new Date();
83                 this.createdDate = date;
84                 this.modifiedDate = date;
85         }
86         
87         @PreUpdate
88         public void preUpdate() {
89                 this.modifiedDate = new Date();
90         }
91         
92         public int getId() {
93                 return this.id;
94         }
95         public void setId(int id) {
96                 this.id = id;
97         }
98         
99         public String getTagPickerName() {
100                 return tagPickerName;
101         }
102
103         public void setTagPickerName(String tagPickerName) {
104                 this.tagPickerName = tagPickerName;
105         }
106         
107         public String getDescription() {
108                 return this.description;
109         }
110         
111         public void setDescription(String description) {
112                 this.description = description;
113         }
114
115         public String getNetworkRole() {
116                 return networkRole;
117         }
118
119         public void setNetworkRole(String networkRole) {
120                 this.networkRole = networkRole;
121         }
122         
123         public String getTagValues() {
124                 return tagValues;
125         }
126
127         public void setTagValues(String tagValues) {
128                 this.tagValues = tagValues;
129         }
130         
131         public Date getCreatedDate() {
132                 return this.createdDate;
133         }
134         
135         public void setCreatedDate(Date createdDate) {
136                 this.createdDate = createdDate;
137         }
138         
139         public Date getModifiedDate() {
140                 return this.modifiedDate;
141         }
142         
143         public void setModifiedDate(Date modifiedDate) {
144                 this.modifiedDate = modifiedDate;
145         }
146         
147         public UserInfo getUserCreatedBy() {
148                 return userCreatedBy;
149         }
150
151         public void setUserCreatedBy(UserInfo userCreatedBy) {
152                 this.userCreatedBy = userCreatedBy;
153         }
154
155         public UserInfo getUserModifiedBy() {
156                 return userModifiedBy;
157         }
158
159         public void setUserModifiedBy(UserInfo userModifiedBy) {
160                 this.userModifiedBy = userModifiedBy;
161         }
162
163 }