2 * Copyright 2016-2017 ZTE, Inc. and others.
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5 * in compliance with the License. You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software distributed under the License
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11 * or implied. See the License for the specific language governing permissions and limitations under
14 package org.onap.msb.sdclient.core;
16 import java.io.Serializable;
18 import org.apache.commons.lang3.StringUtils;
20 import com.google.common.base.Objects;
22 import io.swagger.annotations.ApiModelProperty;
24 public class PublishFullAddress implements Serializable {
25 private static final long serialVersionUID = 1L;
28 @ApiModelProperty(value = "Service Publish IP")
31 @ApiModelProperty(value = "Service Publish Domain")
32 private String domain;
34 @ApiModelProperty(value = "Service Publish Port", required = true)
37 @ApiModelProperty(value = "Service Publish URL,start with /", example = "/api/serviceName/v1", required = true)
38 private String publish_url;
40 @ApiModelProperty(value = "[visual Range]outSystem:0,inSystem:1", allowableValues = "0,1", example = "1",
42 private String visualRange;
44 @ApiModelProperty(value = "Service Publish Protocol", allowableValues = "http,https", example = "https",
46 private String publish_protocol;
48 public String getPublish_protocol() {
49 return publish_protocol;
52 public void setPublish_protocol(String publish_protocol) {
53 this.publish_protocol = publish_protocol;
56 public String getDomain() {
60 public void setDomain(String domain) {
64 public String getPublish_url() {
68 public void setPublish_url(String publish_url) {
69 this.publish_url = publish_url;
72 public String getVisualRange() {
76 public void setVisualRange(String visualRange) {
77 this.visualRange = visualRange;
80 public String getIp() {
84 public void setIp(String ip) {
88 public String getPort() {
92 public void setPort(String port) {
96 public PublishFullAddress() {
100 public PublishFullAddress(String ip, String port, String publish_url, String visualRange, String publish_protocol) {
103 this.publish_url = publish_url;
104 this.visualRange = visualRange;
105 this.publish_protocol = publish_protocol;
109 public boolean equals(Object other) {
112 if (other instanceof PublishFullAddress) {
113 PublishFullAddress that = (PublishFullAddress) other;
114 return Objects.equal(ip, that.ip) && Objects.equal(domain, that.domain) && Objects.equal(port, that.port)
115 && Objects.equal(publish_url, that.publish_url)
116 && Objects.equal(visualRange, that.visualRange)
117 && Objects.equal(publish_protocol, that.publish_protocol);
124 public int hashCode() {
125 return Objects.hashCode(ip, domain, port, publish_url, visualRange, publish_protocol);
129 public String toString() {
130 // TODO Auto-generated method stub
131 if (StringUtils.isNotBlank(this.domain)) {
132 return (new StringBuilder().append(this.publish_protocol).append("://").append(this.domain).append(":")
133 .append(this.port).append(this.publish_url)).toString();
135 return (new StringBuilder().append(this.publish_protocol).append("://").append(this.ip).append(":")
136 .append(this.port).append(this.publish_url)).toString();