1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
/*
* Copyright (C) 2008-2019, Juick
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.juick.service;
import com.juick.Message;
import com.juick.Reaction;
import com.juick.User;
import com.juick.model.ResponseReply;
import org.apache.commons.lang3.tuple.Pair;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import java.net.URI;
import java.util.*;
/**
* Created by aalexeev on 11/13/16.
*/
public interface MessagesService {
@CacheEvict(value = { "discussions", "messages", "replies" }, allEntries = true)
int createMessage(int uid, String txt, String attachment, List<com.juick.Tag> tags);
@CacheEvict(value = { "discussions", "messages", "replies" }, allEntries = true)
int createReply(int mid, int rid, User user, String txt, String attachment);
int getReplyIDIncrement(int mid);
enum RecommendStatus {
Error,
Added,
Deleted
}
RecommendStatus recommendMessage(int mid, int vuid, String userUri);
RecommendStatus recommendMessage(int mid, int vuid);
List<Reaction> listReactions();
RecommendStatus likeMessage(int mid, int vuid, Integer reaction);
RecommendStatus likeMessage(int mid, int vuid, Integer reaction, String userUri);
boolean canViewThread(int mid, int uid);
boolean isReadOnly(int mid);
boolean isSubscribed(int uid, int mid);
int getMessagePrivacy(int mid);
Optional<Message> getMessage(int mid);
com.juick.Message getReply(int mid, int rid);
com.juick.Message getReplyByUri(String replyUri);
User getMessageAuthor(int mid);
List<Pair<Integer, User>> getMessagesRecommendations(Collection<Integer> mids);
List<Integer> getAll(int visitorUid, int before);
List<Integer> getTag(int tid, int visitorUid, int before, int cnt);
List<Integer> getTags(String tids, int visitorUid, int before, int cnt);
List<Integer> getPlace(int placeId, int visitorUid, int before);
List<Integer> getMyFeed(int uid, int before, boolean recommended);
List<Integer> getPrivate(int uid, int before);
@Cacheable(value = "discussions", key="#uid + #to")
List<Integer> getDiscussions(int uid, Long to);
List<Integer> getRecommended(int uid, int before);
List<Integer> getPopular(int visitorUid, int before);
List<Integer> getPhotos(int visitorUid, int before);
List<Integer> getSearch(User visitor, String search, int page);
List<Integer> getUserBlog(int uid, int privacy, int before);
List<Integer> getUserTag(int uid, int tid, int privacy, int before);
List<Integer> getUserBlogAtDay(int uid, int privacy, int daysback);
List<Integer> getUserBlogWithRecommendations(int uid, int privacy, int before);
List<Integer> getUserRecommendations(int uid, int before);
List<Integer> getUserPhotos(int uid, int privacy, int before);
List<Integer> getUserSearch(User visitor, int UID, String search, int privacy, int page);
@Cacheable(value = "messages", key="#visitor.uid + #mids.hashCode()")
List<com.juick.Message> getMessages(User visitor, List<Integer> mids);
Map<Integer,Set<Reaction>> updateReactionsFor(final List<Integer> mid);
@Cacheable(value = "replies", key="#user.uid + #mid")
List<com.juick.Message> getReplies(User user, int mid);
boolean setMessagePopular(int mid, int popular);
boolean setMessagePrivacy(int mid);
boolean deleteMessage(int uid, int mid);
boolean deleteReply(int uid, int mid, int rid);
List<Integer> getLastMessages(int hours);
List<ResponseReply> getLastReplies(int hours);
List<Integer> getPopularCandidates();
void setLastReadComment(User user, Integer mid, Integer rid);
void setRead(User user, Integer mid);
List<Integer> getUnread(User user);
boolean updateMessage(Integer mid, Integer rid, String body);
boolean updateReplyUri(Message reply, URI replyUri);
boolean replyExists(URI replyUri);
boolean deleteReply(URI userUri, URI replyUri);
String getMessageProperty(Integer mid, Integer rid, String key);
void setMessageProperty(Integer mid, Integer rid, String key, String value);
Optional<Pair<Integer, Integer>> findMessageByProperty(String key, String value);
}
|