2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * Modifications Copyright (C) 2019 Nordix Foundation.
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.onap.policy.rest.jpa;
24 import java.io.Serializable;
25 import java.util.List;
27 import javax.persistence.Column;
28 import javax.persistence.Entity;
29 import javax.persistence.GeneratedValue;
30 import javax.persistence.GenerationType;
31 import javax.persistence.Id;
32 import javax.persistence.JoinColumn;
33 import javax.persistence.ManyToOne;
34 import javax.persistence.NamedQueries;
35 import javax.persistence.NamedQuery;
36 import javax.persistence.OneToMany;
37 import javax.persistence.Table;
38 import javax.persistence.Transient;
41 import lombok.NoArgsConstructor;
43 import lombok.ToString;
46 * The persistent class for the FunctionDefinition database table.
51 @Table(name = "FunctionDefinition")
54 @NamedQuery(name = "FunctionDefinition.findAll", query = "SELECT f FROM FunctionDefinition f")
62 public class FunctionDefinition implements Serializable {
63 private static final long serialVersionUID = 1L;
66 @GeneratedValue(strategy = GenerationType.AUTO)
70 @Column(name = "short_name", nullable = false, length = 64)
71 private String shortname;
73 @Column(name = "xacml_id", nullable = false, length = 255)
74 private String xacmlid;
76 // bi-directional many-to-one association to Datatype
78 @JoinColumn(name = "return_datatype", nullable = true)
79 private Datatype datatypeBean;
81 @Column(name = "is_bag_return", nullable = false)
82 private Integer isBagReturn;
84 @Column(name = "is_higher_order", nullable = false)
85 private Integer isHigherOrder;
87 @Column(name = "arg_lb", nullable = false)
88 private Integer argLb;
90 @Column(name = "arg_ub", nullable = false)
91 private Integer argUb;
93 @Column(name = "ho_arg_lb", nullable = true)
94 private Integer higherOrderArgLb;
96 @Column(name = "ho_arg_ub", nullable = true)
97 private Integer higherOrderArgUb;
99 @Column(name = "ho_primitive", nullable = true)
100 private Character higherOrderIsPrimitive;
102 // bi-directional many-to-one association to FunctionArgument
103 @OneToMany(mappedBy = "functionDefinition")
104 private List<FunctionArgument> functionArguments;
107 * Adds the function argument.
109 * @param functionArgument the function argument
110 * @return the function argument
112 public FunctionArgument addFunctionArgument(FunctionArgument functionArgument) {
113 getFunctionArguments().add(functionArgument);
114 functionArgument.setFunctionDefinition(this);
116 return functionArgument;
120 * Removes the function argument.
122 * @param functionArgument the function argument
123 * @return the function argument
125 public FunctionArgument removeFunctionArgument(FunctionArgument functionArgument) {
126 getFunctionArguments().remove(functionArgument);
127 functionArgument.setFunctionDefinition(null);
129 return functionArgument;
133 * Checks if is bag return.
135 * @return true, if is bag return
138 public boolean isBagReturn() {
139 return this.isBagReturn == 1;
143 * Checks if is higher order.
145 * @return true, if is higher order
148 public boolean isHigherOrder() {
149 return this.isHigherOrder == 1;