killbill-uncached

overdue: util: add missing equals() methods in notification

2/18/2013 9:54:46 PM

Details

diff --git a/overdue/src/main/java/com/ning/billing/ovedue/notification/OverdueCheckNotificationKey.java b/overdue/src/main/java/com/ning/billing/ovedue/notification/OverdueCheckNotificationKey.java
index 1ccd589..72e4f63 100644
--- a/overdue/src/main/java/com/ning/billing/ovedue/notification/OverdueCheckNotificationKey.java
+++ b/overdue/src/main/java/com/ning/billing/ovedue/notification/OverdueCheckNotificationKey.java
@@ -18,19 +18,19 @@ package com.ning.billing.ovedue.notification;
 
 import java.util.UUID;
 
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
 import com.ning.billing.junction.api.Blockable;
 import com.ning.billing.util.notificationq.DefaultUUIDNotificationKey;
 
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
 public class OverdueCheckNotificationKey extends DefaultUUIDNotificationKey {
 
     private final Blockable.Type type;
 
     @JsonCreator
-    public OverdueCheckNotificationKey(@JsonProperty("uuidKey") UUID uuidKey,
-            @JsonProperty("type") Blockable.Type type) {
+    public OverdueCheckNotificationKey(@JsonProperty("uuidKey") final UUID uuidKey,
+                                       @JsonProperty("type") final Blockable.Type type) {
         super(uuidKey);
         this.type = type;
     }
@@ -39,4 +39,42 @@ public class OverdueCheckNotificationKey extends DefaultUUIDNotificationKey {
     public Blockable.Type getType() {
         return type == null ? Blockable.Type.SUBSCRIPTION_BUNDLE : type;
     }
+
+    @Override
+    public boolean equals(final Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
+        if (!super.equals(o)) {
+            return false;
+        }
+
+        final OverdueCheckNotificationKey that = (OverdueCheckNotificationKey) o;
+
+        if (type != that.type) {
+            return false;
+        }
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = super.hashCode();
+        result = 31 * result + (type != null ? type.hashCode() : 0);
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        final StringBuilder sb = new StringBuilder();
+        sb.append("OverdueCheckNotificationKey");
+        sb.append("{type=").append(type);
+        sb.append(", uuidKey=").append(getUuidKey());
+        sb.append('}');
+        return sb.toString();
+    }
 }
diff --git a/util/src/main/java/com/ning/billing/util/notificationq/DefaultNotification.java b/util/src/main/java/com/ning/billing/util/notificationq/DefaultNotification.java
index c5310a4..7a1ca37 100644
--- a/util/src/main/java/com/ning/billing/util/notificationq/DefaultNotification.java
+++ b/util/src/main/java/com/ning/billing/util/notificationq/DefaultNotification.java
@@ -148,4 +148,101 @@ public class DefaultNotification extends EntityBase implements Notification {
     public Long getTenantRecordId() {
         return tenantRecordId;
     }
+
+    @Override
+    public boolean equals(final Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
+        if (!super.equals(o)) {
+            return false;
+        }
+
+        final DefaultNotification that = (DefaultNotification) o;
+
+        if (ordering != that.ordering) {
+            return false;
+        }
+        if (accountRecordId != null ? !accountRecordId.equals(that.accountRecordId) : that.accountRecordId != null) {
+            return false;
+        }
+        if (createdOwner != null ? !createdOwner.equals(that.createdOwner) : that.createdOwner != null) {
+            return false;
+        }
+        if (effectiveDate != null ? !effectiveDate.equals(that.effectiveDate) : that.effectiveDate != null) {
+            return false;
+        }
+        if (futureUserToken != null ? !futureUserToken.equals(that.futureUserToken) : that.futureUserToken != null) {
+            return false;
+        }
+        if (lifecycleState != that.lifecycleState) {
+            return false;
+        }
+        if (nextAvailableDate != null ? !nextAvailableDate.equals(that.nextAvailableDate) : that.nextAvailableDate != null) {
+            return false;
+        }
+        if (notificationKey != null ? !notificationKey.equals(that.notificationKey) : that.notificationKey != null) {
+            return false;
+        }
+        if (notificationKeyClass != null ? !notificationKeyClass.equals(that.notificationKeyClass) : that.notificationKeyClass != null) {
+            return false;
+        }
+        if (owner != null ? !owner.equals(that.owner) : that.owner != null) {
+            return false;
+        }
+        if (queueName != null ? !queueName.equals(that.queueName) : that.queueName != null) {
+            return false;
+        }
+        if (tenantRecordId != null ? !tenantRecordId.equals(that.tenantRecordId) : that.tenantRecordId != null) {
+            return false;
+        }
+        if (userToken != null ? !userToken.equals(that.userToken) : that.userToken != null) {
+            return false;
+        }
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = super.hashCode();
+        result = 31 * result + (int) (ordering ^ (ordering >>> 32));
+        result = 31 * result + (owner != null ? owner.hashCode() : 0);
+        result = 31 * result + (createdOwner != null ? createdOwner.hashCode() : 0);
+        result = 31 * result + (queueName != null ? queueName.hashCode() : 0);
+        result = 31 * result + (nextAvailableDate != null ? nextAvailableDate.hashCode() : 0);
+        result = 31 * result + (lifecycleState != null ? lifecycleState.hashCode() : 0);
+        result = 31 * result + (notificationKeyClass != null ? notificationKeyClass.hashCode() : 0);
+        result = 31 * result + (notificationKey != null ? notificationKey.hashCode() : 0);
+        result = 31 * result + (userToken != null ? userToken.hashCode() : 0);
+        result = 31 * result + (futureUserToken != null ? futureUserToken.hashCode() : 0);
+        result = 31 * result + (effectiveDate != null ? effectiveDate.hashCode() : 0);
+        result = 31 * result + (accountRecordId != null ? accountRecordId.hashCode() : 0);
+        result = 31 * result + (tenantRecordId != null ? tenantRecordId.hashCode() : 0);
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        final StringBuilder sb = new StringBuilder();
+        sb.append("DefaultNotification");
+        sb.append("{ordering=").append(ordering);
+        sb.append(", owner='").append(owner).append('\'');
+        sb.append(", createdOwner='").append(createdOwner).append('\'');
+        sb.append(", queueName='").append(queueName).append('\'');
+        sb.append(", nextAvailableDate=").append(nextAvailableDate);
+        sb.append(", lifecycleState=").append(lifecycleState);
+        sb.append(", notificationKeyClass='").append(notificationKeyClass).append('\'');
+        sb.append(", notificationKey='").append(notificationKey).append('\'');
+        sb.append(", userToken=").append(userToken);
+        sb.append(", futureUserToken=").append(futureUserToken);
+        sb.append(", effectiveDate=").append(effectiveDate);
+        sb.append(", accountRecordId=").append(accountRecordId);
+        sb.append(", tenantRecordId=").append(tenantRecordId);
+        sb.append('}');
+        return sb.toString();
+    }
 }
diff --git a/util/src/main/java/com/ning/billing/util/notificationq/DefaultUUIDNotificationKey.java b/util/src/main/java/com/ning/billing/util/notificationq/DefaultUUIDNotificationKey.java
index 2c1203d..59573e1 100644
--- a/util/src/main/java/com/ning/billing/util/notificationq/DefaultUUIDNotificationKey.java
+++ b/util/src/main/java/com/ning/billing/util/notificationq/DefaultUUIDNotificationKey.java
@@ -13,6 +13,7 @@
  * License for the specific language governing permissions and limitations
  * under the License.
  */
+
 package com.ning.billing.util.notificationq;
 
 import java.util.UUID;
@@ -23,7 +24,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
 public class DefaultUUIDNotificationKey implements NotificationKey {
 
     private final UUID uuidKey;
-    
+
     @JsonCreator
     public DefaultUUIDNotificationKey(@JsonProperty("uuidKey") final UUID uuidKey) {
         this.uuidKey = uuidKey;
@@ -42,19 +43,24 @@ public class DefaultUUIDNotificationKey implements NotificationKey {
     }
 
     @Override
-    public boolean equals(Object obj) {
-        if (this == obj)
+    public boolean equals(final Object obj) {
+        if (this == obj) {
             return true;
-        if (obj == null)
+        }
+        if (obj == null) {
             return false;
-        if (getClass() != obj.getClass())
+        }
+        if (getClass() != obj.getClass()) {
             return false;
-        DefaultUUIDNotificationKey other = (DefaultUUIDNotificationKey) obj;
+        }
+        final DefaultUUIDNotificationKey other = (DefaultUUIDNotificationKey) obj;
         if (uuidKey == null) {
-            if (other.uuidKey != null)
+            if (other.uuidKey != null) {
                 return false;
-        } else if (!uuidKey.equals(other.uuidKey))
+            }
+        } else if (!uuidKey.equals(other.uuidKey)) {
             return false;
+        }
         return true;
     }
 }