2 * Copyright 2016-2017 ZTE, Inc. and others.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.onap.msb.sdclient.core;
18 import io.swagger.annotations.ApiModelProperty;
20 import java.io.Serializable;
22 import org.apache.commons.lang3.StringUtils;
23 import org.onap.msb.sdclient.wrapper.consul.model.health.ServiceHealth;
25 import com.google.common.base.Objects;
27 public class PublishFullAddress implements Serializable {
28 private static final long serialVersionUID = 1L;
31 @ApiModelProperty(value = "Service Publish IP")
34 @ApiModelProperty(value = "Service Publish Domain")
35 private String domain;
37 @ApiModelProperty(value = "Service Publish Port", required = true)
40 @ApiModelProperty(value = "Service Publish URL,start with /",example = "/api/serviceName/v1", required = true)
41 private String publish_url;
43 @ApiModelProperty(value = "[visual Range]outSystem:0,inSystem:1", allowableValues = "0,1", example = "1", required = true)
44 private String visualRange;
46 @ApiModelProperty(value = "Service Publish Protocol",allowableValues = "http,https",example = "https", required = true)
47 private String publish_protocol;
49 public String getPublish_protocol() {
50 return publish_protocol;
53 public void setPublish_protocol(String publish_protocol) {
54 this.publish_protocol = publish_protocol;
57 public String getDomain() {
61 public void setDomain(String domain) {
65 public String getPublish_url() {
69 public void setPublish_url(String publish_url) {
70 this.publish_url = publish_url;
73 public String getVisualRange() {
77 public void setVisualRange(String visualRange) {
78 this.visualRange = visualRange;
81 public String getIp() {
85 public void setIp(String ip) {
89 public String getPort() {
93 public void setPort(String port) {
97 public PublishFullAddress(){
101 public PublishFullAddress(String ip,String port,String publish_url,String visualRange,String publish_protocol ){
104 this.publish_url=publish_url;
105 this.visualRange=visualRange;
106 this.publish_protocol=publish_protocol;
110 public boolean equals(Object other)
114 if(other instanceof PublishFullAddress)
116 PublishFullAddress that = (PublishFullAddress)other;
117 return Objects.equal(ip, that.ip)
118 && Objects.equal(domain, that.domain)
119 && Objects.equal(port, that.port)
120 && Objects.equal(publish_url, that.publish_url)
121 && Objects.equal(visualRange, that.visualRange)
122 && Objects.equal(publish_protocol, that.publish_protocol);
130 public int hashCode() {
131 return Objects.hashCode(ip, domain,port,publish_url,visualRange,publish_protocol);
135 public String toString() {
136 // TODO Auto-generated method stub
137 if(StringUtils.isNotBlank(this.domain)){
138 return (new StringBuilder().append(this.publish_protocol).append("://").append(this.domain).append(":").append(this.port).append(this.publish_url)).toString();
141 return (new StringBuilder().append(this.publish_protocol).append("://").append(this.ip).append(":").append(this.port).append(this.publish_url)).toString();