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.openecomp.mso.db.catalog.beans;
24 import java.io.Serializable;
26 import com.openpojo.business.annotation.BusinessKey;
28 public class HeatNestedTemplate implements Serializable {
31 private String parentTemplateId = null;
33 private String childTemplateId = null;
34 private String providerResourceFile = null;
35 public static final long serialVersionUID = -1322322139926390329L;
37 public HeatNestedTemplate () {
41 public void setParentTemplateId (String parentTemplateId) {
42 this.parentTemplateId = parentTemplateId;
45 public String getParentTemplateId () {
46 return this.parentTemplateId;
49 public void setChildTemplateId (String childTemplateId) {
50 this.childTemplateId = childTemplateId;
53 public String getChildTemplateId () {
54 return this.childTemplateId;
57 public void setProviderResourceFile (String providerResourceFile) {
58 this.providerResourceFile = providerResourceFile;
61 public String getProviderResourceFile () {
62 return this.providerResourceFile;
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");
73 sb.append(",providerResourceFile=").append(this.providerResourceFile);
75 return sb.toString ();
79 public boolean equals (Object o) {
80 if (!(o instanceof HeatNestedTemplate)) {
86 HeatNestedTemplate hnt = (HeatNestedTemplate) o;
87 if (hnt.getChildTemplateId () == this.childTemplateId && hnt.getParentTemplateId () == this.parentTemplateId) {
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.
98 int parentTemplateIdHash = 0;
99 int childTemplateIdHash = 0;
100 if (this.parentTemplateId != null) {
101 parentTemplateIdHash = this.parentTemplateId.hashCode();
103 if (this.childTemplateId != null) {
104 childTemplateIdHash = this.childTemplateId.hashCode();
106 result = parentTemplateIdHash + childTemplateIdHash;