fa076770d74f3e50158ebab48d294a666a42ec7a
[so.git] / bpmn / MSOCommonBPMN / src / main / java / org / onap / so / bpmn / servicedecomposition / bbobjects / ServiceProxy.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 com.fasterxml.jackson.annotation.JsonProperty;
24 import com.fasterxml.jackson.annotation.JsonRootName;
25
26 import org.onap.so.bpmn.servicedecomposition.ShallowCopy;
27 import org.onap.so.bpmn.servicedecomposition.homingobjects.SolutionCandidates;
28 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceProxy;
29
30 import java.io.Serializable;
31 import javax.persistence.Id;
32
33 import org.apache.commons.lang3.builder.EqualsBuilder;
34 import org.apache.commons.lang3.builder.HashCodeBuilder;
35
36 @JsonRootName("service-proxy")
37 public class ServiceProxy extends SolutionCandidates implements Serializable, ShallowCopy<ServiceProxy> {
38     private static final long serialVersionUID = 1491890223056651430L;
39
40     @Id
41     @JsonProperty("id")
42     private String id;
43
44     @JsonProperty("type")
45     private String type;
46
47     @JsonProperty("service-instance")
48     private ServiceInstance serviceInstance;
49
50     @JsonProperty("model-info-service-proxy")
51     private ModelInfoServiceProxy modelInfoServiceProxy;
52
53
54         public String getId() {
55                 return id;
56         }
57
58         public void setId(String id) {
59                 this.id = id;
60         }
61
62         /**
63          * Way to identify the type of proxy
64          * i.e. "infrastructure", "transport", etc.
65          */
66         public String getType() {
67                 return type;
68         }
69
70         /**
71          * Way to identify the type of proxy
72          * i.e. "infrastructure", "transport", etc.
73          */
74         public void setType(String type) {
75                 this.type = type;
76         }
77
78         public ServiceInstance getServiceInstance() {
79                 return serviceInstance;
80         }
81
82         public void setServiceInstance(ServiceInstance serviceInstance) {
83                 this.serviceInstance = serviceInstance;
84         }
85
86         public ModelInfoServiceProxy getModelInfoServiceProxy() {
87                 return modelInfoServiceProxy;
88         }
89
90         public void setModelInfoServiceProxy(ModelInfoServiceProxy modelInfoServiceProxy) {
91                 this.modelInfoServiceProxy = modelInfoServiceProxy;
92         }
93
94         @Override
95         public boolean equals(final Object other){
96                 if(!(other instanceof ServiceProxy)){
97                         return false;
98                 }
99                 ServiceProxy castOther = (ServiceProxy) other;
100                 return new EqualsBuilder().append(id, castOther.id).isEquals();
101         }
102
103         @Override
104         public int hashCode(){
105                 return new HashCodeBuilder().append(id).toHashCode();
106         }
107
108 }