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