aboutsummaryrefslogtreecommitdiff
path: root/juick-common
diff options
context:
space:
mode:
authorGravatar mykhailo.dubovskyi2018-04-18 15:57:53 +0300
committerGravatar Vitaly Takmazov2018-04-20 11:03:47 +0300
commit842e903d5b987dd23e82a423bddae75acdea0c9c (patch)
tree59eabfb9969b6cbe00703674f8d3ddb7d2e029e0 /juick-common
parentef1c674b0dc1979e46e970ad67ccc7a9bb67b001 (diff)
Like -> Reaction
Diffstat (limited to 'juick-common')
-rw-r--r--juick-common/src/main/java/com/juick/Message.java16
-rw-r--r--juick-common/src/main/java/com/juick/Reaction.java45
-rw-r--r--juick-common/src/main/java/com/juick/service/MessagesService.java8
3 files changed, 69 insertions, 0 deletions
diff --git a/juick-common/src/main/java/com/juick/Message.java b/juick-common/src/main/java/com/juick/Message.java
index 72a25dfb..45a0fdd4 100644
--- a/juick-common/src/main/java/com/juick/Message.java
+++ b/juick-common/src/main/java/com/juick/Message.java
@@ -27,7 +27,9 @@ import javax.xml.bind.annotation.*;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.time.Instant;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
/**
* @author Ugnich Anton
@@ -72,9 +74,12 @@ public class Message implements Comparable {
private User to;
private Recommendation Recommendation;
private String replyQuote;
+ @XmlTransient
+ private Set<Reaction> reactions;
public Message() {
tags = new ArrayList<>();
+ reactions = new HashSet<>();
}
@Override
@@ -91,6 +96,7 @@ public class Message implements Comparable {
.append("VisitorCanComment", VisitorCanComment)
.append("replies", replies)
.append("likes", likes)
+ .append("reactions", reactions)
.toString();
}
@@ -301,4 +307,14 @@ public class Message implements Comparable {
public void setUnread(boolean unread) {
this.unread = unread;
}
+
+
+ @XmlTransient
+ public Set<Reaction> getReactions() {
+ return reactions;
+ }
+
+ public void setReactions(Set<Reaction> reactions) {
+ this.reactions = reactions;
+ }
}
diff --git a/juick-common/src/main/java/com/juick/Reaction.java b/juick-common/src/main/java/com/juick/Reaction.java
new file mode 100644
index 00000000..536ac241
--- /dev/null
+++ b/juick-common/src/main/java/com/juick/Reaction.java
@@ -0,0 +1,45 @@
+package com.juick;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+public class Reaction {
+
+ public static final int LIKE = 1;
+
+ private final int id;
+ private String description;
+ private int count;
+
+ public Reaction(int id) {
+ this.id = id;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this)
+ .append("id", getId())
+ .append("description", description)
+ .append("count", count)
+ .build();
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public int getCount() {
+ return count;
+ }
+
+ public void setCount(int count) {
+ this.count = count;
+ }
+
+ public int getId() {
+ return id;
+ }
+}
diff --git a/juick-common/src/main/java/com/juick/service/MessagesService.java b/juick-common/src/main/java/com/juick/service/MessagesService.java
index 34c15271..853e4271 100644
--- a/juick-common/src/main/java/com/juick/service/MessagesService.java
+++ b/juick-common/src/main/java/com/juick/service/MessagesService.java
@@ -17,11 +17,14 @@
package com.juick.service;
+import com.juick.Reaction;
import com.juick.User;
import com.juick.server.helpers.ResponseReply;
import java.util.Collection;
import java.util.List;
+import java.util.Map;
+import java.util.Set;
/**
* Created by aalexeev on 11/13/16.
@@ -41,6 +44,9 @@ public interface MessagesService {
RecommendStatus recommendMessage(int mid, int vuid);
+ RecommendStatus likeMessage(int mid, int vuid, int reactionId);
+
+
boolean canViewThread(int mid, int uid);
boolean isReadOnly(int mid);
@@ -95,6 +101,8 @@ public interface MessagesService {
List<com.juick.Message> getMessages(List<Integer> mids);
+ Map<Integer,Set<Reaction>> updateReactionsFor(final List<Integer> mid);
+
List<com.juick.Message> getReplies(User user, int mid);
boolean setMessagePopular(int mid, int popular);