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.vid.mso.rest;
23 import com.fasterxml.jackson.annotation.*;
24 import org.apache.commons.lang.builder.EqualsBuilder;
25 import org.apache.commons.lang.builder.HashCodeBuilder;
26 import org.apache.commons.lang.builder.ToStringBuilder;
27 import org.onap.vid.mso.model.ModelInfo;
29 import java.util.HashMap;
34 * modelInfo and optional instanceId and instanceName for a model related to the modelInfo being operated on.
36 @JsonInclude(JsonInclude.Include.NON_NULL)
42 public class RelatedInstance {
45 * optional name for the instance Id of the related model
48 @JsonProperty("instanceName")
49 private String instanceName;
52 * instance Id for the related model
55 @JsonProperty("instanceId")
56 private String instanceId;
58 /** The model info. */
59 @JsonProperty("modelInfo")
60 private ModelInfo modelInfo;
62 /** The additional properties. */
64 private Map<String, Object> additionalProperties = new HashMap<>();
67 * optional name for the instance Id of the related model
72 @JsonProperty("instanceName")
73 public String getInstanceName() {
78 * optional name for the instance Id of the related model
83 @JsonProperty("instanceName")
84 public void setInstanceName(String instanceName) {
85 this.instanceName = instanceName;
89 * instance Id for the related model
94 @JsonProperty("instanceId")
95 public String getInstanceId() {
100 * instance Id for the related model
105 @JsonProperty("instanceId")
106 public void setInstanceId(String instanceId) {
107 this.instanceId = instanceId;
113 * @return The modelInfo
115 @JsonProperty("modelInfo")
116 public ModelInfo getModelInfo() {
123 * @param modelInfo The modelInfo
125 @JsonProperty("modelInfo")
126 public void setModelInfo(ModelInfo modelInfo) {
127 this.modelInfo = modelInfo;
131 * @see org.onap.vid.domain.mso.RelatedInstance#toString()
134 public String toString() {
135 return ToStringBuilder.reflectionToString(this);
139 * @see org.onap.vid.domain.mso.RelatedInstance#getAdditionalProperties()
142 public Map<String, Object> getAdditionalProperties() {
143 return this.additionalProperties;
147 * @see org.onap.vid.domain.mso.RelatedInstance#setAdditionalProperty(java.lang.String, java.lang.Object)
150 public void setAdditionalProperty(String name, Object value) {
151 this.additionalProperties.put(name, value);
155 * @see org.onap.vid.domain.mso.RelatedInstance#hashCode()
158 public int hashCode() {
159 return new HashCodeBuilder().append(getInstanceName()).append(getInstanceId()).append(modelInfo).append(additionalProperties).toHashCode();
163 * @see org.onap.vid.domain.mso.RelatedInstance#equals(java.lang.Object)
166 public boolean equals(Object other) {
170 if (!(other instanceof RelatedInstance)) {
173 RelatedInstance rhs = ((RelatedInstance) other);
174 return new EqualsBuilder().append(getInstanceName(), rhs.getInstanceName()).append(getInstanceId(), rhs.getInstanceId()).append(modelInfo, rhs.getModelInfo()).append(additionalProperties, rhs.additionalProperties).isEquals();