2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.onap.so.bpmn.servicedecomposition.bbobjects;
23 import com.fasterxml.jackson.annotation.JsonProperty;
24 import com.fasterxml.jackson.annotation.JsonRootName;
25 import javax.persistence.Id;
26 import static org.apache.commons.lang3.StringUtils.*;
27 import java.io.Serializable;
28 import java.util.ArrayList;
29 import java.util.List;
30 import org.apache.commons.lang3.builder.EqualsBuilder;
31 import org.apache.commons.lang3.builder.HashCodeBuilder;
32 import org.onap.so.bpmn.servicedecomposition.ShallowCopy;
34 @JsonRootName("vpn-bonding-link")
35 public class VpnBondingLink implements Serializable, ShallowCopy<VpnBondingLink> {
37 private static final long serialVersionUID = -8355973761714642727L;
40 @JsonProperty("vpn-bonding-link-id")
41 private String vpnBondingLinkId;
43 @JsonProperty("configurations")
44 private List<Configuration> configurations = new ArrayList<Configuration>();
46 @JsonProperty("service-proxies")
47 private List<ServiceProxy> serviceProxies = new ArrayList<ServiceProxy>();
49 public String getVpnBondingLinkId() {
50 return vpnBondingLinkId;
53 public void setVpnBondingLinkId(String vpnBondingLinkId) {
54 this.vpnBondingLinkId = vpnBondingLinkId;
57 public List<Configuration> getConfigurations() {
58 return configurations;
61 public List<ServiceProxy> getServiceProxies() {
62 return serviceProxies;
65 public ServiceProxy getServiceProxy(String id) {
66 ServiceProxy serviceProxy = null;
67 for (ServiceProxy s : serviceProxies) {
68 if (s.getId().equals(id)) {
75 // TODO temp solution until references are updated to use getConfigurationByType
76 public Configuration getVnrConfiguration() {
77 Configuration configuration = null;
78 for (Configuration c : configurations) {
79 if (containsIgnoreCase(c.getConfigurationType(), "vlan")
80 || containsIgnoreCase(c.getConfigurationType(), "vnr")) {
87 // TODO temp solution until references are updatedd
88 public void setVnrConfiguration(Configuration vnrConfiguration) {
89 if (vnrConfiguration.getConfigurationType() == null) {
90 vnrConfiguration.setConfigurationType("vlan");
92 configurations.add(vnrConfiguration);
95 // TODO temp solution until references are updated to use getConfigurationByType
96 public Configuration getVrfConfiguration() {
97 Configuration configuration = null;
98 for (Configuration c : configurations) {
99 if (containsIgnoreCase(c.getConfigurationType(), "vrf")) {
103 return configuration;
106 // TODO temp solution until references are updated
107 public void setVrfConfiguration(Configuration vrfConfiguration) {
108 if (vrfConfiguration.getConfigurationType() == null) {
109 vrfConfiguration.setConfigurationType("vrf");
111 configurations.add(vrfConfiguration);
114 // TODO temp solution until references are updated to use getServiceProxyByType
115 public ServiceProxy getInfrastructureServiceProxy() {
116 ServiceProxy serviceProxy = null;
117 for (ServiceProxy sp : serviceProxies) {
118 if (sp.getType().equals("infrastructure")) {
125 // TODO temp solution until references are updated
126 public void setInfrastructureServiceProxy(ServiceProxy infrastructureServiceProxy) {
127 infrastructureServiceProxy.setType("infrastructure");
128 serviceProxies.add(infrastructureServiceProxy);
131 // TODO temp solution until references are updated to use getServiceProxyByType
132 public ServiceProxy getTransportServiceProxy() {
133 ServiceProxy serviceProxy = null;
134 for (ServiceProxy sp : serviceProxies) {
136 if (sp.getType().equals("transport")) {
144 // TODO temp solution until references are updated
145 public void setTransportServiceProxy(ServiceProxy transportServiceProxy) {
146 transportServiceProxy.setType("transport");
147 serviceProxies.add(transportServiceProxy);
151 public boolean equals(final Object other) {
152 if (!(other instanceof VpnBondingLink)) {
155 VpnBondingLink castOther = (VpnBondingLink) other;
156 return new EqualsBuilder().append(vpnBondingLinkId, castOther.vpnBondingLinkId).isEquals();
160 public int hashCode() {
161 return new HashCodeBuilder().append(vpnBondingLinkId).toHashCode();