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;
29 import javax.persistence.Column;
30 import javax.persistence.Entity;
31 import javax.persistence.Id;
32 import javax.persistence.Table;
33 import javax.persistence.Transient;
37 * EntityBean class for a HomingInstance. This bean represents a homing instance of a service, populated on successful
42 @RemoteResource("/homingInstance")
43 @Table(name = "homing_instances")
44 public class HomingInstance {
48 @Column(name = "SERVICE_INSTANCE_ID")
49 private String serviceInstanceId;
51 @JsonProperty("cloud_region_id")
53 @Column(name = "CLOUD_REGION_ID")
54 private String cloudRegionId;
56 @JsonProperty("cloud_owner")
58 @Column(name = "CLOUD_OWNER")
59 private String cloudOwner;
63 @JsonProperty("oof_directives")
65 @Column(name = "OOF_DIRECTIVES", columnDefinition = "LONGTEXT")
66 private String oofDirectives;
71 public HomingInstance() {
75 public HomingInstance(HomingInstance homingInstance) {
76 this.serviceInstanceId = homingInstance.getServiceInstanceId();
77 this.cloudRegionId = homingInstance.getCloudRegionId();
78 this.cloudOwner = homingInstance.getCloudOwner();
79 this.oofDirectives = homingInstance.getOofDirectives();
83 public String getServiceInstanceId() {
84 return this.serviceInstanceId;
87 public void setServiceInstanceId(String serviceInstanceId) {
89 this.serviceInstanceId = serviceInstanceId;
92 public String getCloudRegionId() {
94 return this.cloudRegionId;
97 public void setCloudRegionId(String cloudRegionId) {
99 this.cloudRegionId = cloudRegionId;
102 public String getCloudOwner() {
104 return this.cloudOwner;
107 public void setCloudOwner(String cloudOwner) {
109 this.cloudOwner = cloudOwner;
112 public String getOofDirectives() {
113 return oofDirectives;
116 public void setOofDirectives(String oofDirectives) {
117 this.oofDirectives = oofDirectives;
121 public URI getUri() {
125 public void setUri(URI uri) {
131 public String toString() {
132 return new ToStringBuilder(this).append("serviceInstanceId", serviceInstanceId)
133 .append("cloudRegionId", cloudRegionId).append("cloudOwner", cloudOwner)
134 .append("oofDirectives", oofDirectives).toString();
138 public boolean equals(final Object other) {
139 if (!(other instanceof HomingInstance)) {
142 HomingInstance castOther = (HomingInstance) other;
143 return new EqualsBuilder().append(serviceInstanceId, castOther.serviceInstanceId).isEquals();
147 public int hashCode() {
148 return new HashCodeBuilder().append(serviceInstanceId).toHashCode();