From 4232125d5be57d2535d1837f26af2b593f603a2c Mon Sep 17 00:00:00 2001
From: tpylak <tpylak>
Date: Tue, 29 Mar 2011 08:25:45 +0000
Subject: [PATCH] LMS-2139 minor: Material hashCode

SVN: 20515
---
 .../generic/shared/basic/dto/Material.java    | 25 ++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/Material.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/Material.java
index 86eeee92e1e..c3771075733 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/Material.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/Material.java
@@ -33,7 +33,7 @@ public class Material extends CodeWithRegistration<Material> implements
 
     private DatabaseInstance databaseInstance;
 
-    private MaterialType MaterialType;
+    private MaterialType materialType;
 
     private Long id;
 
@@ -43,12 +43,12 @@ public class Material extends CodeWithRegistration<Material> implements
 
     public MaterialType getMaterialType()
     {
-        return MaterialType;
+        return materialType;
     }
 
     public void setMaterialType(MaterialType experimentType)
     {
-        this.MaterialType = experimentType;
+        this.materialType = experimentType;
     }
 
     public List<IEntityProperty> getProperties()
@@ -114,6 +114,25 @@ public class Material extends CodeWithRegistration<Material> implements
     // Comparable
     //
 
+    @Override
+    public int hashCode()
+    {
+        return getIdentifier().hashCode();
+    }
+
+    @Override
+    public boolean equals(Object obj)
+    {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        Material other = (Material) obj;
+        return getIdentifier().equals(other.getIdentifier());
+    }
+
     @Override
     public final int compareTo(final Material o)
     {
-- 
GitLab