Merge "Reorder modifiers"
[so.git] / mso-catalog-db / src / main / java / org / openecomp / mso / db / catalog / beans / HeatNestedTemplate.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
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.openecomp.mso.db.catalog.beans;
22
23
24 import java.io.Serializable;
25
26 import com.openpojo.business.annotation.BusinessKey;
27
28 public class HeatNestedTemplate implements Serializable {
29
30         @BusinessKey
31     private String parentTemplateId = null;
32         @BusinessKey
33     private String childTemplateId = null;
34     private String providerResourceFile = null;
35     public static final long serialVersionUID = -1322322139926390329L;
36
37     public HeatNestedTemplate () {
38         super ();
39     }
40
41     public void setParentTemplateId (String parentTemplateId) {
42         this.parentTemplateId = parentTemplateId;
43     }
44
45     public String getParentTemplateId () {
46         return this.parentTemplateId;
47     }
48
49     public void setChildTemplateId (String childTemplateId) {
50         this.childTemplateId = childTemplateId;
51     }
52
53     public String getChildTemplateId () {
54         return this.childTemplateId;
55     }
56
57     public void setProviderResourceFile (String providerResourceFile) {
58         this.providerResourceFile = providerResourceFile;
59     }
60
61     public String getProviderResourceFile () {
62         return this.providerResourceFile;
63     }
64
65     @Override
66     public String toString () {
67         StringBuilder sb = new StringBuilder ();
68         sb.append("ParentTemplateId=").append(this.parentTemplateId);
69         sb.append(", ChildTemplateId=").append(this.childTemplateId);
70         if (this.providerResourceFile == null) {
71             sb.append (", providerResourceFile=null");
72         } else {
73             sb.append(",providerResourceFile=").append(this.providerResourceFile);
74         }
75         return sb.toString ();
76     }
77
78     @Override
79     public boolean equals (Object o) {
80         if (!(o instanceof HeatNestedTemplate)) {
81             return false;
82         }
83         if (this == o) {
84             return true;
85         }
86         HeatNestedTemplate hnt = (HeatNestedTemplate) o;
87         if (hnt.getChildTemplateId () == this.childTemplateId && hnt.getParentTemplateId () == this.parentTemplateId) {
88             return true;
89         }
90         return false;
91     }
92
93     @Override
94     public int hashCode () {
95         // hash code does not have to be a unique result - only that two objects that should be treated as equal
96         // return the same value. so this should work.
97         int result;
98         int parentTemplateIdHash = 0;
99         int childTemplateIdHash = 0;
100         if (this.parentTemplateId != null) {
101                 parentTemplateIdHash = this.parentTemplateId.hashCode();
102         }
103         if (this.childTemplateId != null) {
104                 childTemplateIdHash = this.childTemplateId.hashCode();
105         }
106         result = parentTemplateIdHash + childTemplateIdHash;
107         return result;
108     }
109 }