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;
26 import javax.persistence.Id;
28 import static org.apache.commons.lang3.StringUtils.*;
30 import java.io.Serializable;
31 import java.util.ArrayList;
32 import java.util.List;
34 import org.apache.commons.lang3.builder.EqualsBuilder;
35 import org.apache.commons.lang3.builder.HashCodeBuilder;
36 import org.onap.so.bpmn.servicedecomposition.ShallowCopy;
38 @JsonRootName("vpn-bonding-link")
39 public class VpnBondingLink implements Serializable, ShallowCopy<VpnBondingLink> {
41 private static final long serialVersionUID = -8355973761714642727L;
44 @JsonProperty("vpn-bonding-link-id")
45 private String vpnBondingLinkId;
47 @JsonProperty("configurations")
48 private List<Configuration> configurations = new ArrayList<Configuration>();
50 @JsonProperty("service-proxies")
51 private List<ServiceProxy> serviceProxies = new ArrayList<ServiceProxy>();
53 public String getVpnBondingLinkId() {
54 return vpnBondingLinkId;
57 public void setVpnBondingLinkId(String vpnBondingLinkId) {
58 this.vpnBondingLinkId = vpnBondingLinkId;
61 public List<Configuration> getConfigurations() {
62 return configurations;
65 public List<ServiceProxy> getServiceProxies() {
66 return serviceProxies;
69 public ServiceProxy getServiceProxy(String id) {
70 ServiceProxy serviceProxy = null;
71 for(ServiceProxy s : serviceProxies){
72 if(s.getId().equals(id)){
79 //TODO temp solution until references are updated to use getConfigurationByType
80 public Configuration getVnrConfiguration() {
81 Configuration configuration = null;
82 for(Configuration c:configurations){
83 if(containsIgnoreCase(c.getConfigurationType(), "vlan") || containsIgnoreCase(c.getConfigurationType(), "vnr")){
90 //TODO temp solution until references are updatedd
91 public void setVnrConfiguration(Configuration vnrConfiguration) {
92 if(vnrConfiguration.getConfigurationType() == null){
93 vnrConfiguration.setConfigurationType("vlan");
95 configurations.add(vnrConfiguration);
98 //TODO temp solution until references are updated to use getConfigurationByType
99 public Configuration getVrfConfiguration() {
100 Configuration configuration = null;
101 for(Configuration c:configurations){
102 if(containsIgnoreCase(c.getConfigurationType(), "vrf")){
106 return configuration;
109 //TODO temp solution until references are updated
110 public void setVrfConfiguration(Configuration vrfConfiguration) {
111 if(vrfConfiguration.getConfigurationType() == null){
112 vrfConfiguration.setConfigurationType("vrf");
114 configurations.add(vrfConfiguration);
117 //TODO temp solution until references are updated to use getServiceProxyByType
118 public ServiceProxy getInfrastructureServiceProxy() {
119 ServiceProxy serviceProxy = null;
120 for(ServiceProxy sp:serviceProxies){
121 if(sp.getType().equals("infrastructure")){
128 //TODO temp solution until references are updated
129 public void setInfrastructureServiceProxy(ServiceProxy infrastructureServiceProxy) {
130 infrastructureServiceProxy.setType("infrastructure");
131 serviceProxies.add(infrastructureServiceProxy);
134 //TODO temp solution until references are updated to use getServiceProxyByType
135 public ServiceProxy getTransportServiceProxy() {
136 ServiceProxy serviceProxy = null;
137 for(ServiceProxy sp:serviceProxies){
139 if(sp.getType().equals("transport")){
147 //TODO temp solution until references are updated
148 public void setTransportServiceProxy(ServiceProxy transportServiceProxy) {
149 transportServiceProxy.setType("transport");
150 serviceProxies.add(transportServiceProxy);
154 public boolean equals(final Object other) {
155 if (!(other instanceof VpnBondingLink)) {
158 VpnBondingLink castOther = (VpnBondingLink) other;
159 return new EqualsBuilder().append(vpnBondingLinkId, castOther.vpnBondingLinkId).isEquals();
163 public int hashCode() {
164 return new HashCodeBuilder().append(vpnBondingLinkId).toHashCode();