2 * ============LICENSE_START=======================================================
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
22 package org.onap.policy.rest.jpa;
24 import java.io.Serializable;
25 import java.util.Date;
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;
43 * The Class BRMSController.
46 @Table(name = "BrmsController")
47 @NamedQuery(name = "BrmsController.findAll", query = "SELECT b from BrmsController b ")
48 public class BrmsController implements Serializable {
49 private static final long serialVersionUID = -8666947569754164177L;
52 @GeneratedValue(strategy = GenerationType.AUTO)
56 @Column(name = "controller_name", nullable = false, length = 1024, unique = true)
58 private String controllerName;
60 @Column(name = "description", nullable = true, length = 1024)
61 private String description;
63 @Temporal(TemporalType.TIMESTAMP)
64 @Column(name = "created_date", updatable = false)
65 private Date createdDate;
67 @ManyToOne(optional = false)
68 @JoinColumn(name = "created_by")
69 private UserInfo userCreatedBy;
71 @Temporal(TemporalType.TIMESTAMP)
72 @Column(name = "modified_date", nullable = false)
73 private Date modifiedDate;
75 @ManyToOne(optional = false)
76 @JoinColumn(name = "modified_by")
77 private UserInfo userModifiedBy;
79 @Column(name = "controller", nullable = false)
80 private String controller;
83 * Called before persisting an instance.
86 public void prePersist() {
87 Date date = new Date();
88 this.createdDate = date;
89 this.modifiedDate = date;
96 public void preUpdate() {
97 this.modifiedDate = new Date();
101 * Gets the description.
103 * @return the description
105 public String getDescription() {
110 * Sets the description.
112 * @param description the new description
114 public void setDescription(String description) {
115 this.description = description;
119 * Gets the created date.
121 * @return the created date
123 public Date getCreatedDate() {
128 * Sets the created date.
130 * @param createdDate the new created date
132 public void setCreatedDate(Date createdDate) {
133 this.createdDate = createdDate;
137 * Gets the user created by.
139 * @return the user created by
141 public UserInfo getUserCreatedBy() {
142 return userCreatedBy;
146 * Sets the user created by.
148 * @param userCreatedBy the new user created by
150 public void setUserCreatedBy(UserInfo userCreatedBy) {
151 this.userCreatedBy = userCreatedBy;
155 * Gets the modified date.
157 * @return the modified date
159 public Date getModifiedDate() {
164 * Sets the modified date.
166 * @param modifiedDate the new modified date
168 public void setModifiedDate(Date modifiedDate) {
169 this.modifiedDate = modifiedDate;
173 * Gets the user modified by.
175 * @return the user modified by
177 public UserInfo getUserModifiedBy() {
178 return userModifiedBy;
182 * Sets the user modified by.
184 * @param userModifiedBy the new user modified by
186 public void setUserModifiedBy(UserInfo userModifiedBy) {
187 this.userModifiedBy = userModifiedBy;
191 * Gets the controller.
193 * @return the controller
195 public String getController() {
200 * Sets the controller.
202 * @param controller the new controller
204 public void setController(String controller) {
205 this.controller = controller;
220 * @param id the new id
222 public void setId(int id) {
227 * Gets the controller name.
229 * @return the controller name
231 public String getControllerName() {
232 return controllerName;
236 * Sets the controller name.
238 * @param controllerName the new controller name
240 public void setControllerName(String controllerName) {
241 this.controllerName = controllerName;