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