org.onap migration
[vid.git] / vid-app-common / src / main / java / org / onap / vid / mso / rest / RelatedModel.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * VID
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.onap.vid.mso.rest;
22
23 import java.util.HashMap;
24 import java.util.Map;
25 import com.fasterxml.jackson.annotation.JsonAnyGetter;
26 import com.fasterxml.jackson.annotation.JsonAnySetter;
27 import com.fasterxml.jackson.annotation.JsonIgnore;
28 import com.fasterxml.jackson.annotation.JsonInclude;
29 import com.fasterxml.jackson.annotation.JsonProperty;
30 import com.fasterxml.jackson.annotation.JsonPropertyOrder;
31 import org.apache.commons.lang.builder.EqualsBuilder;
32 import org.apache.commons.lang.builder.HashCodeBuilder;
33 import org.apache.commons.lang.builder.ToStringBuilder;
34
35
36 /**
37  * modelInfo and optional instance id for a model related to the modelInfo being operated on.
38  */
39 @JsonInclude(JsonInclude.Include.NON_NULL)
40 @JsonPropertyOrder({
41     "instanceId",
42     "modelInfo"
43 })
44 public class RelatedModel extends org.onap.vid.domain.mso.RelatedModel {
45     
46     /** (Required). */
47     @JsonProperty("modelInfo")
48     private org.onap.vid.domain.mso.ModelInfo modelInfo;
49
50 //    /** The related model object instance list. */
51 //    @JsonProperty("instanceId")
52 //    private org.openecomp.vid.domain.mso.InstanceIds instanceId;
53     
54     /** The additional properties. */
55     @JsonIgnore
56     private Map<String, Object> additionalProperties = new HashMap<String, Object>();
57
58     /**
59      * (Required).
60      *
61      * @return     The modelInfo
62      */
63     @JsonProperty("modelInfo")
64     public org.onap.vid.domain.mso.ModelInfo getModelInfo() {
65         return modelInfo;
66     }
67
68     /**
69      * (Required).
70      *
71      * @param modelInfo     The modelInfo
72      */
73     @JsonProperty("modelInfo")
74     public void setModelInfo(org.onap.vid.domain.mso.ModelInfo modelInfo) {
75         this.modelInfo = modelInfo;
76     }
77
78     /* (non-Javadoc)
79      * @see org.openecomp.vid.domain.mso.RelatedModel#toString()
80      */
81     @Override
82     public String toString() {
83         return ToStringBuilder.reflectionToString(this);
84     }
85
86     /* (non-Javadoc)
87      * @see org.openecomp.vid.domain.mso.RelatedModel#getAdditionalProperties()
88      */
89     @JsonAnyGetter
90     public Map<String, Object> getAdditionalProperties() {
91         return this.additionalProperties;
92     }
93
94     /* (non-Javadoc)
95      * @see org.openecomp.vid.domain.mso.RelatedModel#setAdditionalProperty(java.lang.String, java.lang.Object)
96      */
97     @JsonAnySetter
98     public void setAdditionalProperty(String name, Object value) {
99         this.additionalProperties.put(name, value);
100     }
101
102     /* (non-Javadoc)
103      * @see org.openecomp.vid.domain.mso.RelatedModel#hashCode()
104      */
105     @Override
106     public int hashCode() {
107         return new HashCodeBuilder().append(getInstanceId()).append(modelInfo).append(additionalProperties).toHashCode();
108     }
109
110     /* (non-Javadoc)
111      * @see org.openecomp.vid.domain.mso.RelatedModel#equals(java.lang.Object)
112      */
113     @Override
114     public boolean equals(Object other) {
115         if (other == this) {
116             return true;
117         }
118         if ((other instanceof RelatedModel) == false) {
119             return false;
120         }
121         RelatedModel rhs = ((RelatedModel) other);
122         return new EqualsBuilder().append(getInstanceId(), rhs.getInstanceId()).append(modelInfo, rhs.modelInfo).append(additionalProperties, rhs.additionalProperties).isEquals();
123     }
124
125 }