Fixed the Sonar technical debt.
[policy/engine.git] / ONAP-REST / src / main / java / org / onap / policy / rest / jpa / FunctionDefinition.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
25 import javax.persistence.*;
26
27 import java.util.List;
28
29
30 /**
31  * The persistent class for the FunctionDefinition database table.
32  * 
33  */
34 @Entity
35 @Table(name="FunctionDefinition")
36 @NamedQueries({
37         @NamedQuery(name="FunctionDefinition.findAll", query="SELECT f FROM FunctionDefinition f")
38 })
39 public class FunctionDefinition implements Serializable {
40         private static final long serialVersionUID = 1L;
41
42         @Id
43         @GeneratedValue(strategy=GenerationType.AUTO)
44         @Column(name="id")
45         private int id;
46
47         @Column(name="short_name", nullable=false, length=64)
48         private String shortname;
49
50         @Column(name="xacml_id", nullable=false, length=255)
51         private String xacmlid;
52         
53         //bi-directional many-to-one association to Datatype
54         @ManyToOne
55         @JoinColumn(name="return_datatype", nullable=true)
56         private Datatype datatypeBean;
57
58         @Column(name="is_bag_return", nullable=false)
59         private Integer isBagReturn;
60         
61         @Column(name="is_higher_order", nullable=false)
62         private Integer isHigherOrder;
63
64         @Column(name="arg_lb", nullable=false)
65         private Integer argLb;
66
67         @Column(name="arg_ub", nullable=false)
68         private Integer argUb;
69
70         @Column(name="ho_arg_lb", nullable=true)
71         private Integer higherOrderArg_LB;
72         
73         @Column(name="ho_arg_ub", nullable=true)
74         private Integer higherOrderArg_UB;
75         
76         @Column(name="ho_primitive", nullable=true)
77         private Character higherOrderIsPrimitive;
78
79         //bi-directional many-to-one association to FunctionArgument
80         @OneToMany(mappedBy="functionDefinition")
81         private List<FunctionArgument> functionArguments;
82
83         public FunctionDefinition() {
84                 //An empty constructor
85         }
86
87         public int getId() {
88                 return this.id;
89         }
90
91         public void setId(Integer id) {
92                 this.id = id;
93         }
94
95         public int getArgLb() {
96                 return this.argLb;
97         }
98
99         public void setArgLb(Integer argLb) {
100                 this.argLb = argLb;
101         }
102
103         public int getArgUb() {
104                 return this.argUb;
105         }
106
107         public void setArgUb(Integer argUb) {
108                 this.argUb = argUb;
109         }
110
111         public int getIsBagReturn() {
112                 return isBagReturn;
113         }
114
115         public void setIsBagReturn(Integer isBagReturn) {
116                 this.isBagReturn = isBagReturn;
117         }
118
119         public int getIsHigherOrder() {
120                 return isHigherOrder;
121         }
122
123         public void setIsHigherOrder(Integer isHigherOrder) {
124                 this.isHigherOrder = isHigherOrder;
125         }
126
127         public Datatype getDatatypeBean() {
128                 return this.datatypeBean;
129         }
130
131         public void setDatatypeBean(Datatype datatypeBean) {
132                 this.datatypeBean = datatypeBean;
133         }
134
135         public String getShortname() {
136                 return this.shortname;
137         }
138
139         public void setShortname(String shortname) {
140                 this.shortname = shortname;
141         }
142
143         public String getXacmlid() {
144                 return this.xacmlid;
145         }
146
147         public void setXacmlid(String xacmlid) {
148                 this.xacmlid = xacmlid;
149         }
150
151         public int getHigherOrderArg_LB() {
152                 return higherOrderArg_LB;
153         }
154
155         public void setHigherOrderArg_LB(Integer higherOrderArg_LB) {
156                 this.higherOrderArg_LB = higherOrderArg_LB;
157         }
158
159         public int getHigherOrderArg_UB() {
160                 return higherOrderArg_UB;
161         }
162
163         public void setHigherOrderArg_UB(Integer higherOrderArg_UB) {
164                 this.higherOrderArg_UB = higherOrderArg_UB;
165         }
166
167         public Character getHigherOrderIsPrimitive() {
168                 return higherOrderIsPrimitive;
169         }
170
171         public void setHigherOrderIsPrimitive(Character higherOrderIsPrimitive) {
172                 this.higherOrderIsPrimitive = higherOrderIsPrimitive;
173         }
174
175         public List<FunctionArgument> getFunctionArguments() {
176                 return this.functionArguments;
177         }
178
179         public void setFunctionArguments(List<FunctionArgument> functionArguments) {
180                 this.functionArguments = functionArguments;
181         }
182
183         public FunctionArgument addFunctionArgument(FunctionArgument functionArgument) {
184                 getFunctionArguments().add(functionArgument);
185                 functionArgument.setFunctionDefinition(this);
186
187                 return functionArgument;
188         }
189
190         public FunctionArgument removeFunctionArgument(FunctionArgument functionArgument) {
191                 getFunctionArguments().remove(functionArgument);
192                 functionArgument.setFunctionDefinition(null);
193
194                 return functionArgument;
195         }
196
197         @Transient
198         @Override
199         public String toString() {
200                 return "FunctionDefinition [id=" + id + ", argLb=" + argLb + ", argUb="
201                                 + argUb + ", isBagReturn=" + isBagReturn + ", isHigherOrder="
202                                 + isHigherOrder + ", datatypeBean=" + datatypeBean
203                                 + ", shortname=" + shortname + ", xacmlid=" + xacmlid
204                                 + ", higherOrderArg_LB=" + higherOrderArg_LB
205                                 + ", higherOrderArg_UB=" + higherOrderArg_UB
206                                 + ", higherOrderIsPrimitive=" + higherOrderIsPrimitive
207                                 + ", functionArguments=" + functionArguments + "]";
208         }
209
210         @Transient
211         public boolean isBagReturn() {
212                 return this.isBagReturn == 1;
213         }
214
215         @Transient
216         public boolean isHigherOrder() {
217                 return this.isHigherOrder == 1;
218         }
219
220 }