package net.researchgate.restler.domain;

import org.mongodb.morphia.annotations.Entity;
import org.mongodb.morphia.annotations.Id;

import java.util.Objects;

/**
 * Publication entity
 */
@Entity("publications")
public class Publication {
    @Id
    private Long publicationUid;

    private String title;

    public Long getPublicationUid() {
        return publicationUid;
    }

    public void setPublicationUid(Long publicationUid) {
        this.publicationUid = publicationUid;
    }

    public String getTitle() {
        return title;
    }

    public String lastModificationClientId;

    public void setTitle(String title) {
        this.title = title;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Publication that = (Publication) o;

        if (publicationUid != null ? !publicationUid.equals(that.publicationUid) : that.publicationUid != null)
            return false;
        if (title != null ? !title.equals(that.title) : that.title != null) return false;
        return Objects.equals(lastModificationClientId, that.lastModificationClientId);

    }

    @Override
    public int hashCode() {
        int result = publicationUid != null ? publicationUid.hashCode() : 0;
        result = 31 * result + (title != null ? title.hashCode() : 0);
        result = 31 * result + (lastModificationClientId != null ? lastModificationClientId.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "Publication{" +
                "publicationUid=" + publicationUid +
                ", title='" + title + '\'' +
                ", lastModificationClientId=" + lastModificationClientId +
                '}';
    }

    public String getLastModificationClientId() {
        return lastModificationClientId;
    }

    public void setLastModificationClientId(String lastModificationClientId) {
        this.lastModificationClientId = lastModificationClientId;
    }
}

@@ -275,17 +275,16 @@
 ionUid;%0A
-%0A
     priv
@@ -300,16 +300,61 @@
 g title;
+%0A    private String lastModificationClientId;
 %0A%0A    pu
@@ -597,53 +597,8 @@
  %7D%0A%0A
-    public String lastModificationClientId;%0A%0A
     
@@ -661,32 +661,282 @@
 = title;%0A    %7D%0A%0A
+    public String getLastModificationClientId() %7B%0A        return lastModificationClientId;%0A    %7D%0A%0A    public void setLastModificationClientId(String lastModificationClientId) %7B%0A        this.lastModificationClientId = lastModificationClientId;%0A    %7D%0A%0A
     @Override%0A  
@@ -1074,17 +1074,16 @@
  false;%0A
-%0A
         
@@ -1118,25 +1118,24 @@
 ion) o;%0A
-%0A
         
 if (publ
@@ -1130,60 +1130,30 @@
     
-if (publicationUid != null ? !publicationUid
+return Objects
 .equals(
 that
@@ -1148,21 +1148,16 @@
 .equals(
-that.
 publicat
@@ -1162,19 +1162,17 @@
 ationUid
-) :
+,
  that.pu
@@ -1183,25 +1183,20 @@
 ationUid
- != null)
+) &&
 %0A       
@@ -1204,64 +1204,27 @@
     
-return false;%0A        if (title != null ? !title
+    Objects
 .equals(
 that
@@ -1223,21 +1223,14 @@
 als(
-that.
 title
-) :
+,
  tha
@@ -1240,40 +1240,28 @@
 itle
- != null) return false;%0A
+) &&%0A       
         
 retu
@@ -1248,38 +1248,32 @@
 %0A               
-return
  Objects.equals(
@@ -1330,17 +1330,16 @@
 entId);%0A
-%0A
     %7D%0A%0A 
@@ -1391,278 +1391,76 @@
     
-int result = publicationUid != null ? publicationUid.hashCode() : 0;%0A        result = 31 * result + (title != null ? title.hashCode() : 0);%0A        result = 31 * result + (lastModificationClientId != null ? lastModificationClientId.hashCode() : 0);%0A        return result
+return Objects.hash(publicationUid, title, lastModificationClientId)
 ;%0A  
@@ -1744,257 +1744,7 @@
    %7D
-%0A%0A    public String getLastModificationClientId() %7B%0A        return lastModificationClientId;%0A    %7D%0A%0A    public void setLastModificationClientId(String lastModificationClientId) %7B%0A        this.lastModificationClientId = lastModificationClientId;%0A    %7D
 %0A%7D%0A

clean publicaiton entity