Convert tabs to spaces basic refactoring
[policy/engine.git] / ONAP-REST / src / main / java / org / onap / policy / rest / jpa / ClosedLoopSite.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 /*
24  * 
25  */
26 import java.io.Serializable;
27 import java.util.Date;
28
29 import javax.persistence.Column;
30 import javax.persistence.Entity;
31 import javax.persistence.GeneratedValue;
32 import javax.persistence.GenerationType;
33 import javax.persistence.Id;
34 import javax.persistence.JoinColumn;
35 import javax.persistence.ManyToOne;
36 import javax.persistence.NamedQuery;
37 import javax.persistence.OrderBy;
38 import javax.persistence.PrePersist;
39 import javax.persistence.PreUpdate;
40 import javax.persistence.Table;
41 import javax.persistence.Temporal;
42 import javax.persistence.TemporalType;
43
44
45 @Entity
46 @Table(name = "ClosedLoopSite")
47 @NamedQuery(name="ClosedLoopSite.findAll", query="SELECT c FROM ClosedLoopSite c ")
48 public class ClosedLoopSite implements Serializable{
49     private static final long serialVersionUID = 1L;
50
51
52     @Id
53     @Column(name ="id")
54     @GeneratedValue(strategy = GenerationType.AUTO)
55     private int id;
56
57     @Column(name="site_Name", nullable=false, unique=true)
58     @OrderBy("asc")
59     private String siteName;
60
61     @Column(name="description", nullable=true, length=2048)
62     private String description;
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     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     @PrePersist
97     public void prePersist() {
98         Date date = new Date();
99         this.createdDate = date;
100         this.modifiedDate = date;
101     }
102
103     @PreUpdate
104     public void preUpdate() {
105         this.modifiedDate = new Date();
106     }
107
108     public int getId() {
109         return id;
110     }
111
112     public void setId(int id) {
113         this.id = id;
114     }
115
116     public String getSiteName() {
117         return siteName;
118     }
119
120     public void setSiteName(String siteName) {
121         this.siteName = siteName;
122     }
123
124     public String getDescription() {
125         return description;
126     }
127
128     public void setDescription(String description) {
129         this.description = description;
130     }
131
132     public Date getCreatedDate() {
133         return createdDate;
134     }
135
136     public void setCreatedDate(Date createdDate) {
137         this.createdDate = createdDate;
138     }
139
140     public Date getModifiedDate() {
141         return modifiedDate;
142     }
143
144     public void setModifiedDate(Date modifiedDate) {
145         this.modifiedDate = modifiedDate;
146     }
147
148 }