2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2018. Intel Corp. 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=========================================================
20 package org.onap.so.db.catalog.beans;
22 import com.fasterxml.jackson.annotation.JsonProperty;
23 import com.openpojo.business.annotation.BusinessKey;
24 import org.apache.commons.lang3.builder.EqualsBuilder;
25 import org.apache.commons.lang3.builder.HashCodeBuilder;
26 import org.apache.commons.lang3.builder.ToStringBuilder;
27 import uk.co.blackpepper.bowman.annotation.RemoteResource;
28 import uk.co.blackpepper.bowman.annotation.ResourceId;
30 import javax.persistence.Column;
31 import javax.persistence.Entity;
32 import javax.persistence.Id;
33 import javax.persistence.Table;
34 import javax.persistence.Transient;
38 * EntityBean class for a HomingInstance. This bean represents a homing instance
39 * of a service, populated on successful homing
42 @RemoteResource("/homingInstance")
44 @Table(name = "homing_instances")
45 public class HomingInstance {
49 @Column(name = "SERVICE_INSTANCE_ID")
50 private String serviceInstanceId;
52 @JsonProperty("cloud_region_id")
54 @Column(name = "CLOUD_REGION_ID")
55 private String cloudRegionId;
57 @JsonProperty("cloud_owner")
59 @Column(name = "CLOUD_OWNER")
60 private String cloudOwner;
64 @JsonProperty("oof_directives")
66 @Column(name = "OOF_DIRECTIVES", columnDefinition = "LONGTEXT")
67 private String oofDirectives;
72 public HomingInstance () {
76 public HomingInstance (HomingInstance homingInstance) {
77 this.serviceInstanceId = homingInstance.getServiceInstanceId();
78 this.cloudRegionId = homingInstance.getCloudRegionId();
79 this.cloudOwner = homingInstance.getCloudOwner();
80 this.oofDirectives = homingInstance.getOofDirectives();
84 public String getServiceInstanceId() {
85 return this.serviceInstanceId;
88 public void setServiceInstanceId(String serviceInstanceId) {
90 this.serviceInstanceId = serviceInstanceId;
93 public String getCloudRegionId() {
95 return this.cloudRegionId;
98 public void setCloudRegionId(String cloudRegionId) {
100 this.cloudRegionId = cloudRegionId;
103 public String getCloudOwner() {
105 return this.cloudOwner;
108 public void setCloudOwner (String cloudOwner) {
110 this.cloudOwner = cloudOwner;
113 public String getOofDirectives() {
114 return oofDirectives;
117 public void setOofDirectives(String oofDirectives) {
118 this.oofDirectives = oofDirectives;
122 public URI getUri() {
126 public void setUri(URI uri) {
132 public String toString() {
133 return new ToStringBuilder(this).append("serviceInstanceId", serviceInstanceId)
134 .append("cloudRegionId", cloudRegionId)
135 .append("cloudOwner", cloudOwner)
136 .append("oofDirectives", oofDirectives).toString();
140 public boolean equals(final Object other) {
141 if (!(other instanceof HomingInstance)) {
144 HomingInstance castOther = (HomingInstance) other;
145 return new EqualsBuilder().append(serviceInstanceId, castOther.serviceInstanceId).isEquals();
149 public int hashCode() {
150 return new HashCodeBuilder().append(serviceInstanceId).toHashCode();