From 7743a511a170ddbd2b9eb77970a54b35c7408e60 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Fri, 26 Sep 2014 11:12:51 +0200 Subject: Switch Collection and Job equals() to Object rather than local. --- src/main/java/com/c2kernel/entity/agent/Job.java | 44 +++++++++++++++++++++--- 1 file changed, 40 insertions(+), 4 deletions(-) (limited to 'src/main/java/com/c2kernel/entity/agent') diff --git a/src/main/java/com/c2kernel/entity/agent/Job.java b/src/main/java/com/c2kernel/entity/agent/Job.java index 0c62bb1..d0d3809 100644 --- a/src/main/java/com/c2kernel/entity/agent/Job.java +++ b/src/main/java/com/c2kernel/entity/agent/Job.java @@ -405,10 +405,46 @@ public class Job implements C2KLocalObject return ClusterStorage.JOB; } - public boolean equals(Job job) - { - return (itemPath.equals(job.getItemPath()) && this.stepPath.equals(job.stepPath) && transition.getId() == job.getTransition().getId()); - } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + + ((itemPath == null) ? 0 : itemPath.hashCode()); + result = prime * result + + ((stepPath == null) ? 0 : stepPath.hashCode()); + result = prime * result + + ((transition == null) ? 0 : transition.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Job other = (Job) obj; + if (itemPath == null) { + if (other.itemPath != null) + return false; + } else if (!itemPath.equals(other.itemPath)) + return false; + if (stepPath == null) { + if (other.stepPath != null) + return false; + } else if (!stepPath.equals(other.stepPath)) + return false; + if (transition == null) { + if (other.transition != null) + return false; + } else if (!transition.equals(other.transition)) + return false; + return true; + } + private void setActProps(CastorHashMap actProps) { this.actProps = actProps; -- cgit v1.2.3