JUnit/SONAR/Checkstyle in ONAP-REST
[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-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.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     @PrePersist
90     public void prePersist() {
91         Date date = new Date();
92         this.createdDate = date;
93     }
94
95     public int getId() {
96         return this.id;
97     }
98
99     public void setId(int id) {
100         this.id = id;
101     }
102
103
104     public Date getCreatedDate() {
105         return this.createdDate;
106     }
107
108     public void setCreatedDate(Date createdDate) {
109         this.createdDate = createdDate;
110     }
111
112     public String getDescription() {
113         return this.description;
114     }
115
116     public void setDescription(String description) {
117         this.description = description;
118     }
119
120     public String getRule(){
121         return this.rule;
122     }
123
124     public void setRule(String rule){
125         this.rule = rule;
126     }
127
128     public String getRuleName(){
129         return this.ruleName;
130     }
131
132     public void setRuleName(String ruleName){
133         this.ruleName = ruleName;
134     }
135 }