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