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