aboutsummaryrefslogtreecommitdiff
path: root/juick-server-core/src/main/java/com/juick/service
diff options
context:
space:
mode:
Diffstat (limited to 'juick-server-core/src/main/java/com/juick/service')
-rw-r--r--juick-server-core/src/main/java/com/juick/service/CrosspostService.java58
-rw-r--r--juick-server-core/src/main/java/com/juick/service/EmailService.java11
-rw-r--r--juick-server-core/src/main/java/com/juick/service/MessagesService.java86
-rw-r--r--juick-server-core/src/main/java/com/juick/service/PMQueriesService.java28
-rw-r--r--juick-server-core/src/main/java/com/juick/service/PrivacyQueriesService.java17
-rw-r--r--juick-server-core/src/main/java/com/juick/service/PushQueriesService.java33
-rw-r--r--juick-server-core/src/main/java/com/juick/service/ShowQueriesService.java14
-rw-r--r--juick-server-core/src/main/java/com/juick/service/SubscriptionService.java38
-rw-r--r--juick-server-core/src/main/java/com/juick/service/TagService.java37
-rw-r--r--juick-server-core/src/main/java/com/juick/service/TelegramService.java22
-rw-r--r--juick-server-core/src/main/java/com/juick/service/UserService.java126
-rw-r--r--juick-server-core/src/main/java/com/juick/service/search/SearchService.java14
12 files changed, 484 insertions, 0 deletions
diff --git a/juick-server-core/src/main/java/com/juick/service/CrosspostService.java b/juick-server-core/src/main/java/com/juick/service/CrosspostService.java
new file mode 100644
index 000000000..467d1cbe5
--- /dev/null
+++ b/juick-server-core/src/main/java/com/juick/service/CrosspostService.java
@@ -0,0 +1,58 @@
+package com.juick.service;
+
+import com.juick.server.helpers.ApplicationStatus;
+import org.apache.commons.lang3.tuple.Pair;
+
+import java.util.Optional;
+
+/**
+ * Created by aalexeev on 11/13/16.
+ */
+public interface CrosspostService {
+
+ Optional<Pair<String, String>> getTwitterTokens(int uid);
+
+ boolean deleteTwitterToken(Integer uid);
+
+ Optional<String> getFacebookToken(int uid);
+
+ ApplicationStatus getFbCrossPostStatus(int uid);
+
+ boolean enableFBCrosspost(Integer uid);
+
+ void disableFBCrosspost(Integer uid);
+
+ String getTwitterName(int uid);
+
+ String getTelegramName(int uid);
+
+ Optional<Pair<String, String>> getVkTokens(int uid);
+
+ void deleteVKUser(Integer uid);
+
+ int getUIDbyFBID(long fbID);
+
+ boolean createFacebookUser(long fbID, String loginhash, String token, String fbName, String fbLink);
+
+ boolean updateFacebookUser(long fbID, String token, String fbName, String fbLink);
+
+ int getUIDbyVKID(long vkID);
+
+ boolean createVKUser(long vkID, String loginhash, String token, String vkName, String vkLink);
+
+ String getFacebookNameByHash(String hash);
+
+ String getTelegramNameByHash(String hash);
+
+ boolean setFacebookUser(String hash, int uid);
+
+ String getVKNameByHash(String hash);
+
+ boolean setVKUser(String hash, int uid);
+
+ boolean setTelegramUser(String hash, int uid);
+
+ String getJIDByHash(String hash);
+
+ boolean setJIDUser(String hash, int uid);
+}
diff --git a/juick-server-core/src/main/java/com/juick/service/EmailService.java b/juick-server-core/src/main/java/com/juick/service/EmailService.java
new file mode 100644
index 000000000..67925ec14
--- /dev/null
+++ b/juick-server-core/src/main/java/com/juick/service/EmailService.java
@@ -0,0 +1,11 @@
+package com.juick.service;
+
+/**
+ * Created by vitalyster on 09.12.2016.
+ */
+public interface EmailService {
+ boolean verifyAddressByCode(Integer userId, String code);
+ boolean addVerificationCode(Integer userId, String account, String code);
+ boolean deleteEmail(Integer userId, String account);
+ boolean setSubscriptionHour(Integer userId, String account, String hour);
+}
diff --git a/juick-server-core/src/main/java/com/juick/service/MessagesService.java b/juick-server-core/src/main/java/com/juick/service/MessagesService.java
new file mode 100644
index 000000000..37ca5eac4
--- /dev/null
+++ b/juick-server-core/src/main/java/com/juick/service/MessagesService.java
@@ -0,0 +1,86 @@
+package com.juick.service;
+
+import com.juick.User;
+import com.juick.server.helpers.ResponseReply;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * Created by aalexeev on 11/13/16.
+ */
+public interface MessagesService {
+ int createMessage(int uid, String txt, String attachment, Collection<com.juick.Tag> tags);
+
+ int createReply(int mid, int rid, int uid, String txt, String attachment);
+
+ int getReplyIDIncrement(int mid);
+
+ boolean recommendMessage(int mid, int vuid);
+
+ boolean canViewThread(int mid, int uid);
+
+ boolean isReadOnly(int mid);
+
+ boolean isSubscribed(int uid, int mid);
+
+ int getMessagePrivacy(int mid);
+
+ com.juick.Message getMessage(int mid);
+
+ com.juick.Message getReply(int mid, int rid);
+
+ User getMessageAuthor(int mid);
+
+ List<String> getMessageRecommendations(int mid);
+
+ 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);
+
+ List<Integer> getPrivate(int uid, int before);
+
+ List<Integer> getDiscussions(int uid, int before);
+
+ List<Integer> getRecommended(int uid, int before);
+
+ List<Integer> getPopular(int visitorUid, int before);
+
+ List<Integer> getPhotos(int visitorUid, int before);
+
+ List<Integer> getSearch(String search, int before);
+
+ 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(int UID, String search, int privacy, int before);
+
+ List<com.juick.Message> getMessages(Collection<Integer> mids);
+
+ List<com.juick.Message> getReplies(int mid);
+
+ boolean setMessagePopular(int mid, int popular);
+
+ boolean setMessagePrivacy(int mid);
+
+ boolean deleteMessage(int uid, int mid);
+
+ List<Integer> getLastMessages(int hours);
+
+ List<ResponseReply> getLastReplies(int hours);
+}
diff --git a/juick-server-core/src/main/java/com/juick/service/PMQueriesService.java b/juick-server-core/src/main/java/com/juick/service/PMQueriesService.java
new file mode 100644
index 000000000..e20bb3a59
--- /dev/null
+++ b/juick-server-core/src/main/java/com/juick/service/PMQueriesService.java
@@ -0,0 +1,28 @@
+package com.juick.service;
+
+import com.juick.User;
+
+import java.util.List;
+
+/**
+ * Created by aalexeev on 11/13/16.
+ */
+public interface PMQueriesService {
+ boolean createPM(int uidFrom, int uid_to, String body);
+
+ boolean addPMinRoster(int uid, String jid);
+
+ boolean removePMinRoster(int uid, String jid);
+
+ boolean havePMinRoster(int uid, String jid);
+
+ String getLastView(int uidFrom, int uidTo);
+
+ List<User> getPMLastConversationsUsers(int uid, int cnt);
+
+ List<com.juick.Message> getPMMessages(int uid, int uidTo);
+
+ List<com.juick.Message> getLastPMInbox(int uid);
+
+ List<com.juick.Message> getLastPMSent(int uid);
+}
diff --git a/juick-server-core/src/main/java/com/juick/service/PrivacyQueriesService.java b/juick-server-core/src/main/java/com/juick/service/PrivacyQueriesService.java
new file mode 100644
index 000000000..61eb199bf
--- /dev/null
+++ b/juick-server-core/src/main/java/com/juick/service/PrivacyQueriesService.java
@@ -0,0 +1,17 @@
+package com.juick.service;
+
+import com.juick.Tag;
+import com.juick.User;
+
+/**
+ * Created by aalexeev on 11/13/16.
+ */
+public interface PrivacyQueriesService {
+ enum PrivacyResult {
+ Removed, Added
+ }
+
+ PrivacyResult blacklistUser(User user, User target);
+
+ PrivacyResult blacklistTag(User user, Tag tag);
+}
diff --git a/juick-server-core/src/main/java/com/juick/service/PushQueriesService.java b/juick-server-core/src/main/java/com/juick/service/PushQueriesService.java
new file mode 100644
index 000000000..7d4bc295f
--- /dev/null
+++ b/juick-server-core/src/main/java/com/juick/service/PushQueriesService.java
@@ -0,0 +1,33 @@
+package com.juick.service;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * Created by aalexeev on 11/13/16.
+ */
+public interface PushQueriesService {
+ List<String> getGCMRegID(int uid);
+
+ List<String> getGCMTokens(Collection<Integer> uids);
+
+ boolean addGCMToken(Integer uid, String token);
+
+ boolean deleteGCMToken(String token);
+
+ List<String> getMPNSURL(int uid);
+
+ List<String> getMPNSTokens(Collection<Integer> uids);
+
+ boolean addMPNSToken(Integer uid, String token);
+
+ boolean deleteMPNSToken(String token);
+
+ List<String> getAPNSToken(int uid);
+
+ List<String> getAPNSTokens(Collection<Integer> uids);
+
+ boolean addAPNSToken(Integer uid, String token);
+
+ boolean deleteAPNSToken(String token);
+}
diff --git a/juick-server-core/src/main/java/com/juick/service/ShowQueriesService.java b/juick-server-core/src/main/java/com/juick/service/ShowQueriesService.java
new file mode 100644
index 000000000..a7e1c3647
--- /dev/null
+++ b/juick-server-core/src/main/java/com/juick/service/ShowQueriesService.java
@@ -0,0 +1,14 @@
+package com.juick.service;
+
+import com.juick.User;
+
+import java.util.List;
+
+/**
+ * Created by aalexeev on 11/13/16.
+ */
+public interface ShowQueriesService {
+ List<String> getRecommendedUsers(User forUser);
+
+ List<String> getTopUsers();
+}
diff --git a/juick-server-core/src/main/java/com/juick/service/SubscriptionService.java b/juick-server-core/src/main/java/com/juick/service/SubscriptionService.java
new file mode 100644
index 000000000..074c73f5c
--- /dev/null
+++ b/juick-server-core/src/main/java/com/juick/service/SubscriptionService.java
@@ -0,0 +1,38 @@
+package com.juick.service;
+
+import com.juick.Tag;
+import com.juick.User;
+import com.juick.server.helpers.NotifyOpts;
+
+import java.util.List;
+
+/**
+ * Created by aalexeev on 11/13/16.
+ */
+public interface SubscriptionService {
+ List<String> getJIDSubscribedToUser(int uid, boolean friendsonly);
+
+ List<User> getSubscribedUsers(int uid, int mid);
+
+ List<User> getUsersSubscribedToComments(int mid, int ignore_uid);
+
+ List<User> getUsersSubscribedToUserRecommendations(int uid, int mid, int muid);
+
+ boolean subscribeMessage(int mid, int vuid);
+
+ boolean unSubscribeMessage(int mid, int vuid);
+
+ boolean subscribeUser(User user, User toUser);
+
+ boolean unSubscribeUser(User user, User fromUser);
+
+ boolean subscribeTag(User user, Tag toTag);
+
+ boolean unSubscribeTag(User user, Tag toTag);
+
+ List<String> getSubscribedTags(User user);
+
+ NotifyOpts getNotifyOptions(User user);
+
+ boolean setNotifyOptions(User user, NotifyOpts options);
+}
diff --git a/juick-server-core/src/main/java/com/juick/service/TagService.java b/juick-server-core/src/main/java/com/juick/service/TagService.java
new file mode 100644
index 000000000..2fcc70972
--- /dev/null
+++ b/juick-server-core/src/main/java/com/juick/service/TagService.java
@@ -0,0 +1,37 @@
+package com.juick.service;
+
+import com.juick.Tag;
+import com.juick.server.helpers.TagStats;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * Created by aalexeev on 11/13/16.
+ */
+public interface TagService {
+ com.juick.Tag getTag(int tid);
+
+ com.juick.Tag getTag(String tag, boolean autoCreate);
+
+ List<Tag> getTags(String[] tags, boolean autoCreate);
+
+ boolean getTagNoIndex(int tagId);
+
+ int createTag(String name);
+
+ List<TagStats> getUserTagStats(int uid);
+
+ List<String> getUserBLTags(int uid);
+
+ List<String> getPopularTags();
+ List<TagStats> getTagStats();
+
+ List<Tag> updateTags(int mid, Collection<Tag> newTags);
+
+ List<Tag> fromString(String txt, boolean tagsOnly);
+
+ List<TagStats> getMessageTags(int mid);
+
+ List<Integer> getMessageTagsIDs(int mid);
+}
diff --git a/juick-server-core/src/main/java/com/juick/service/TelegramService.java b/juick-server-core/src/main/java/com/juick/service/TelegramService.java
new file mode 100644
index 000000000..b23e34050
--- /dev/null
+++ b/juick-server-core/src/main/java/com/juick/service/TelegramService.java
@@ -0,0 +1,22 @@
+package com.juick.service;
+
+import java.util.List;
+
+/**
+ * Created by vt on 24/11/2016.
+ */
+public interface TelegramService {
+ boolean addChat(Long id);
+
+ List<Long> getChats();
+
+ int getUser(long tgId);
+
+ boolean createTelegramUser(long tgID, String tgName);
+
+ boolean deleteTelegramUser(Integer uid);
+
+ List<Long> getSubscribers(int uid);
+
+ List<Long> getSubscribersToComments(int mid, int ignore_uid);
+}
diff --git a/juick-server-core/src/main/java/com/juick/service/UserService.java b/juick-server-core/src/main/java/com/juick/service/UserService.java
new file mode 100644
index 000000000..a6db9f821
--- /dev/null
+++ b/juick-server-core/src/main/java/com/juick/service/UserService.java
@@ -0,0 +1,126 @@
+package com.juick.service;
+
+import com.juick.User;
+import com.juick.server.helpers.Auth;
+import com.juick.server.helpers.EmailOpts;
+import com.juick.server.helpers.UserInfo;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * Created by aalexeev on 11/13/16.
+ */
+public interface UserService {
+ enum ActiveStatus {
+ Inactive,
+ Active
+ }
+
+ String getSignUpHashByJID(String jid);
+
+ String getSignUpHashByTelegramID(Long telegramId, String username);
+
+ int createUser(String username, String password);
+
+ Optional<User> getUserByUID(int uid);
+
+ User getUserByName(String username);
+
+ User getFullyUserByName(String username);
+
+ User getUserByEmail(String email);
+
+ List<User> getFullyUsersByNames(Collection<String> usernames);
+
+ User getUserByJID(String jid);
+
+ List<User> getUsersByName(Collection<String> unames);
+
+ List<User> getUsersByID(Collection<Integer> uids);
+
+ List<com.juick.User> getUsersByJID(Collection<String> jids);
+
+ List<String> getJIDsbyUID(int uid);
+
+ int getUIDbyJID(String jid);
+
+ int getUIDbyName(String uname);
+
+ int getUIDbyHash(String hash);
+
+ com.juick.User getUserByHash(String hash);
+
+ String getHashByUID(int uid);
+
+ int getUIDByHttpAuth(String header);
+
+ int checkPassword(String username, String password);
+
+ boolean updatePassword(User user, String newPassword);
+
+ int getUserOptionInt(int uid, String option, int defaultValue);
+
+ int setUserOptionInt(int uid, String option, int value);
+
+ UserInfo getUserInfo(User user);
+
+ boolean updateUserInfo(User user, UserInfo info);
+
+ boolean getCanMedia(int uid);
+
+ boolean isInWL(int uid, int check);
+
+ boolean isInBL(int uid, int check);
+
+ boolean isInBLAny(int uid, int uid2);
+
+ List<Integer> checkBL(int visitor, Collection<Integer> uids);
+
+ boolean isSubscribed(int uid, int check);
+
+ List<Integer> getUserRead(int uid);
+
+ List<com.juick.User> getUserReadLeastPopular(int uid, int cnt);
+
+ List<User> getUserReaders(int uid);
+
+ List<User> getUserFriends(int uid);
+
+ List<com.juick.User> getUserBLUsers(int uid);
+
+ boolean linkTwitterAccount(User user, String accessToken, String accessTokenSecret, String screenName);
+
+ int getStatsIRead(int uid);
+
+ int getStatsMyReaders(int uid);
+
+ int getStatsMessages(int uid);
+
+ int getStatsReplies(int uid);
+
+ boolean setActiveStatusForJID(String JID, ActiveStatus jidStatus);
+
+ List<String> getAllJIDs(User user);
+
+ List<Auth> getAuthCodes(User user);
+
+ List<String> getEmails(User user);
+
+ EmailOpts getEmailOpts(User user);
+
+ String getEmailHash(User user);
+
+ int deleteLoginForUser(String name);
+
+ int setLoginForUser(int uid, String loginHash);
+
+ void logout(int uid);
+
+ boolean deleteJID(int uid, String jid);
+
+ boolean unauthJID(int uid, String jid);
+
+ List<String> getActiveJIDs();
+}
diff --git a/juick-server-core/src/main/java/com/juick/service/search/SearchService.java b/juick-server-core/src/main/java/com/juick/service/search/SearchService.java
new file mode 100644
index 000000000..21deb0b17
--- /dev/null
+++ b/juick-server-core/src/main/java/com/juick/service/search/SearchService.java
@@ -0,0 +1,14 @@
+package com.juick.service.search;
+
+import java.util.List;
+
+/**
+ * Created by aalexeev on 11/18/16.
+ */
+public interface SearchService {
+ void setMaxResult(int maxResult);
+
+ List<Integer> searchInAllMessages(String searchString, int messageIdBefore);
+
+ List<Integer> searchByStringAndUser(String searchString, final int userId, int messageIdBefore);
+}