67f23c1e43a859367c44ad68d29a5891a47834b9
[so.git] / mso-catalog-db / src / main / java / org / onap / so / db / catalog / beans / macro / NorthBoundRequest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
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.so.db.catalog.beans.macro;
22
23 import java.io.Serializable;
24 import java.util.List;
25
26 import javax.persistence.CascadeType;
27 import javax.persistence.Column;
28 import javax.persistence.Entity;
29 import javax.persistence.FetchType;
30 import javax.persistence.GeneratedValue;
31 import javax.persistence.Id;
32 import javax.persistence.OneToMany;
33 import javax.persistence.Table;
34
35 import org.apache.commons.lang3.builder.EqualsBuilder;
36 import org.apache.commons.lang3.builder.HashCodeBuilder;
37 import org.apache.commons.lang3.builder.ToStringBuilder;
38
39 import com.openpojo.business.annotation.BusinessKey;
40
41 import uk.co.blackpepper.bowman.annotation.LinkedResource;
42
43 @Entity
44 @Table(name = "northbound_request_ref_lookup")
45 public class NorthBoundRequest implements Serializable {
46
47         /**
48          * 
49          */
50         private static final long serialVersionUID = -2238991039015148725L;
51
52         @Id
53         @Column(name = "id")
54         @GeneratedValue
55         private Integer id;
56
57         @BusinessKey
58         @Column(name = "MACRO_ACTION")
59         private String macroAction;
60
61         @BusinessKey
62         @Column(name = "ACTION")
63         private String action;
64
65         @BusinessKey
66         @Column(name = "REQUEST_SCOPE")
67         private String requestScope;
68
69         @BusinessKey
70         @Column(name = "IS_ALACARTE")
71         private Boolean isAlacarte;
72
73         @BusinessKey
74         @Column(name = "IS_TOPLEVELFLOW")
75         private Boolean isToplevelflow;
76
77         @BusinessKey
78         @Column(name = "MIN_API_VERSION")
79         private Double minApiVersion;
80
81         @BusinessKey
82         @Column(name = "MAX_API_VERSION")
83         private Double maxApiVersion;
84
85         @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "northBoundRequest")
86         private List<OrchestrationFlow> orchestrationFlowList;
87
88         @Override
89         public String toString() {
90                 return new ToStringBuilder(this).append("id", id).append("action", action).append("requestScope", requestScope)
91                                 .append("isAlacarte", isAlacarte).append("isToplevelflow", isToplevelflow)
92                                 .append("minApiVersion", minApiVersion).append("maxApiVersion", maxApiVersion).toString();
93         }
94
95         @Override
96         public boolean equals(final Object other) {
97                 if (!(other instanceof NorthBoundRequest)) {
98                         return false;
99                 }
100                 NorthBoundRequest castOther = (NorthBoundRequest) other;
101                 return new EqualsBuilder().append(action, castOther.action).append(requestScope, castOther.requestScope)
102                                 .append(isAlacarte, castOther.isAlacarte).append(isToplevelflow, castOther.isToplevelflow)
103                                 .append(minApiVersion, castOther.minApiVersion).append(maxApiVersion, castOther.maxApiVersion)
104                                 .isEquals();
105         }
106
107         @Override
108         public int hashCode() {
109                 return new HashCodeBuilder().append(action).append(requestScope).append(isAlacarte).append(isToplevelflow)
110                                 .append(minApiVersion).append(maxApiVersion).toHashCode();
111         }
112
113         public Integer getId() {
114                 return id;
115         }
116
117         public void setId(Integer id) {
118                 this.id = id;
119         }
120
121         public String getAction() {
122                 return action;
123         }
124
125         public void setAction(String action) {
126                 this.action = action;
127         }
128
129         public String getMacroAction() {
130                 return macroAction;
131         }
132
133         public void setMacroAction(String macroAction) {
134                 this.macroAction = macroAction;
135         }
136
137         public String getRequestScope() {
138                 return requestScope;
139         }
140
141         public void setRequestScope(String requestScope) {
142                 this.requestScope = requestScope;
143         }
144
145         public Boolean getIsAlacarte() {
146                 return isAlacarte;
147         }
148
149         public void setIsAlacarte(Boolean isAlacarte) {
150                 this.isAlacarte = isAlacarte;
151         }
152
153         public Boolean getIsToplevelflow() {
154                 return isToplevelflow;
155         }
156
157         public void setIsToplevelflow(Boolean isToplevelflow) {
158                 this.isToplevelflow = isToplevelflow;
159         }
160
161         public Double getMinApiVersion() {
162                 return minApiVersion;
163         }
164
165         public void setMinApiVersion(Double minApiVersion) {
166                 this.minApiVersion = minApiVersion;
167         }
168
169         public Double getMaxApiVersion() {
170                 return maxApiVersion;
171         }
172
173         public void setMaxApiVersion(Double maxApiVersion) {
174                 this.maxApiVersion = maxApiVersion;
175         }
176
177         @LinkedResource
178         public List<OrchestrationFlow> getOrchestrationFlowList() {
179                 return orchestrationFlowList;
180         }
181
182         public void setOrchestrationFlowList(List<OrchestrationFlow> orchestrationFlowList) {
183                 this.orchestrationFlowList = orchestrationFlowList;
184         }
185 }