Fix sonar blocker issue in catalog-dao 16/72416/2
authorParshad Patel <pars.patel@samsung.com>
Mon, 12 Nov 2018 10:34:38 +0000 (19:34 +0900)
committerTal Gitelman <tal.gitelman@att.com>
Mon, 19 Nov 2018 16:13:40 +0000 (16:13 +0000)
Override equals() method in GraphRelation.java

Issue-ID: SDC-1895
Change-Id: Ib6538043f81173336c30d6a97545ef036431c79f
Signed-off-by: Parshad Patel <pars.patel@samsung.com>
catalog-dao/src/main/java/org/openecomp/sdc/be/dao/graph/datatype/GraphRelation.java

index 0c6b66f..3249f37 100644 (file)
@@ -22,6 +22,7 @@ package org.openecomp.sdc.be.dao.graph.datatype;
 
 import java.util.HashMap;
 import java.util.Map;
+import org.apache.commons.lang3.builder.EqualsBuilder;
 
 public class GraphRelation extends GraphElement {
 
@@ -105,4 +106,21 @@ public class GraphRelation extends GraphElement {
                result = prime * result + ((type == null) ? 0 : type.hashCode());
                return result;
        }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+
+        if (obj == null)
+            return false;
+
+        if (!(obj instanceof GraphRelation)) {
+            return false;
+        }
+
+        GraphRelation other = (GraphRelation) obj;
+
+        return  new EqualsBuilder().append(from, other.from).append(properties, other.properties).append(to, other.to).append(type, other.type).isEquals();
+    }
 }