Fixed the Sonar technical debt.
[policy/engine.git] / ONAP-REST / src / main / java / org / onap / policy / rest / jpa / BRMSParamTemplate.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP-REST
4  * ================================================================================
5  * Copyright (C) 2017 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.Lob;
33 import javax.persistence.ManyToOne;
34 import javax.persistence.NamedQuery;
35 import javax.persistence.OrderBy;
36 import javax.persistence.PrePersist;
37 import javax.persistence.Table;
38 import javax.persistence.Temporal;
39 import javax.persistence.TemporalType;
40
41 import org.onap.policy.rest.jpa.UserInfo;
42
43 /*
44  * JPA for the BRMS Param Template. 
45  * 
46  * @version: 0.1
47  */
48
49
50 @Entity
51 @Table(name="BRMSParamTemplate")
52 @NamedQuery(name="BRMSParamTemplate.findAll", query="SELECT b FROM BRMSParamTemplate b ")
53 public class BRMSParamTemplate implements Serializable{
54         private static final long serialVersionUID = 1L;
55         
56         @Id
57         @GeneratedValue(strategy = GenerationType.AUTO)
58         @Column(name="id")
59         private int id;
60         
61         @Column(name="param_template_name", nullable=false, unique=true)
62         @OrderBy("asc")
63         private String ruleName;
64         
65         @Lob
66         @Column(name="rule",nullable=false)
67         private String rule; 
68         
69         @Column(name="description", nullable=true, length=2048)
70         private String description;
71         
72         @Temporal(TemporalType.TIMESTAMP)
73         @Column(name="created_date", updatable=false)
74         private Date createdDate;
75         
76
77         @ManyToOne(optional = false)
78         @JoinColumn(name="created_by")
79         private UserInfo userCreatedBy;
80         
81         public UserInfo getUserCreatedBy() {
82                 return userCreatedBy;
83         }
84
85         public void setUserCreatedBy(UserInfo userCreatedBy) {
86                 this.userCreatedBy = userCreatedBy;
87         }
88         
89         public BRMSParamTemplate(){
90                 //An empty constructor
91         }
92         
93         public BRMSParamTemplate(String userid){
94                 //An empty constructor
95         }
96         
97         @PrePersist
98         public void     prePersist() {
99                 Date date = new Date();
100                 this.createdDate = date;
101         }
102         
103         public int getId() {
104                 return this.id;
105         }
106         
107         public void setId(int id) {
108                 this.id = id;
109         }
110         
111
112         public Date getCreatedDate() {
113                 return this.createdDate;
114         }
115
116         public void setCreatedDate(Date createdDate) {
117                 this.createdDate = createdDate;
118         }
119
120         public String getDescription() {
121                 return this.description;
122         }
123
124         public void setDescription(String description) {
125                 this.description = description;
126         }
127         
128         public String getRule(){
129                 return this.rule;
130         }
131         
132         public void setRule(String rule){
133                 this.rule = rule;
134         }
135         
136         public String getRuleName(){
137                 return this.ruleName;
138         }
139         
140         public void setRuleName(String ruleName){
141                 this.ruleName = ruleName;
142         }
143 }