net.yadaframework.security.persistence.entity.YadaCommentMessage Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of yadawebsecurity Show documentation
Show all versions of yadawebsecurity Show documentation
Yada Framework authentication and authorization component
The newest version!
package net.yadaframework.security.persistence.entity;
import java.util.Set;
import jakarta.persistence.Entity;
import jakarta.persistence.Inheritance;
import jakarta.persistence.InheritanceType;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.JoinTable;
import jakarta.persistence.ManyToMany;
import jakarta.persistence.ManyToOne;
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
public class YadaCommentMessage extends YadaUserMessage {
private static final long serialVersionUID = 1L;
private long totLikes;
private int totReplies; // Counter for comment first-level replies
@ManyToMany
@JoinTable(name="YadaCommentMessageLiked", joinColumns = @JoinColumn(name = "YadaCommentMessage_id"), inverseJoinColumns = @JoinColumn(name = "YadaUserProfile_id"))
private Set likers;
// This message is a reply to another one.
@ManyToOne
protected YadaCommentMessage repliesTo;
public YadaCommentMessage() {
super.setType(YadaUserMessageType.COMMENT);
}
public Set getLikers() {
return likers;
}
public void setLikers(Set likers) {
this.likers = likers;
}
public long getTotLikes() {
return totLikes;
}
public void setTotLikes(long totLikes) {
this.totLikes = totLikes;
}
public int getTotReplies() {
return totReplies;
}
public void setTotReplies(int totReplies) {
this.totReplies = totReplies;
}
}