c3dfcaa6350614a5d25e8d15f313eadad8b87fa5
[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         }
85
86         public int getId() {
87                 return this.id;
88         }
89
90         public void setId(Integer id) {
91                 this.id = id;
92         }
93
94         public int getArgLb() {
95                 return this.argLb;
96         }
97
98         public void setArgLb(Integer argLb) {
99                 this.argLb = argLb;
100         }
101
102         public int getArgUb() {
103                 return this.argUb;
104         }
105
106         public void setArgUb(Integer argUb) {
107                 this.argUb = argUb;
108         }
109
110         public int getIsBagReturn() {
111                 return isBagReturn;
112         }
113
114         public void setIsBagReturn(Integer isBagReturn) {
115                 this.isBagReturn = isBagReturn;
116         }
117
118         public int getIsHigherOrder() {
119                 return isHigherOrder;
120         }
121
122         public void setIsHigherOrder(Integer isHigherOrder) {
123                 this.isHigherOrder = isHigherOrder;
124         }
125
126         public Datatype getDatatypeBean() {
127                 return this.datatypeBean;
128         }
129
130         public void setDatatypeBean(Datatype datatypeBean) {
131                 this.datatypeBean = datatypeBean;
132         }
133
134         public String getShortname() {
135                 return this.shortname;
136         }
137
138         public void setShortname(String shortname) {
139                 this.shortname = shortname;
140         }
141
142         public String getXacmlid() {
143                 return this.xacmlid;
144         }
145
146         public void setXacmlid(String xacmlid) {
147                 this.xacmlid = xacmlid;
148         }
149
150         public int getHigherOrderArg_LB() {
151                 return higherOrderArg_LB;
152         }
153
154         public void setHigherOrderArg_LB(Integer higherOrderArg_LB) {
155                 this.higherOrderArg_LB = higherOrderArg_LB;
156         }
157
158         public int getHigherOrderArg_UB() {
159                 return higherOrderArg_UB;
160         }
161
162         public void setHigherOrderArg_UB(Integer higherOrderArg_UB) {
163                 this.higherOrderArg_UB = higherOrderArg_UB;
164         }
165
166         public Character getHigherOrderIsPrimitive() {
167                 return higherOrderIsPrimitive;
168         }
169
170         public void setHigherOrderIsPrimitive(Character higherOrderIsPrimitive) {
171                 this.higherOrderIsPrimitive = higherOrderIsPrimitive;
172         }
173
174         public List<FunctionArgument> getFunctionArguments() {
175                 return this.functionArguments;
176         }
177
178         public void setFunctionArguments(List<FunctionArgument> functionArguments) {
179                 this.functionArguments = functionArguments;
180         }
181
182         public FunctionArgument addFunctionArgument(FunctionArgument functionArgument) {
183                 getFunctionArguments().add(functionArgument);
184                 functionArgument.setFunctionDefinition(this);
185
186                 return functionArgument;
187         }
188
189         public FunctionArgument removeFunctionArgument(FunctionArgument functionArgument) {
190                 getFunctionArguments().remove(functionArgument);
191                 functionArgument.setFunctionDefinition(null);
192
193                 return functionArgument;
194         }
195
196         @Transient
197         @Override
198         public String toString() {
199                 return "FunctionDefinition [id=" + id + ", argLb=" + argLb + ", argUb="
200                                 + argUb + ", isBagReturn=" + isBagReturn + ", isHigherOrder="
201                                 + isHigherOrder + ", datatypeBean=" + datatypeBean
202                                 + ", shortname=" + shortname + ", xacmlid=" + xacmlid
203                                 + ", higherOrderArg_LB=" + higherOrderArg_LB
204                                 + ", higherOrderArg_UB=" + higherOrderArg_UB
205                                 + ", higherOrderIsPrimitive=" + higherOrderIsPrimitive
206                                 + ", functionArguments=" + functionArguments + "]";
207         }
208
209         @Transient
210         public boolean isBagReturn() {
211                 return this.isBagReturn == 1;
212         }
213
214         @Transient
215         public boolean isHigherOrder() {
216                 return this.isHigherOrder == 1;
217         }
218
219 }