package com.bubbles.server.domain;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import javax.persistence.*;
import java.util.Date;

/**
 * Created by LMSH on 2015/5/21.
 */
@Entity
@Cacheable
@JsonIgnoreProperties({"parentBubble"})
public class Bubble {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long id;

    private Long parentId; // may be null; null represents main bubble, else reply

    @ManyToOne(optional = false)
    @JoinColumn(name = "author_id")
    private User user;

    private String content;

    private int replyNum;
    private int score;

    private Date timestamp;
    private Date lastReplyTime;

    private Double latitude;
    private Double longitude;

    private int distance;

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public Long getParentId() {
        return parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public int getReplyNum() {
        return replyNum;
    }

    public void setReplyNum(int replyNum) {
        this.replyNum = replyNum;
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
    }

    public Date getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(Date timestamp) {
        this.timestamp = timestamp;
    }

    public Date getLastReplyTime() {
        return lastReplyTime;
    }

    public void setLastReplyTime(Date lastReplyTime) {
        this.lastReplyTime = lastReplyTime;
    }

    public Double getLatitude() {
        return latitude;
    }

    public void setLatitude(Double latitude) {
        this.latitude = latitude;
    }

    public Double getLongitude() {
        return longitude;
    }

    public void setLongitude(Double longitude) {
        this.longitude = longitude;
    }

    public int getDistance() {
        return distance;
    }

    public void setDistance(int distance) {
        this.distance = distance;
    }

}

@@ -155,37 +155,70 @@
 %0A * 
-Created by LMSH on 2015/5/21.
+Entity Bubble, mapped to table bubble.%0A * @author Mingshan Lei
 %0A */
@@ -467,16 +467,49 @@
 se reply
+%0A    private Long parentBubbleId;
 %0A%0A    @M
@@ -1078,32 +1078,218 @@
 arentId;%0A    %7D%0A%0A
+    public Long getParentBubbleId() %7B%0A        return parentBubbleId;%0A    %7D%0A%0A    public void setParentBubbleId(Long parentBubbleId) %7B%0A        this.parentBubbleId = parentBubbleId;%0A    %7D%0A%0A
     public User 

add new field parentBubbleId