Change the header to SO
[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 public class HeatNestedTemplate implements Serializable {
27
28     private String parentTemplateId;
29     private String childTemplateId;
30     private String providerResourceFile;
31     public static final long serialVersionUID = -1322322139926390329L;
32
33     public HeatNestedTemplate () {
34         super ();
35     }
36
37     public void setParentTemplateId (String parentTemplateId) {
38         this.parentTemplateId = parentTemplateId;
39     }
40
41     public String getParentTemplateId () {
42         return this.parentTemplateId;
43     }
44
45     public void setChildTemplateId (String childTemplateId) {
46         this.childTemplateId = childTemplateId;
47     }
48
49     public String getChildTemplateId () {
50         return this.childTemplateId;
51     }
52
53     public void setProviderResourceFile (String providerResourceFile) {
54         this.providerResourceFile = providerResourceFile;
55     }
56
57     public String getProviderResourceFile () {
58         return this.providerResourceFile;
59     }
60
61     @Override
62     public String toString () {
63         StringBuilder sb = new StringBuilder ();
64         sb.append ("ParentTemplateId=" + this.parentTemplateId);
65         sb.append (", ChildTemplateId=" + this.childTemplateId);
66         if (this.providerResourceFile == null) {
67             sb.append (", providerResourceFile=null");
68         } else {
69             sb.append (",providerResourceFile=" + this.providerResourceFile);
70         }
71         return sb.toString ();
72     }
73
74     @Override
75     public boolean equals (Object o) {
76         if (!(o instanceof HeatNestedTemplate)) {
77             return false;
78         }
79         if (this == o) {
80             return true;
81         }
82         HeatNestedTemplate hnt = (HeatNestedTemplate) o;
83         if (hnt.getChildTemplateId () == this.childTemplateId && hnt.getParentTemplateId () == this.parentTemplateId) {
84             return true;
85         }
86         return false;
87     }
88
89     @Override
90     public int hashCode () {
91         // hash code does not have to be a unique result - only that two objects that should be treated as equal
92         // return the same value. so this should work.
93         int result = 0;
94         result = this.parentTemplateId.hashCode() + this.childTemplateId.hashCode();
95         return result;
96     }
97 }