Merge "Define constant in place of literals Constants are declared and used in place...
[so.git] / bpmn / MSOCommonBPMN / src / main / java / org / onap / so / bpmn / servicedecomposition / bbobjects / ServiceInstance.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.bpmn.servicedecomposition.bbobjects;
22
23 import java.io.Serializable;
24 import java.util.ArrayList;
25 import java.util.List;
26 import javax.persistence.Id;
27 import org.apache.commons.lang3.builder.EqualsBuilder;
28 import org.apache.commons.lang3.builder.HashCodeBuilder;
29 import org.onap.so.bpmn.servicedecomposition.Metadata;
30 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
31 import org.onap.so.db.catalog.beans.OrchestrationStatus;
32 import com.fasterxml.jackson.annotation.JsonProperty;
33 import com.fasterxml.jackson.annotation.JsonRootName;
34 import org.onap.so.bpmn.servicedecomposition.ShallowCopy;
35 import org.onap.so.bpmn.servicedecomposition.homingobjects.SolutionInfo;
36
37 @JsonRootName("service-instance")
38 public class ServiceInstance implements Serializable, ShallowCopy<ServiceInstance> {
39
40     private static final long serialVersionUID = -1843348234891739356L;
41
42     @Id
43     @JsonProperty("service-instance-id")
44     private String serviceInstanceId;
45     @JsonProperty("service-instance-name")
46     private String serviceInstanceName;
47     @JsonProperty("orchestration-status")
48     private OrchestrationStatus orchestrationStatus;
49     @JsonProperty("owning-entity")
50     private OwningEntity owningEntity;
51     @JsonProperty("project")
52     private Project project;
53     @JsonProperty("collection")
54     private Collection collection;
55     @JsonProperty("vnfs")
56     private List<GenericVnf> vnfs = new ArrayList<>();
57     @JsonProperty("pnfs")
58     private List<Pnf> pnfs = new ArrayList<>();
59     @JsonProperty("allotted-resources")
60     private List<AllottedResource> allottedResources = new ArrayList<>();
61     @JsonProperty("networks")
62     private List<L3Network> networks = new ArrayList<>();
63     @JsonProperty("vpn-bonding-links")
64     private List<VpnBondingLink> vpnBondingLinks = new ArrayList<>();
65     @JsonProperty("vhn-portal-url")
66     private String vhnPortalUrl;
67     @JsonProperty("service-instance-location-id")
68     private String serviceInstanceLocationId;
69     @JsonProperty("selflink")
70     private String selflink;
71     @JsonProperty("metadata")
72     private Metadata metadata;
73     @JsonProperty("configurations")
74     private List<Configuration> configurations = new ArrayList<>();
75     @JsonProperty("solution-info")
76     private SolutionInfo solutionInfo;
77     @JsonProperty("model-info-service-instance")
78     private ModelInfoServiceInstance modelInfoServiceInstance;
79     @JsonProperty("instance-groups")
80     private List<InstanceGroup> instanceGroups = new ArrayList<>();
81     @JsonProperty("service-proxies")
82     private List<ServiceProxy> serviceProxies = new ArrayList<ServiceProxy>();
83
84     public List<GenericVnf> getVnfs() {
85         return vnfs;
86     }
87
88     public List<AllottedResource> getAllottedResources() {
89         return allottedResources;
90     }
91
92     public List<L3Network> getNetworks() {
93         return networks;
94     }
95
96     public ModelInfoServiceInstance getModelInfoServiceInstance() {
97         return modelInfoServiceInstance;
98     }
99
100     public void setModelInfoServiceInstance(ModelInfoServiceInstance modelInfoServiceInstance) {
101         this.modelInfoServiceInstance = modelInfoServiceInstance;
102     }
103
104     public List<Configuration> getConfigurations() {
105         return configurations;
106     }
107
108     public void setConfigurations(List<Configuration> configurations) {
109         this.configurations = configurations;
110     }
111
112     public String getVhnPortalUrl() {
113         return vhnPortalUrl;
114     }
115
116     public void setVhnPortalUrl(String vhnPortalUrl) {
117         this.vhnPortalUrl = vhnPortalUrl;
118     }
119
120     public String getServiceInstanceLocationId() {
121         return serviceInstanceLocationId;
122     }
123
124     public void setServiceInstanceLocationId(String serviceInstanceLocationId) {
125         this.serviceInstanceLocationId = serviceInstanceLocationId;
126     }
127
128     public String getSelflink() {
129         return selflink;
130     }
131
132     public void setSelflink(String selflink) {
133         this.selflink = selflink;
134     }
135
136     public Metadata getMetadata() {
137         return metadata;
138     }
139
140     public void setMetadata(Metadata metadata) {
141         this.metadata = metadata;
142     }
143
144     public String getServiceInstanceId() {
145         return serviceInstanceId;
146     }
147
148     public void setServiceInstanceId(String serviceInstanceId) {
149         this.serviceInstanceId = serviceInstanceId;
150     }
151
152     public String getServiceInstanceName() {
153         return serviceInstanceName;
154     }
155
156     public void setServiceInstanceName(String serviceInstanceName) {
157         this.serviceInstanceName = serviceInstanceName;
158     }
159
160     public OrchestrationStatus getOrchestrationStatus() {
161         return orchestrationStatus;
162     }
163
164     public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) {
165         this.orchestrationStatus = orchestrationStatus;
166     }
167
168     public OwningEntity getOwningEntity() {
169         return owningEntity;
170     }
171
172     public void setOwningEntity(OwningEntity owningEntity) {
173         this.owningEntity = owningEntity;
174     }
175
176     public Project getProject() {
177         return project;
178     }
179
180     public void setProject(Project project) {
181         this.project = project;
182     }
183
184     public Collection getCollection() {
185         return collection;
186     }
187
188     public void setCollection(Collection collection) {
189         this.collection = collection;
190     }
191
192     public List<VpnBondingLink> getVpnBondingLinks() {
193         return vpnBondingLinks;
194     }
195
196     public List<Pnf> getPnfs() {
197         return pnfs;
198     }
199
200     public SolutionInfo getSolutionInfo() {
201         return solutionInfo;
202     }
203
204     public void setSolutionInfo(SolutionInfo solutionInfo) {
205         this.solutionInfo = solutionInfo;
206     }
207
208     public List<InstanceGroup> getInstanceGroups() {
209         return instanceGroups;
210     }
211
212     public void setInstanceGroups(List<InstanceGroup> instanceGroups) {
213         this.instanceGroups = instanceGroups;
214     }
215
216     public List<ServiceProxy> getServiceProxies() {
217         return serviceProxies;
218     }
219
220     @Override
221     public boolean equals(final Object other) {
222         if (!(other instanceof ServiceInstance)) {
223             return false;
224         }
225         ServiceInstance castOther = (ServiceInstance) other;
226         return new EqualsBuilder().append(serviceInstanceId, castOther.serviceInstanceId).isEquals();
227     }
228
229     @Override
230     public int hashCode() {
231         return new HashCodeBuilder().append(serviceInstanceId).toHashCode();
232     }
233 }