From b618230ea1ea81dfd8e68a6e6b7a4130a63b6c26 Mon Sep 17 00:00:00 2001 From: Darshana Gunawardana Date: Wed, 17 Apr 2024 17:06:09 +0530 Subject: [PATCH] Implement equals & hashCode methods for NotificationTemplate --- .../model/NotificationTemplate.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/components/org.wso2.carbon.identity.governance/src/main/java/org/wso2/carbon/identity/governance/model/NotificationTemplate.java b/components/org.wso2.carbon.identity.governance/src/main/java/org/wso2/carbon/identity/governance/model/NotificationTemplate.java index c05144cfa5..956e258683 100644 --- a/components/org.wso2.carbon.identity.governance/src/main/java/org/wso2/carbon/identity/governance/model/NotificationTemplate.java +++ b/components/org.wso2.carbon.identity.governance/src/main/java/org/wso2/carbon/identity/governance/model/NotificationTemplate.java @@ -15,6 +15,8 @@ */ package org.wso2.carbon.identity.governance.model; +import java.util.Objects; + /** * Object which encapsulates notification template properties. */ @@ -188,4 +190,36 @@ public void setBody(String body) { this.body = body; } + + @Override + public boolean equals(java.lang.Object o) { + + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + + if (!super.equals(o)) { + return false; + } + + NotificationTemplate notificationTemplate = (NotificationTemplate) o; + return Objects.equals(this.type, notificationTemplate.type) && + Objects.equals(this.displayName, notificationTemplate.displayName) && + Objects.equals(this.locale, notificationTemplate.locale) && + Objects.equals(this.body, notificationTemplate.body) && + Objects.equals(this.contentType, notificationTemplate.contentType) && + Objects.equals(this.notificationChannel, notificationTemplate.notificationChannel) && + Objects.equals(this.subject, notificationTemplate.subject) && + Objects.equals(this.footer, notificationTemplate.footer); + } + + @Override + public int hashCode() { + + return Objects.hash(type, displayName, locale, body, contentType, notificationChannel, subject, footer); + } }