4d712994c2ea70dd928a45283bfe63c3f29258f5
[policy/engine.git] / ONAP-REST / src / main / java / org / onap / policy / rest / jpa / FunctionArgument.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
28 /**
29  * The persistent class for the FunctionArguments database table.
30  * 
31  */
32 @Entity
33 @Table(name="FunctionArguments")
34 @NamedQuery(name="FunctionArgument.findAll", query="SELECT f FROM FunctionArgument f")
35 public class FunctionArgument implements Serializable {
36         private static final long serialVersionUID = 1L;
37
38         @Id
39         @GeneratedValue(strategy=GenerationType.AUTO)
40         @Column(name="id")
41         private int id;
42
43         @Column(name="is_bag", nullable=false)
44         private int isBag;
45
46         //bi-directional many-to-one association to FunctionDefinition
47         @ManyToOne
48         @JoinColumn(name="function_id")
49         private FunctionDefinition functionDefinition;
50
51         @Column(name="arg_index", nullable=false)
52         private int argIndex;
53
54         //bi-directional many-to-one association to Datatype
55         @ManyToOne
56         @JoinColumn(name="datatype_id")
57         private Datatype datatypeBean;
58
59         public FunctionArgument() {
60         }
61
62         public FunctionArgument(final FunctionArgument argument) {
63                 this.argIndex = argument.argIndex;
64                 this.datatypeBean = argument.datatypeBean;
65                 this.isBag = argument.isBag;
66                 this.functionDefinition = argument.functionDefinition;
67         }
68
69         public int getId() {
70                 return this.id;
71         }
72
73         public void setId(int id) {
74                 this.id = id;
75         }
76
77         public int getArgIndex() {
78                 return this.argIndex;
79         }
80
81         public void setArgIndex(int argIndex) {
82                 this.argIndex = argIndex;
83         }
84
85         public Datatype getDatatypeBean() {
86                 return this.datatypeBean;
87         }
88
89         public void setDatatypeBean(Datatype datatypeBean) {
90                 this.datatypeBean = datatypeBean;
91         }
92
93         public FunctionDefinition getFunctionDefinition() {
94                 return this.functionDefinition;
95         }
96
97         public int getIsBag() {
98                 return isBag;
99         }
100
101         public void setIsBag(int isBag) {
102                 this.isBag = isBag;
103         }
104
105         public void setFunctionDefinition(FunctionDefinition functionDefinition) {
106                 this.functionDefinition = functionDefinition;
107         }
108
109         @Transient
110         @Override
111         public String toString() {
112                 return "FunctionArgument [id=" + id + ", argIndex=" + argIndex
113                                 + ", datatypeBean=" + datatypeBean + ", isBag=" + isBag
114                                 + ", functionDefinition=" + functionDefinition + "]";
115         }
116         
117         @Transient
118         public boolean isBag() {
119                 return this.isBag == 1;
120         }
121
122 }