JUnit/SONAR/Checkstyle in ONAP-REST
[policy/engine.git] / ONAP-REST / src / main / java / org / onap / policy / rest / jpa / BrmsDependency.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP-REST
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * Modifications Copyright (C) 2019 Nordix Foundation.
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END=========================================================
20  */
21
22 package org.onap.policy.rest.jpa;
23
24 import java.io.Serializable;
25 import java.util.Date;
26
27 import javax.persistence.Column;
28 import javax.persistence.Entity;
29 import javax.persistence.GeneratedValue;
30 import javax.persistence.GenerationType;
31 import javax.persistence.Id;
32 import javax.persistence.JoinColumn;
33 import javax.persistence.ManyToOne;
34 import javax.persistence.NamedQuery;
35 import javax.persistence.OrderBy;
36 import javax.persistence.PrePersist;
37 import javax.persistence.PreUpdate;
38 import javax.persistence.Table;
39 import javax.persistence.Temporal;
40 import javax.persistence.TemporalType;
41
42 /**
43  * The Class BrmsDependency.
44  */
45 @Entity
46 @Table(name = "BrmsDependency")
47 @NamedQuery(name = "BrmsDependency.findAll", query = "SELECT b from BrmsDependency b ")
48 public class BrmsDependency implements Serializable {
49     private static final long serialVersionUID = -7005622785653160761L;
50
51     @Id
52     @GeneratedValue(strategy = GenerationType.AUTO)
53     @Column(name = "id")
54     private int id;
55
56     @Column(name = "dependency_name", nullable = false, length = 1024, unique = true)
57     @OrderBy("asc")
58     private String dependencyName;
59
60     @Column(name = "description", nullable = true, length = 1024)
61     private String description;
62
63     @Temporal(TemporalType.TIMESTAMP)
64     @Column(name = "created_date", updatable = false)
65     private Date createdDate;
66
67     @ManyToOne(optional = false)
68     @JoinColumn(name = "created_by")
69     private UserInfo userCreatedBy;
70
71     @Temporal(TemporalType.TIMESTAMP)
72     @Column(name = "modified_date", nullable = false)
73     private Date modifiedDate;
74
75     @ManyToOne(optional = false)
76     @JoinColumn(name = "modified_by")
77     private UserInfo userModifiedBy;
78
79     @Column(name = "dependency", nullable = false)
80     private String dependency;
81
82     /**
83      * Pre persist.
84      */
85     @PrePersist
86     public void prePersist() {
87         Date date = new Date();
88         this.createdDate = date;
89         this.modifiedDate = date;
90     }
91
92     /**
93      * Pre update.
94      */
95     @PreUpdate
96     public void preUpdate() {
97         this.modifiedDate = new Date();
98     }
99
100     /**
101      * Gets the description.
102      *
103      * @return the description
104      */
105     public String getDescription() {
106         return description;
107     }
108
109     /**
110      * Sets the description.
111      *
112      * @param description the new description
113      */
114     public void setDescription(String description) {
115         this.description = description;
116     }
117
118     /**
119      * Gets the created date.
120      *
121      * @return the created date
122      */
123     public Date getCreatedDate() {
124         return createdDate;
125     }
126
127     /**
128      * Sets the created date.
129      *
130      * @param createdDate the new created date
131      */
132     public void setCreatedDate(Date createdDate) {
133         this.createdDate = createdDate;
134     }
135
136     /**
137      * Gets the user created by.
138      *
139      * @return the user created by
140      */
141     public UserInfo getUserCreatedBy() {
142         return userCreatedBy;
143     }
144
145     /**
146      * Sets the user created by.
147      *
148      * @param userCreatedBy the new user created by
149      */
150     public void setUserCreatedBy(UserInfo userCreatedBy) {
151         this.userCreatedBy = userCreatedBy;
152     }
153
154     /**
155      * Gets the modified date.
156      *
157      * @return the modified date
158      */
159     public Date getModifiedDate() {
160         return modifiedDate;
161     }
162
163     /**
164      * Sets the modified date.
165      *
166      * @param modifiedDate the new modified date
167      */
168     public void setModifiedDate(Date modifiedDate) {
169         this.modifiedDate = modifiedDate;
170     }
171
172     /**
173      * Gets the user modified by.
174      *
175      * @return the user modified by
176      */
177     public UserInfo getUserModifiedBy() {
178         return userModifiedBy;
179     }
180
181     /**
182      * Sets the user modified by.
183      *
184      * @param userModifiedBy the new user modified by
185      */
186     public void setUserModifiedBy(UserInfo userModifiedBy) {
187         this.userModifiedBy = userModifiedBy;
188     }
189
190     /**
191      * Gets the dependency.
192      *
193      * @return the dependency
194      */
195     public String getDependency() {
196         return dependency;
197     }
198
199     /**
200      * Sets the dependency.
201      *
202      * @param dependency the new dependency
203      */
204     public void setDependency(String dependency) {
205         this.dependency = dependency;
206     }
207
208     /**
209      * Gets the id.
210      *
211      * @return the id
212      */
213     public int getId() {
214         return id;
215     }
216
217     /**
218      * Sets the id.
219      *
220      * @param id the new id
221      */
222     public void setId(int id) {
223         this.id = id;
224     }
225
226     /**
227      * Gets the dependency name.
228      *
229      * @return the dependency name
230      */
231     public String getDependencyName() {
232         return dependencyName;
233     }
234
235     /**
236      * Sets the dependency name.
237      *
238      * @param dependencyName the new dependency name
239      */
240     public void setDependencyName(String dependencyName) {
241         this.dependencyName = dependencyName;
242     }
243 }