Fixed the Sonar technical debt.
[policy/engine.git] / ONAP-REST / src / main / java / org / onap / policy / rest / jpa / ActionBodyEntity.java
index e65b317..9336a90 100644 (file)
@@ -22,6 +22,7 @@ package org.onap.policy.rest.jpa;
  */
 import java.io.Serializable;
 import java.util.Date;
+import java.util.Objects;
 
 import javax.persistence.Column;
 import javax.persistence.Entity;
@@ -41,6 +42,7 @@ import javax.persistence.Version;
  * The Entity class to persist a policy object Action Body
  */
 
+
 import com.fasterxml.jackson.annotation.JsonBackReference;
 
 @Entity
@@ -88,6 +90,7 @@ public class ActionBodyEntity implements Serializable {
        private boolean deleted = false;
 
        public ActionBodyEntity() {
+               //An empty constructor
        }
 
        @PrePersist
@@ -108,7 +111,7 @@ public class ActionBodyEntity implements Serializable {
                return actionBodyId;
        }
        /**
-        * @param configurationDataId the configurationDataId to set
+        * @param name the configuration body name to set
         */
        public void setActionBodyName(String name) {
                this.actionBodyName = name;
@@ -124,7 +127,7 @@ public class ActionBodyEntity implements Serializable {
                return actionBody;
        }
        /**
-        * @param configBody the configBody to set
+        * @param body the configBody to set
         */
        public void setActionBody(String body) {
                this.actionBody = body;
@@ -192,4 +195,33 @@ public class ActionBodyEntity implements Serializable {
        public void setDeleted(boolean deleted) {
                this.deleted = deleted;
        }
+       
+       @Override
+       public int hashCode() {
+       return Objects.hash(actionBodyId, actionBodyName, version, actionBody,
+                       createdBy, createdDate, modifiedBy, modifiedDate, deleted);
+       }
+
+       @Override
+       public boolean equals(Object obj) {
+               if(obj == null){
+                       return false;
+               }
+               if(obj == this){
+                       return true;
+               }
+               if(!(obj instanceof ActionBodyEntity)){
+                       return false;
+               }
+
+               return  actionBodyId == ((ActionBodyEntity) obj).actionBodyId &&
+                               actionBodyName.equals(((ActionBodyEntity) obj).actionBodyName) && 
+                               version == ((ActionBodyEntity) obj).version && 
+                               actionBody.equals(((ActionBodyEntity) obj).actionBody) && 
+                               createdBy.equals(((ActionBodyEntity) obj).createdBy) && 
+                               createdDate.equals(((ActionBodyEntity) obj).createdDate) && 
+                               modifiedBy.equals(((ActionBodyEntity) obj).modifiedBy) &&
+                               modifiedDate.equals(((ActionBodyEntity) obj).modifiedDate) &&
+                               deleted == ((ActionBodyEntity) obj).deleted;
+       }
 }