aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2020-03-07 13:20:45 +0300
committerGravatar Vitaly Takmazov2020-03-07 13:20:45 +0300
commitc9d67837cbcaae84a03b7bd14e508ca62880f87f (patch)
tree0f66e38f5b6aa48c66fae7d10c0b8b5ad6f7e7e2 /src/main/java
parentad50d1090b303d3a71c354dd2922a982fda6a289 (diff)
Reorganize project layout
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/juick/API.java (renamed from src/main/java/com/juick/ApiServer.java)4
-rw-r--r--src/main/java/com/juick/adapters/SimpleDateAdapter.java4
-rw-r--r--src/main/java/com/juick/formatters/PlainTextFormatter.java6
-rw-r--r--src/main/java/com/juick/model/AnonymousUser.java2
-rw-r--r--src/main/java/com/juick/model/Attachment.java (renamed from src/main/java/com/juick/Attachment.java)4
-rw-r--r--src/main/java/com/juick/model/Chat.java (renamed from src/main/java/com/juick/Chat.java)4
-rw-r--r--src/main/java/com/juick/model/CommandResult.java2
-rw-r--r--src/main/java/com/juick/model/ExternalToken.java (renamed from src/main/java/com/juick/ExternalToken.java)4
-rw-r--r--src/main/java/com/juick/model/Message.java (renamed from src/main/java/com/juick/Message.java)9
-rw-r--r--src/main/java/com/juick/model/Photo.java (renamed from src/main/java/com/juick/Photo.java)4
-rw-r--r--src/main/java/com/juick/model/PrivateChats.java1
-rw-r--r--src/main/java/com/juick/model/Reaction.java (renamed from src/main/java/com/juick/Reaction.java)4
-rw-r--r--src/main/java/com/juick/model/Status.java (renamed from src/main/java/com/juick/Status.java)4
-rw-r--r--src/main/java/com/juick/model/Tag.java (renamed from src/main/java/com/juick/Tag.java)4
-rw-r--r--src/main/java/com/juick/model/TagStats.java1
-rw-r--r--src/main/java/com/juick/model/User.java (renamed from src/main/java/com/juick/User.java)5
-rw-r--r--src/main/java/com/juick/model/ext/facebook/User.java (renamed from src/main/java/com/juick/model/facebook/User.java)2
-rw-r--r--src/main/java/com/juick/model/ext/twitter/User.java (renamed from src/main/java/com/juick/model/twitter/User.java)2
-rw-r--r--src/main/java/com/juick/model/ext/vk/Token.java (renamed from src/main/java/com/juick/model/vk/Token.java)2
-rw-r--r--src/main/java/com/juick/model/ext/vk/User.java (renamed from src/main/java/com/juick/model/vk/User.java)2
-rw-r--r--src/main/java/com/juick/model/ext/vk/UsersResponse.java (renamed from src/main/java/com/juick/model/vk/UsersResponse.java)2
-rw-r--r--src/main/java/com/juick/model/package-info.java (renamed from src/main/java/com/juick/package-info.java)4
-rw-r--r--src/main/java/com/juick/server/ActivityPubManager.java9
-rw-r--r--src/main/java/com/juick/server/CommandsManager.java16
-rw-r--r--src/main/java/com/juick/server/EmailManager.java6
-rw-r--r--src/main/java/com/juick/server/ServerManager.java12
-rw-r--r--src/main/java/com/juick/server/SignatureManager.java2
-rw-r--r--src/main/java/com/juick/server/TelegramBotManager.java40
-rw-r--r--src/main/java/com/juick/server/TopManager.java6
-rw-r--r--src/main/java/com/juick/server/TwitterManager.java8
-rw-r--r--src/main/java/com/juick/server/XMPPManager.java20
-rw-r--r--src/main/java/com/juick/server/api/ApiSocialLogin.java15
-rw-r--r--src/main/java/com/juick/server/api/Messages.java18
-rw-r--r--src/main/java/com/juick/server/api/Notifications.java8
-rw-r--r--src/main/java/com/juick/server/api/PM.java12
-rw-r--r--src/main/java/com/juick/server/api/Post.java16
-rw-r--r--src/main/java/com/juick/server/api/Service.java4
-rw-r--r--src/main/java/com/juick/server/api/SystemActivity.java4
-rw-r--r--src/main/java/com/juick/server/api/Tags.java2
-rw-r--r--src/main/java/com/juick/server/api/Users.java8
-rw-r--r--src/main/java/com/juick/server/api/activity/Profile.java4
-rw-r--r--src/main/java/com/juick/server/api/rss/Feeds.java2
-rw-r--r--src/main/java/com/juick/server/api/rss/MessagesView.java4
-rw-r--r--src/main/java/com/juick/server/api/webfinger/Resource.java2
-rw-r--r--src/main/java/com/juick/server/util/ImageUtils.java2
-rw-r--r--src/main/java/com/juick/server/util/TagUtils.java2
-rw-r--r--src/main/java/com/juick/server/www/WebApp.java4
-rw-r--r--src/main/java/com/juick/server/www/controllers/Help.java2
-rw-r--r--src/main/java/com/juick/server/www/controllers/Login.java2
-rw-r--r--src/main/java/com/juick/server/www/controllers/MessagesWWW.java40
-rw-r--r--src/main/java/com/juick/server/www/controllers/Settings.java2
-rw-r--r--src/main/java/com/juick/server/www/controllers/SignUp.java2
-rw-r--r--src/main/java/com/juick/server/www/controllers/SocialLogin.java14
-rw-r--r--src/main/java/com/juick/server/www/filters/AnythingFilter.java7
-rw-r--r--src/main/java/com/juick/service/ActivityPubService.java2
-rw-r--r--src/main/java/com/juick/service/CrosspostService.java2
-rw-r--r--src/main/java/com/juick/service/CrosspostServiceImpl.java2
-rw-r--r--src/main/java/com/juick/service/ImagesService.java2
-rw-r--r--src/main/java/com/juick/service/ImagesServiceImpl.java6
-rw-r--r--src/main/java/com/juick/service/MessagesService.java17
-rw-r--r--src/main/java/com/juick/service/MessagesServiceImpl.java24
-rw-r--r--src/main/java/com/juick/service/PMQueriesService.java11
-rw-r--r--src/main/java/com/juick/service/PMQueriesServiceImpl.java19
-rw-r--r--src/main/java/com/juick/service/PrivacyQueriesService.java4
-rw-r--r--src/main/java/com/juick/service/PrivacyQueriesServiceImpl.java4
-rw-r--r--src/main/java/com/juick/service/SearchService.java2
-rw-r--r--src/main/java/com/juick/service/ShowQueriesService.java2
-rw-r--r--src/main/java/com/juick/service/ShowQueriesServiceImpl.java2
-rw-r--r--src/main/java/com/juick/service/SocialService.java2
-rw-r--r--src/main/java/com/juick/service/SphinxSearchService.java2
-rw-r--r--src/main/java/com/juick/service/SubscriptionService.java6
-rw-r--r--src/main/java/com/juick/service/SubscriptionServiceImpl.java6
-rw-r--r--src/main/java/com/juick/service/TagService.java4
-rw-r--r--src/main/java/com/juick/service/TagServiceImpl.java12
-rw-r--r--src/main/java/com/juick/service/TelegramService.java2
-rw-r--r--src/main/java/com/juick/service/TelegramServiceImpl.java2
-rw-r--r--src/main/java/com/juick/service/UserService.java11
-rw-r--r--src/main/java/com/juick/service/UserServiceImpl.java18
-rw-r--r--src/main/java/com/juick/service/activities/DeleteMessageEvent.java2
-rw-r--r--src/main/java/com/juick/service/activities/UpdateEvent.java2
-rw-r--r--src/main/java/com/juick/service/component/PingEvent.java2
-rw-r--r--src/main/java/com/juick/service/component/UserUpdatedEvent.java2
-rw-r--r--src/main/java/com/juick/service/security/HTTPSignatureAuthenticationFilter.java2
-rw-r--r--src/main/java/com/juick/service/security/HashParamAuthenticationFilter.java2
-rw-r--r--src/main/java/com/juick/service/security/JuickUserDetailsService.java3
-rw-r--r--src/main/java/com/juick/service/security/entities/JuickUser.java8
-rw-r--r--src/main/java/com/juick/util/MessageUtils.java8
-rw-r--r--src/main/java/com/mitchellbosecke/pebble/extension/filters/FormatMessageFilter.java2
-rw-r--r--src/main/java/com/mitchellbosecke/pebble/extension/filters/TagsListFilter.java2
89 files changed, 281 insertions, 289 deletions
diff --git a/src/main/java/com/juick/ApiServer.java b/src/main/java/com/juick/API.java
index a5d55102..fdfc4977 100644
--- a/src/main/java/com/juick/ApiServer.java
+++ b/src/main/java/com/juick/API.java
@@ -26,8 +26,8 @@ import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication
@EnableAutoConfiguration(exclude = { MailSenderAutoConfiguration.class })
@ComponentScan(basePackages = {"com.juick.server", "com.juick.service"})
-public class ApiServer {
+public class API {
public static void main(String[] args) {
- SpringApplication.run(ApiServer.class, args);
+ SpringApplication.run(API.class, args);
}
}
diff --git a/src/main/java/com/juick/adapters/SimpleDateAdapter.java b/src/main/java/com/juick/adapters/SimpleDateAdapter.java
index 8feb8019..8f75fb7c 100644
--- a/src/main/java/com/juick/adapters/SimpleDateAdapter.java
+++ b/src/main/java/com/juick/adapters/SimpleDateAdapter.java
@@ -29,12 +29,12 @@ import java.time.Instant;
public class SimpleDateAdapter extends XmlAdapter<String, Instant> {
@Override
- public String marshal(Instant v) throws Exception {
+ public String marshal(Instant v) {
return DateFormattersHolder.getMessageFormatterInstance().format(v);
}
@Override
- public Instant unmarshal(String v) throws Exception {
+ public Instant unmarshal(String v) {
return DateFormattersHolder.getMessageFormatterInstance().parse(v);
}
}
diff --git a/src/main/java/com/juick/formatters/PlainTextFormatter.java b/src/main/java/com/juick/formatters/PlainTextFormatter.java
index 1d5299c9..21cabac2 100644
--- a/src/main/java/com/juick/formatters/PlainTextFormatter.java
+++ b/src/main/java/com/juick/formatters/PlainTextFormatter.java
@@ -17,7 +17,7 @@
package com.juick.formatters;
-import com.juick.Message;
+import com.juick.model.Message;
import com.juick.util.MessageUtils;
import org.apache.commons.lang3.StringUtils;
import org.ocpsoft.prettytime.PrettyTime;
@@ -75,7 +75,7 @@ public class PlainTextFormatter {
m.getUser().getName(), MessageUtils.getTagsString(m), sb.toString(), formatPostNumber(m), timeAgo, repliesCount, formatUrl(m));
}
- public static String formatUrl(com.juick.Message jmsg) {
+ public static String formatUrl(Message jmsg) {
if (MessageUtils.isReply(jmsg)) {
return String.format("https://juick.com/m/%d#%d", jmsg.getMid(), jmsg.getRid());
} else if (MessageUtils.isPM(jmsg)) {
@@ -92,7 +92,7 @@ public class PlainTextFormatter {
}
}
- public static String formatPostNumber(com.juick.Message jmsg) {
+ public static String formatPostNumber(Message jmsg) {
if (jmsg.getRid() > 0) {
return String.format("%d/%d", jmsg.getMid(), jmsg.getRid());
}
diff --git a/src/main/java/com/juick/model/AnonymousUser.java b/src/main/java/com/juick/model/AnonymousUser.java
index 9d05ae19..855b6eb5 100644
--- a/src/main/java/com/juick/model/AnonymousUser.java
+++ b/src/main/java/com/juick/model/AnonymousUser.java
@@ -17,8 +17,6 @@
package com.juick.model;
-import com.juick.User;
-
/**
* Created by aalexeev on 12/11/16.
*/
diff --git a/src/main/java/com/juick/Attachment.java b/src/main/java/com/juick/model/Attachment.java
index 3c4d2343..485c69bc 100644
--- a/src/main/java/com/juick/Attachment.java
+++ b/src/main/java/com/juick/model/Attachment.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2019, Juick
+ * Copyright (C) 2008-2020, 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
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick;
+package com.juick.model;
import java.io.Serializable;
diff --git a/src/main/java/com/juick/Chat.java b/src/main/java/com/juick/model/Chat.java
index 5f50976d..e72afb30 100644
--- a/src/main/java/com/juick/Chat.java
+++ b/src/main/java/com/juick/model/Chat.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2019, Juick
+ * Copyright (C) 2008-2020, 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
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick;
+package com.juick.model;
import com.fasterxml.jackson.annotation.JsonFormat;
diff --git a/src/main/java/com/juick/model/CommandResult.java b/src/main/java/com/juick/model/CommandResult.java
index c1a2bea1..e2dcc742 100644
--- a/src/main/java/com/juick/model/CommandResult.java
+++ b/src/main/java/com/juick/model/CommandResult.java
@@ -17,8 +17,6 @@
package com.juick.model;
-import com.juick.Message;
-
import java.util.Optional;
public class CommandResult {
diff --git a/src/main/java/com/juick/ExternalToken.java b/src/main/java/com/juick/model/ExternalToken.java
index 8f35d6d9..f2eac8de 100644
--- a/src/main/java/com/juick/ExternalToken.java
+++ b/src/main/java/com/juick/model/ExternalToken.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2019, Juick
+ * Copyright (C) 2008-2020, 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
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick;
+package com.juick.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/src/main/java/com/juick/Message.java b/src/main/java/com/juick/model/Message.java
index 8c270326..b1460957 100644
--- a/src/main/java/com/juick/Message.java
+++ b/src/main/java/com/juick/model/Message.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2019, Juick
+ * Copyright (C) 2008-2020, 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
@@ -14,13 +14,12 @@
* 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;
+package com.juick.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.juick.adapters.SimpleDateAdapter;
-import com.juick.model.Entity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import javax.annotation.Nonnull;
@@ -159,11 +158,11 @@ public class Message implements Comparable, Serializable {
}
@XmlElement(name = "user", namespace = "http://juick.com/user")
- public com.juick.User getUser() {
+ public User getUser() {
return user;
}
- public void setUser(com.juick.User user) {
+ public void setUser(User user) {
this.user = user;
}
diff --git a/src/main/java/com/juick/Photo.java b/src/main/java/com/juick/model/Photo.java
index 441804c9..e759f70d 100644
--- a/src/main/java/com/juick/Photo.java
+++ b/src/main/java/com/juick/model/Photo.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2019, Juick
+ * Copyright (C) 2008-2020, 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
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick;
+package com.juick.model;
import java.io.Serializable;
diff --git a/src/main/java/com/juick/model/PrivateChats.java b/src/main/java/com/juick/model/PrivateChats.java
index c3a443f6..eb39b22c 100644
--- a/src/main/java/com/juick/model/PrivateChats.java
+++ b/src/main/java/com/juick/model/PrivateChats.java
@@ -18,7 +18,6 @@
package com.juick.model;
import com.fasterxml.jackson.annotation.JsonProperty;
-import com.juick.Chat;
import java.util.Collections;
import java.util.List;
diff --git a/src/main/java/com/juick/Reaction.java b/src/main/java/com/juick/model/Reaction.java
index 77cebd5f..4b3501d4 100644
--- a/src/main/java/com/juick/Reaction.java
+++ b/src/main/java/com/juick/model/Reaction.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2019, Juick
+ * Copyright (C) 2008-2020, 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
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick;
+package com.juick.model;
import org.apache.commons.lang3.builder.ToStringBuilder;
diff --git a/src/main/java/com/juick/Status.java b/src/main/java/com/juick/model/Status.java
index bb6eb031..15904f17 100644
--- a/src/main/java/com/juick/Status.java
+++ b/src/main/java/com/juick/model/Status.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2019, Juick
+ * Copyright (C) 2008-2020, 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
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick;
+package com.juick.model;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/src/main/java/com/juick/Tag.java b/src/main/java/com/juick/model/Tag.java
index d234f2c1..75266303 100644
--- a/src/main/java/com/juick/Tag.java
+++ b/src/main/java/com/juick/model/Tag.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2019, Juick
+ * Copyright (C) 2008-2020, 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
@@ -14,7 +14,7 @@
* 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;
+package com.juick.model;
import com.fasterxml.jackson.annotation.JsonValue;
diff --git a/src/main/java/com/juick/model/TagStats.java b/src/main/java/com/juick/model/TagStats.java
index 027341e0..f8392402 100644
--- a/src/main/java/com/juick/model/TagStats.java
+++ b/src/main/java/com/juick/model/TagStats.java
@@ -18,7 +18,6 @@
package com.juick.model;
import com.fasterxml.jackson.annotation.JsonProperty;
-import com.juick.Tag;
/**
* Created by vitalyster on 01.12.2016.
diff --git a/src/main/java/com/juick/User.java b/src/main/java/com/juick/model/User.java
index 38e71c15..7a84b115 100644
--- a/src/main/java/com/juick/User.java
+++ b/src/main/java/com/juick/model/User.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2019, Juick
+ * Copyright (C) 2008-2020, 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
@@ -14,11 +14,10 @@
* 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;
+package com.juick.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
-import com.juick.model.TagStats;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
diff --git a/src/main/java/com/juick/model/facebook/User.java b/src/main/java/com/juick/model/ext/facebook/User.java
index 49fc81f9..5dee4d9e 100644
--- a/src/main/java/com/juick/model/facebook/User.java
+++ b/src/main/java/com/juick/model/ext/facebook/User.java
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.model.facebook;
+package com.juick.model.ext.facebook;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/src/main/java/com/juick/model/twitter/User.java b/src/main/java/com/juick/model/ext/twitter/User.java
index 7325a7c0..27ae652c 100644
--- a/src/main/java/com/juick/model/twitter/User.java
+++ b/src/main/java/com/juick/model/ext/twitter/User.java
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.model.twitter;
+package com.juick.model.ext.twitter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/src/main/java/com/juick/model/vk/Token.java b/src/main/java/com/juick/model/ext/vk/Token.java
index 56d6e476..1d8c2372 100644
--- a/src/main/java/com/juick/model/vk/Token.java
+++ b/src/main/java/com/juick/model/ext/vk/Token.java
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.model.vk;
+package com.juick.model.ext.vk;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/src/main/java/com/juick/model/vk/User.java b/src/main/java/com/juick/model/ext/vk/User.java
index 5a4c4721..b6b0efd0 100644
--- a/src/main/java/com/juick/model/vk/User.java
+++ b/src/main/java/com/juick/model/ext/vk/User.java
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.model.vk;
+package com.juick.model.ext.vk;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/src/main/java/com/juick/model/vk/UsersResponse.java b/src/main/java/com/juick/model/ext/vk/UsersResponse.java
index cec47ea7..f3dc116b 100644
--- a/src/main/java/com/juick/model/vk/UsersResponse.java
+++ b/src/main/java/com/juick/model/ext/vk/UsersResponse.java
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package com.juick.model.vk;
+package com.juick.model.ext.vk;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/src/main/java/com/juick/package-info.java b/src/main/java/com/juick/model/package-info.java
index 23e2a4e60..be9e6c2b 100644
--- a/src/main/java/com/juick/package-info.java
+++ b/src/main/java/com/juick/model/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2019, Juick
+ * Copyright (C) 2008-2020, 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
@@ -26,7 +26,7 @@
@XmlNs(prefix="user", namespaceURI="http://juick.com/user")
}
)
-package com.juick;
+package com.juick.model;
import org.apache.commons.lang3.StringUtils;
diff --git a/src/main/java/com/juick/server/ActivityPubManager.java b/src/main/java/com/juick/server/ActivityPubManager.java
index 5e71aafb..739b8b58 100644
--- a/src/main/java/com/juick/server/ActivityPubManager.java
+++ b/src/main/java/com/juick/server/ActivityPubManager.java
@@ -17,10 +17,11 @@
package com.juick.server;
-import com.juick.Message;
-import com.juick.Reaction;
-import com.juick.User;
+import com.juick.model.Message;
+import com.juick.model.Reaction;
+import com.juick.model.User;
import com.juick.formatters.PlainTextFormatter;
+import com.juick.model.Tag;
import com.juick.server.api.SystemActivity.ActivityType;
import com.juick.server.api.activity.model.Context;
import com.juick.server.api.activity.model.activities.*;
@@ -286,7 +287,7 @@ public class ActivityPubManager implements ActivityListener, NotificationListene
uri.replacePath(String.format("/n/%d-%d", mid, rid));
return uri.toUriString();
}
- public String tagUri(com.juick.Tag tag) {
+ public String tagUri(Tag tag) {
UriComponentsBuilder uri = UriComponentsBuilder.fromUriString(baseUri);
return uri.replacePath(String.format("/t/%s", tag.getName())).toUriString();
}
diff --git a/src/main/java/com/juick/server/CommandsManager.java b/src/main/java/com/juick/server/CommandsManager.java
index 82076e3c..494094eb 100644
--- a/src/main/java/com/juick/server/CommandsManager.java
+++ b/src/main/java/com/juick/server/CommandsManager.java
@@ -17,9 +17,9 @@
package com.juick.server;
-import com.juick.Message;
-import com.juick.Tag;
-import com.juick.User;
+import com.juick.model.Message;
+import com.juick.model.Tag;
+import com.juick.model.User;
import com.juick.formatters.PlainTextFormatter;
import com.juick.model.CommandResult;
import com.juick.model.TagStats;
@@ -182,7 +182,7 @@ public class CommandsManager {
if (!user_to.isAnonymous()) {
if (!userService.isInBLAny(user_to.getUid(), user_from.getUid())) {
if (pmQueriesService.createPM(user_from.getUid(), user_to.getUid(), body)) {
- com.juick.Message jmsg = new com.juick.Message();
+ Message jmsg = new Message();
jmsg.setUser(user_from);
jmsg.setTo(user_to);
jmsg.setText(body);
@@ -313,7 +313,7 @@ public class CommandsManager {
public CommandResult commandRecommend(User user, URI attachment, String... arguments) {
int mid = NumberUtils.toInt(arguments[0], 0);
if (mid > 0) {
- Optional<com.juick.Message> msg = messagesService.getMessage(mid);
+ Optional<Message> msg = messagesService.getMessage(mid);
if (msg.isPresent()) {
if (msg.get().getUser() == user) {
return CommandResult.fromString("You can't recommend your own messages.");
@@ -432,10 +432,10 @@ public class CommandsManager {
if (mid == 0) {
return CommandResult.fromString("Error");
}
- Optional<com.juick.Message> msg = messagesService.getMessage(mid);
+ Optional<Message> msg = messagesService.getMessage(mid);
if (msg.isPresent()) {
if (showReplies) {
- List<com.juick.Message> replies = messagesService.getReplies(user, mid);
+ List<Message> replies = messagesService.getReplies(user, mid);
applicationEventPublisher.publishEvent(
new SystemEvent(this, SystemActivity.read(user, msg.get())));
replies.add(0, msg.get());
@@ -450,7 +450,7 @@ public class CommandsManager {
public CommandResult commandShowReply(User user, URI attachment, String... arguments) {
int mid = NumberUtils.toInt(arguments[0], 0);
int rid = NumberUtils.toInt(arguments[1], 0);
- com.juick.Message reply = messagesService.getReply(mid, rid);
+ Message reply = messagesService.getReply(mid, rid);
if (reply != null) {
return CommandResult.fromString(PlainTextFormatter.formatPost(reply));
}
diff --git a/src/main/java/com/juick/server/EmailManager.java b/src/main/java/com/juick/server/EmailManager.java
index 04eb0466..d4e521e4 100644
--- a/src/main/java/com/juick/server/EmailManager.java
+++ b/src/main/java/com/juick/server/EmailManager.java
@@ -17,8 +17,8 @@
package com.juick.server;
-import com.juick.Message;
-import com.juick.User;
+import com.juick.model.Message;
+import com.juick.model.User;
import com.juick.server.api.SystemActivity;
import com.juick.service.EmailService;
import com.juick.service.MessagesService;
@@ -78,7 +78,7 @@ public class EmailManager implements NotificationListener {
processMessage(msg, subscribers);
}
}
- private void processMessage(com.juick.Message msg, List<User> subscribedUsers) {
+ private void processMessage(Message msg, List<User> subscribedUsers) {
if (msg.isService()) {
return;
}
diff --git a/src/main/java/com/juick/server/ServerManager.java b/src/main/java/com/juick/server/ServerManager.java
index a35a66e8..8a70251f 100644
--- a/src/main/java/com/juick/server/ServerManager.java
+++ b/src/main/java/com/juick/server/ServerManager.java
@@ -18,8 +18,8 @@ package com.juick.server;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
-import com.juick.Message;
-import com.juick.User;
+import com.juick.model.Message;
+import com.juick.model.User;
import com.juick.model.AnonymousUser;
import com.juick.server.api.SystemActivity;
import com.juick.service.MessagesService;
@@ -78,16 +78,16 @@ public class ServerManager implements NotificationListener {
}
- private void onJuickPM(final User to, final com.juick.Message jmsg) {
+ private void onJuickPM(final User to, final Message jmsg) {
messageEvent(jmsg, Arrays.asList(to, jmsg.getUser()));
}
- private void onJuickMessagePost(final com.juick.Message jmsg, List<User> subscribedUsers) {
+ private void onJuickMessagePost(final Message jmsg, List<User> subscribedUsers) {
messageEvent(jmsg, subscribedUsers);
messageEvent(jmsg, Collections.singletonList(AnonymousUser.INSTANCE));
}
- private void onJuickMessageReply(final com.juick.Message jmsg, final List<User> subscribedUsers) {
+ private void onJuickMessageReply(final Message jmsg, final List<User> subscribedUsers) {
messageEvent(jmsg, subscribedUsers);
messageEvent(jmsg, Collections.singletonList(AnonymousUser.INSTANCE));
}
@@ -113,7 +113,7 @@ public class ServerManager implements NotificationListener {
logger.warn("JSON exception", e);
}
}
- private void processMessage(User from, com.juick.Message jmsg, List<User> subscribers) {
+ private void processMessage(User from, Message jmsg, List<User> subscribers) {
List<User> subscribedUsers = ListUtils.union(subscribers, Collections.singletonList(jmsg.getUser()));
if (jmsg.isService()) {
logger.info("Message read event from {} for {}", from.getUid(), jmsg.getMid());
diff --git a/src/main/java/com/juick/server/SignatureManager.java b/src/main/java/com/juick/server/SignatureManager.java
index 6a273b76..c622c7e2 100644
--- a/src/main/java/com/juick/server/SignatureManager.java
+++ b/src/main/java/com/juick/server/SignatureManager.java
@@ -18,7 +18,7 @@
package com.juick.server;
import com.fasterxml.jackson.databind.ObjectMapper;
-import com.juick.User;
+import com.juick.model.User;
import com.juick.model.AnonymousUser;
import com.juick.server.api.activity.model.Context;
import com.juick.server.api.activity.model.objects.Person;
diff --git a/src/main/java/com/juick/server/TelegramBotManager.java b/src/main/java/com/juick/server/TelegramBotManager.java
index f8948a68..f35a73d3 100644
--- a/src/main/java/com/juick/server/TelegramBotManager.java
+++ b/src/main/java/com/juick/server/TelegramBotManager.java
@@ -17,7 +17,7 @@
package com.juick.server;
-import com.juick.User;
+import com.juick.model.User;
import com.juick.model.AnonymousUser;
import com.juick.model.CommandResult;
import com.juick.server.api.SystemActivity;
@@ -139,17 +139,17 @@ public class TelegramBotManager implements NotificationListener {
int mid = originalMessageData.get().getLeft();
int rid = originalMessageData.get().getRight();
// TODO: this is copypaste from api, need switch to api
- com.juick.Message originalMessage = rid == 0 ? messagesService.getMessage(mid).orElseThrow(IllegalStateException::new)
+ com.juick.model.Message originalMessage = rid == 0 ? messagesService.getMessage(mid).orElseThrow(IllegalStateException::new)
: messagesService.getReply(mid, rid);
User author = originalMessage.getUser();
String newMessageText = StringUtils.defaultString(message.text());
if (user_from.equals(author) && canUpdateMessage(originalMessage, newMessageText)) {
if (messagesService.updateMessage(mid, rid, newMessageText)) {
- telegramNotify(message.chat().id(), "Message updated", new com.juick.Message());
+ telegramNotify(message.chat().id(), "Message updated", new com.juick.model.Message());
return;
}
}
- telegramNotify(message.chat().id(), "Error updating message", new com.juick.Message());
+ telegramNotify(message.chat().id(), "Error updating message", new com.juick.model.Message());
}
} else {
User user_from = userService.getUserByUID(telegramService.getUser(message.chat().id())).orElse(AnonymousUser.INSTANCE);
@@ -195,7 +195,7 @@ public class TelegramBotManager implements NotificationListener {
String msgUrl = "http://juick.com/login?hash=" + userService.getHashByUID(user_from.getUid());
String msg = String.format("Hi, %s!\nYou can post messages and images to Juick there.\n" +
"Tap to [log into website](%s) to get more info", user_from.getName(), msgUrl);
- telegramNotify(message.from().id().longValue(), msg, new com.juick.Message());
+ telegramNotify(message.from().id().longValue(), msg, new com.juick.model.Message());
} else {
Message replyMessage = message.replyToMessage();
if (replyMessage != null) {
@@ -235,11 +235,11 @@ public class TelegramBotManager implements NotificationListener {
}
} else {
telegramNotify(message.from().id().longValue(),
- "Can not reply to this message", replyMessage.messageId(), new com.juick.Message());
+ "Can not reply to this message", replyMessage.messageId(), new com.juick.model.Message());
}
} else {
telegramNotify(message.from().id().longValue(),
- "Can not reply to this message", replyMessage.messageId(), new com.juick.Message());
+ "Can not reply to this message", replyMessage.messageId(), new com.juick.model.Message());
}
} else {
executeCommand(message.messageId(), message.from().id().longValue(),
@@ -262,7 +262,7 @@ public class TelegramBotManager implements NotificationListener {
/*
validate user input
*/
- private boolean canUpdateMessage(com.juick.Message message, String newData) {
+ private boolean canUpdateMessage(com.juick.model.Message message, String newData) {
if (StringUtils.isEmpty(newData)) {
// allow empty text only when image is present
return StringUtils.isNotEmpty(message.getAttachmentType());
@@ -274,13 +274,13 @@ public class TelegramBotManager implements NotificationListener {
try {
CommandResult result = commandsManager.processCommand(user_from, text, attachment);
if (result.getNewMessage().isPresent()) {
- com.juick.Message newMessage = result.getNewMessage().get();
+ com.juick.model.Message newMessage = result.getNewMessage().get();
messagesService.setMessageProperty(newMessage.getMid(), newMessage.getRid(), "durovId",
String.valueOf(messageId));
}
String messageTxt = StringUtils.isNotEmpty(result.getMarkdown()) ? result.getMarkdown()
: "Unknown error or unsupported command";
- telegramNotify(userId, messageTxt, new com.juick.Message());
+ telegramNotify(userId, messageTxt, new com.juick.model.Message());
} catch (Exception e) {
logger.warn("telegram exception", e);
}
@@ -290,11 +290,11 @@ public class TelegramBotManager implements NotificationListener {
return e.offset() == 0 && e.type().equals(MessageEntity.Type.text_link) && e.length() == 2;
}
- public void telegramNotify(Long chatId, String msg, @Nonnull com.juick.Message source) {
+ public void telegramNotify(Long chatId, String msg, @Nonnull com.juick.model.Message source) {
telegramNotify(chatId, msg, 0, source);
}
- public void telegramNotify(Long chatId, String msg, Integer replyTo, @Nonnull com.juick.Message source) {
+ public void telegramNotify(Long chatId, String msg, Integer replyTo, @Nonnull com.juick.model.Message source) {
String attachment = MessageUtils.attachmentUrl(source);
boolean isSendTxt = true;
if (!StringUtils.isEmpty(attachment)) {
@@ -339,7 +339,7 @@ public class TelegramBotManager implements NotificationListener {
}
}
- private void processTelegramResponse(Long chatId, SendResponse response, com.juick.Message source) {
+ private void processTelegramResponse(Long chatId, SendResponse response, com.juick.model.Message source) {
int userId = telegramService.getUser(chatId);
if (!response.isOk()) {
if (response.errorCode() == 403) {
@@ -406,7 +406,7 @@ public class TelegramBotManager implements NotificationListener {
processFollow(activity.getFrom(), activity.getTo());
}
}
- private void processMessage(com.juick.Message jmsg, List<User> subscribedUsers) {
+ private void processMessage(com.juick.model.Message jmsg, List<User> subscribedUsers) {
if (jmsg.isService()) {
return;
}
@@ -432,17 +432,17 @@ public class TelegramBotManager implements NotificationListener {
}
}
- private void processLike(User liker, com.juick.Message message, List<User> subscribers) {
+ private void processLike(User liker, com.juick.model.Message message, List<User> subscribers) {
if (!liker.getName().equals(serviceUser)) {
logger.info("Like received in tg listener");
if (!userService.isInBLAny(message.getUser().getUid(), liker.getUid())) {
telegramService.getTelegramIdentifiers(Collections.singletonList(message.getUser()))
.forEach(c -> telegramNotify(c, String.format("%s recommends your [post](%s)",
- MessageUtils.getMarkdownUser(liker), formatUrl(message)), new com.juick.Message()));
+ MessageUtils.getMarkdownUser(liker), formatUrl(message)), new com.juick.model.Message()));
}
telegramService.getTelegramIdentifiers(subscribers)
.forEach(c -> telegramNotify(c, String.format("%s recommends you someone's [post](%s)",
- MessageUtils.getMarkdownUser(liker), formatUrl(message)), new com.juick.Message()));
+ MessageUtils.getMarkdownUser(liker), formatUrl(message)), new com.juick.model.Message()));
}
}
@@ -451,15 +451,15 @@ public class TelegramBotManager implements NotificationListener {
}
- private void processTop(com.juick.Message message) {
+ private void processTop(com.juick.model.Message message) {
telegramService.getTelegramIdentifiers(Collections.singletonList(message.getUser()))
.forEach(c -> telegramNotify(c, String.format("Your [post](%s) became popular!",
- formatUrl(message)), new com.juick.Message()));
+ formatUrl(message)), new com.juick.model.Message()));
}
private void processFollow(User subscriber, List<User> target) {
telegramService.getTelegramIdentifiers(target)
.forEach(c -> telegramNotify(c, String.format("%s subscribed to your blog",
- MessageUtils.getMarkdownUser(subscriber)), new com.juick.Message()));
+ MessageUtils.getMarkdownUser(subscriber)), new com.juick.model.Message()));
}
}
diff --git a/src/main/java/com/juick/server/TopManager.java b/src/main/java/com/juick/server/TopManager.java
index 97ff8780..338b0e49 100644
--- a/src/main/java/com/juick/server/TopManager.java
+++ b/src/main/java/com/juick/server/TopManager.java
@@ -17,9 +17,9 @@
package com.juick.server;
-import com.juick.Message;
-import com.juick.Tag;
-import com.juick.User;
+import com.juick.model.Message;
+import com.juick.model.Tag;
+import com.juick.model.User;
import com.juick.server.api.SystemActivity;
import com.juick.service.MessagesService;
import com.juick.service.UserService;
diff --git a/src/main/java/com/juick/server/TwitterManager.java b/src/main/java/com/juick/server/TwitterManager.java
index 4022ef67..1b66358d 100644
--- a/src/main/java/com/juick/server/TwitterManager.java
+++ b/src/main/java/com/juick/server/TwitterManager.java
@@ -16,8 +16,8 @@
*/
package com.juick.server;
-import com.juick.Message;
-import com.juick.User;
+import com.juick.model.Message;
+import com.juick.model.User;
import com.juick.server.api.SystemActivity;
import com.juick.service.UserService;
import com.juick.service.component.*;
@@ -63,7 +63,7 @@ public class TwitterManager implements NotificationListener {
serviceUser = userService.getUserByName(serviceUsername);
}
- void twitterPost(final com.juick.Message jmsg) {
+ void twitterPost(final Message jmsg) {
crosspostService.getTwitterToken(jmsg.getUser().getUid()).ifPresent(t -> {
String status = MessageUtils.getMessageHashTags(jmsg) + StringUtils.defaultString(jmsg.getText());
if (status.length() > 253) {
@@ -110,7 +110,7 @@ public class TwitterManager implements NotificationListener {
}
- private void processTop(com.juick.Message message) {
+ private void processTop(Message message) {
Message jmsg = SerializationUtils.clone(message);
jmsg.setUser(serviceUser);
twitterPost(jmsg);
diff --git a/src/main/java/com/juick/server/XMPPManager.java b/src/main/java/com/juick/server/XMPPManager.java
index 94fe0d1e..5c58345a 100644
--- a/src/main/java/com/juick/server/XMPPManager.java
+++ b/src/main/java/com/juick/server/XMPPManager.java
@@ -17,7 +17,7 @@
package com.juick.server;
-import com.juick.User;
+import com.juick.model.User;
import com.juick.formatters.PlainTextFormatter;
import com.juick.model.CommandResult;
import com.juick.server.api.SystemActivity;
@@ -126,7 +126,7 @@ public class XMPPManager implements NotificationListener {
public void init() {
logger.info("xmpp component start connecting to {}", componentPort);
XmppSessionConfiguration configuration = XmppSessionConfiguration.builder()
- .extensions(Extension.of(com.juick.Message.class), Extension.of(MessageQuery.class))
+ .extensions(Extension.of(com.juick.model.Message.class), Extension.of(MessageQuery.class))
.debugger(LogbackDebugger.class)
.defaultResponseTimeout(Duration.ofMillis(120000))
.build();
@@ -269,13 +269,13 @@ public class XMPPManager implements NotificationListener {
serviceUser = userService.getUserByName(serviceUsername);
}
- private void sendJuickMessage(com.juick.Message jmsg, List<User> users) {
+ private void sendJuickMessage(com.juick.model.Message jmsg, List<User> users) {
List<String> jids = new ArrayList<>();
for (User user : users) {
jids.addAll(userService.getJIDsbyUID(user.getUid()));
}
- com.juick.Message fullMsg = messagesService.getMessage(jmsg.getMid()).orElseThrow(IllegalStateException::new);
+ com.juick.model.Message fullMsg = messagesService.getMessage(jmsg.getMid()).orElseThrow(IllegalStateException::new);
String txt = "@" + jmsg.getUser().getName() + ":" + MessageUtils.getTagsString(fullMsg) + "\n";
String attachmentUrl = MessageUtils.attachmentUrl(fullMsg);
if (StringUtils.isNotEmpty(attachmentUrl)) {
@@ -307,14 +307,14 @@ public class XMPPManager implements NotificationListener {
}
}
- private void sendJuickComment(com.juick.Message jmsg, List<User> users) {
+ private void sendJuickComment(com.juick.model.Message jmsg, List<User> users) {
String replyQuote;
String replyTo;
- com.juick.Message replyMessage = jmsg.getReplyto() > 0 ? messagesService.getReply(jmsg.getMid(), jmsg.getReplyto())
+ com.juick.model.Message replyMessage = jmsg.getReplyto() > 0 ? messagesService.getReply(jmsg.getMid(), jmsg.getReplyto())
: messagesService.getMessage(jmsg.getMid()).orElseThrow(IllegalStateException::new);
replyTo = replyMessage.getUser().getName();
- com.juick.Message fullReply = messagesService.getReply(jmsg.getMid(), jmsg.getRid());
+ com.juick.model.Message fullReply = messagesService.getReply(jmsg.getMid(), jmsg.getRid());
replyQuote = StringUtils.defaultString(fullReply.getReplyQuote());
String txt = "Reply by @" + jmsg.getUser().getName() + ":\n" + replyQuote + "\n@" + replyTo + " ";
@@ -351,7 +351,7 @@ public class XMPPManager implements NotificationListener {
}
}
}
- private void processMessage(com.juick.Message msg, List<User> subscribers) {
+ private void processMessage(com.juick.model.Message msg, List<User> subscribers) {
if (msg.isService()) {
return;
}
@@ -388,7 +388,7 @@ public class XMPPManager implements NotificationListener {
return ClientMessage.from(reply);
}
- public void processLike(User liker, com.juick.Message jmsg, List<User> users) {
+ public void processLike(User liker, com.juick.model.Message jmsg, List<User> users) {
if (!userService.isInBLAny(jmsg.getUser().getUid(), liker.getUid())) {
userService.getJIDsbyUID(jmsg.getUser().getUid()).forEach(authorJid -> {
Message xmppMessage = new Message();
@@ -456,7 +456,7 @@ public class XMPPManager implements NotificationListener {
});
}
- public void processTop(com.juick.Message message) {
+ public void processTop(com.juick.model.Message message) {
try {
commandsManager.processCommand(serviceUser, String.format("! #%d", message.getMid()), URI.create(StringUtils.EMPTY));
} catch (Exception e) {
diff --git a/src/main/java/com/juick/server/api/ApiSocialLogin.java b/src/main/java/com/juick/server/api/ApiSocialLogin.java
index 6a6b4293..24010dd2 100644
--- a/src/main/java/com/juick/server/api/ApiSocialLogin.java
+++ b/src/main/java/com/juick/server/api/ApiSocialLogin.java
@@ -33,18 +33,17 @@ import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.juick.model.AuthResponse;
-import com.juick.model.facebook.User;
+import com.juick.model.ext.facebook.User;
import com.juick.server.util.HttpBadRequestException;
import com.juick.service.CrosspostService;
import com.juick.service.EmailService;
import com.juick.service.UserService;
-import com.juick.model.vk.UsersResponse;
+import com.juick.model.ext.vk.UsersResponse;
import com.nimbusds.jose.JOSEException;
import com.nimbusds.jose.proc.BadJOSEException;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
-import org.checkerframework.checker.units.qual.A;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
@@ -219,7 +218,7 @@ public class ApiSocialLogin {
vkAuthService.signRequest(token, meRequest);
String graph = vkAuthService.execute(meRequest).getBody();
- com.juick.model.vk.User jsonUser = jsonMapper.readValue(graph, UsersResponse.class).getUsers().get(0);
+ com.juick.model.ext.vk.User jsonUser = jsonMapper.readValue(graph, UsersResponse.class).getUsers().get(0);
String vkName = jsonUser.getFirstName() + " " + jsonUser.getLastName();
String vkLink = jsonUser.getScreenName();
@@ -253,7 +252,7 @@ public class ApiSocialLogin {
GoogleIdToken idToken = verifier.verify(idTokenString);
if (idToken != null) {
String email = idToken.getPayload().getEmail();
- com.juick.User visitor = userService.getUserByEmail(email);
+ com.juick.model.User visitor = userService.getUserByEmail(email);
if (visitor.isAnonymous()) {
String verificationCode = RandomStringUtils.randomAlphanumeric(8).toUpperCase();
emailService.addVerificationCode(null, email, verificationCode);
@@ -266,7 +265,7 @@ public class ApiSocialLogin {
}
@ResponseBody
@PostMapping("/api/signup")
- public ResponseEntity<com.juick.User> signupWithEmail(String username, String password, String verificationCode) {
+ public ResponseEntity<com.juick.model.User> signupWithEmail(String username, String password, String verificationCode) {
if (username.length() < 2 || username.length() > 16 || !username.matches("^[a-zA-Z0-9\\-]+$")
|| password.length() < 6 || password.length() > 32) {
throw new HttpBadRequestException();
@@ -274,7 +273,7 @@ public class ApiSocialLogin {
String verifiedEmail = emailService.getEmailByAuthCode(verificationCode);
if (StringUtils.isNotEmpty(verifiedEmail)) {
- com.juick.User newUser = userService.createUser(username, password).orElseThrow(HttpBadRequestException::new);
+ com.juick.model.User newUser = userService.createUser(username, password).orElseThrow(HttpBadRequestException::new);
emailService.addEmail(newUser.getUid(), verifiedEmail);
emailService.deleteAuthCode(verificationCode);
return ResponseEntity.ok(newUser);
@@ -301,7 +300,7 @@ public class ApiSocialLogin {
var email = api.validateToken(idToken);
if (email.isPresent()) {
- com.juick.User user = userService.getUserByEmail(email.get());
+ com.juick.model.User user = userService.getUserByEmail(email.get());
if (!user.isAnonymous()) {
String redirectUrl = crosspostService.verifyVKState(body.get("state"));
if (StringUtils.isBlank(redirectUrl)) {
diff --git a/src/main/java/com/juick/server/api/Messages.java b/src/main/java/com/juick/server/api/Messages.java
index 67e2ca3e..ffe55d3f 100644
--- a/src/main/java/com/juick/server/api/Messages.java
+++ b/src/main/java/com/juick/server/api/Messages.java
@@ -17,9 +17,9 @@
package com.juick.server.api;
-import com.juick.Message;
-import com.juick.Tag;
-import com.juick.User;
+import com.juick.model.Message;
+import com.juick.model.Tag;
+import com.juick.model.User;
import com.juick.server.Utils;
import com.juick.server.www.WebApp;
import com.juick.model.CommandResult;
@@ -52,11 +52,11 @@ import java.util.stream.Collectors;
@RequestMapping(produces = MediaType.APPLICATION_JSON_VALUE)
public class Messages {
- private static final ResponseEntity<List<com.juick.Message>> NOT_FOUND = ResponseEntity
+ private static final ResponseEntity<List<Message>> NOT_FOUND = ResponseEntity
.status(HttpStatus.NOT_FOUND)
.body(Collections.emptyList());
- private static final ResponseEntity<List<com.juick.Message>> FORBIDDEN = ResponseEntity
+ private static final ResponseEntity<List<Message>> FORBIDDEN = ResponseEntity
.status(HttpStatus.FORBIDDEN)
.body(Collections.emptyList());
@@ -76,7 +76,7 @@ public class Messages {
// TODO: serialize image urls
@GetMapping("/api/home")
- public ResponseEntity<List<com.juick.Message>> getHome(
+ public ResponseEntity<List<Message>> getHome(
@Visitor User visitor,
@RequestParam(defaultValue = "0") int before_mid) {
if (!visitor.isAnonymous()) {
@@ -90,7 +90,7 @@ public class Messages {
}
@GetMapping("/api/messages")
- public ResponseEntity<List<com.juick.Message>> getMessages(
+ public ResponseEntity<List<Message>> getMessages(
@Visitor User visitor,
@RequestParam(required = false) String uname,
@RequestParam(name = "before_mid", defaultValue = "0") Integer before,
@@ -173,7 +173,7 @@ public class Messages {
return msgs;
}
@GetMapping("/api/thread")
- public ResponseEntity<List<com.juick.Message>> getThread(
+ public ResponseEntity<List<Message>> getThread(
@Visitor User visitor,
@RequestParam(defaultValue = "0") int mid) {
Optional<Message> message = messagesService.getMessage(mid);
@@ -187,7 +187,7 @@ public class Messages {
Collections.singletonList(msg.getMid()))
.stream().map(Pair::getRight).collect(Collectors.toList())));
msg.getRecommendations().forEach(r -> r.setAvatar(webApp.getAvatarUrl(r)));
- List<com.juick.Message> replies = messagesService.getReplies(visitor, mid);
+ List<Message> replies = messagesService.getReplies(visitor, mid);
replies.forEach(m -> m.getUser().setAvatar(webApp.getAvatarUrl(m.getUser())));
if (!visitor.isAnonymous()) {
userService.updateLastSeen(visitor);
diff --git a/src/main/java/com/juick/server/api/Notifications.java b/src/main/java/com/juick/server/api/Notifications.java
index e7eada2a..eb15917e 100644
--- a/src/main/java/com/juick/server/api/Notifications.java
+++ b/src/main/java/com/juick/server/api/Notifications.java
@@ -17,10 +17,10 @@
package com.juick.server.api;
-import com.juick.ExternalToken;
-import com.juick.Message;
-import com.juick.Status;
-import com.juick.User;
+import com.juick.model.ExternalToken;
+import com.juick.model.Message;
+import com.juick.model.Status;
+import com.juick.model.User;
import com.juick.model.AnonymousUser;
import com.juick.server.util.HttpBadRequestException;
import com.juick.service.MessagesService;
diff --git a/src/main/java/com/juick/server/api/PM.java b/src/main/java/com/juick/server/api/PM.java
index 8e4cb6c9..d5860057 100644
--- a/src/main/java/com/juick/server/api/PM.java
+++ b/src/main/java/com/juick/server/api/PM.java
@@ -17,9 +17,9 @@
package com.juick.server.api;
-import com.juick.Chat;
-import com.juick.Message;
-import com.juick.User;
+import com.juick.model.Chat;
+import com.juick.model.Message;
+import com.juick.model.User;
import com.juick.model.AnonymousUser;
import com.juick.model.PrivateChats;
import com.juick.server.util.HttpBadRequestException;
@@ -56,7 +56,7 @@ public class PM {
private WebApp webApp;
@RequestMapping(value = "/api/pm", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
- public List<com.juick.Message> doGetPM(
+ public List<Message> doGetPM(
@Visitor User visitor,
@RequestParam(required = false) String uname) {
int uid = 0;
@@ -74,7 +74,7 @@ public class PM {
}
@RequestMapping(value = "/api/pm", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
- public com.juick.Message doPostPM(
+ public Message doPostPM(
@Visitor User visitor,
@RequestParam String uname,
@RequestParam String body) {
@@ -92,7 +92,7 @@ public class PM {
}
if (pmQueriesService.createPM(visitor.getUid(), userTo.getUid(), body)) {
- com.juick.Message jmsg = new com.juick.Message();
+ Message jmsg = new Message();
jmsg.setUser(visitor);
jmsg.setText(body);
jmsg.setTo(userTo);
diff --git a/src/main/java/com/juick/server/api/Post.java b/src/main/java/com/juick/server/api/Post.java
index 37b40b2d..bfc640e9 100644
--- a/src/main/java/com/juick/server/api/Post.java
+++ b/src/main/java/com/juick/server/api/Post.java
@@ -17,10 +17,10 @@
package com.juick.server.api;
-import com.juick.Message;
-import com.juick.Reaction;
-import com.juick.Status;
-import com.juick.User;
+import com.juick.model.Message;
+import com.juick.model.Reaction;
+import com.juick.model.Status;
+import com.juick.model.User;
import com.juick.model.CommandResult;
import com.juick.server.ActivityPubManager;
import com.juick.server.CommandsManager;
@@ -120,7 +120,7 @@ public class Post {
Message msg = message.get();
- com.juick.Message reply = null;
+ Message reply = null;
if (rid > 0) {
reply = messagesService.getReply(mid, rid);
if (reply == null) {
@@ -156,7 +156,7 @@ public class Post {
@PostMapping("/api/like")
@ResponseStatus(value = HttpStatus.OK)
public Status doPostRecomm(@Visitor User visitor, @RequestParam Integer mid) throws Exception {
- Optional<com.juick.Message> message = messagesService.getMessage(mid);
+ Optional<Message> message = messagesService.getMessage(mid);
if (message.isEmpty()) {
throw new HttpNotFoundException();
}
@@ -173,7 +173,7 @@ public class Post {
@ResponseStatus(value = HttpStatus.OK)
public Status doPostSubscribe(@Visitor User visitor,
@RequestParam Integer mid) throws Exception {
- Optional<com.juick.Message> message = messagesService.getMessage(mid);
+ Optional<Message> message = messagesService.getMessage(mid);
if (message.isEmpty()) {
throw new HttpNotFoundException();
}
@@ -200,7 +200,7 @@ public class Post {
@RequestParam(required = false, defaultValue = "1") int count) {
logger.info("got reaction with type: {}", reactionId);
- Optional<com.juick.Message> message = messagesService.getMessage(mid);
+ Optional<Message> message = messagesService.getMessage(mid);
if (message.isEmpty()) {
throw new HttpNotFoundException();
}
diff --git a/src/main/java/com/juick/server/api/Service.java b/src/main/java/com/juick/server/api/Service.java
index 46cccb6f..2763eab1 100644
--- a/src/main/java/com/juick/server/api/Service.java
+++ b/src/main/java/com/juick/server/api/Service.java
@@ -17,8 +17,8 @@
package com.juick.server.api;
-import com.juick.Message;
-import com.juick.User;
+import com.juick.model.Message;
+import com.juick.model.User;
import com.juick.model.CommandResult;
import com.juick.server.CommandsManager;
import com.juick.server.EmailManager;
diff --git a/src/main/java/com/juick/server/api/SystemActivity.java b/src/main/java/com/juick/server/api/SystemActivity.java
index 4b07dccb..820f9307 100644
--- a/src/main/java/com/juick/server/api/SystemActivity.java
+++ b/src/main/java/com/juick/server/api/SystemActivity.java
@@ -17,8 +17,8 @@
package com.juick.server.api;
-import com.juick.Message;
-import com.juick.User;
+import com.juick.model.Message;
+import com.juick.model.User;
import java.util.Collections;
import java.util.List;
diff --git a/src/main/java/com/juick/server/api/Tags.java b/src/main/java/com/juick/server/api/Tags.java
index 53ed7766..6041adcf 100644
--- a/src/main/java/com/juick/server/api/Tags.java
+++ b/src/main/java/com/juick/server/api/Tags.java
@@ -17,7 +17,7 @@
package com.juick.server.api;
-import com.juick.User;
+import com.juick.model.User;
import com.juick.model.TagStats;
import com.juick.service.TagService;
import com.juick.service.security.annotation.Visitor;
diff --git a/src/main/java/com/juick/server/api/Users.java b/src/main/java/com/juick/server/api/Users.java
index c909fb38..e53c5424 100644
--- a/src/main/java/com/juick/server/api/Users.java
+++ b/src/main/java/com/juick/server/api/Users.java
@@ -17,7 +17,7 @@
package com.juick.server.api;
-import com.juick.User;
+import com.juick.model.User;
import com.juick.model.AnonymousUser;
import com.juick.model.ApplicationStatus;
import com.juick.server.EmailManager;
@@ -79,7 +79,7 @@ public class Users {
public List<User> doGetUsers(
@Visitor User visitor,
@RequestParam(value = "uname", required = false) List<String> unames) {
- List<com.juick.User> users = new ArrayList<>();
+ List<User> users = new ArrayList<>();
if (unames != null) {
unames.removeIf(WebUtils::isNotUserName);
@@ -192,7 +192,7 @@ public class Users {
uid = visitor.getUid();
} else {
if (WebUtils.isUserName(uname)) {
- com.juick.User u = userService.getUserByName(uname);
+ User u = userService.getUserByName(uname);
if (!u.isAnonymous()) {
uid = u.getUid();
}
@@ -216,7 +216,7 @@ public class Users {
uid = visitor.getUid();
} else {
if (WebUtils.isUserName(uname)) {
- com.juick.User u = userService.getUserByName(uname);
+ User u = userService.getUserByName(uname);
if (!u.isAnonymous()) {
uid = u.getUid();
}
diff --git a/src/main/java/com/juick/server/api/activity/Profile.java b/src/main/java/com/juick/server/api/activity/Profile.java
index 9aa9dc37..f17b70c6 100644
--- a/src/main/java/com/juick/server/api/activity/Profile.java
+++ b/src/main/java/com/juick/server/api/activity/Profile.java
@@ -18,8 +18,8 @@
package com.juick.server.api.activity;
import com.fasterxml.jackson.databind.ObjectMapper;
-import com.juick.Message;
-import com.juick.User;
+import com.juick.model.Message;
+import com.juick.model.User;
import com.juick.formatters.PlainTextFormatter;
import com.juick.model.CommandResult;
import com.juick.server.ActivityPubManager;
diff --git a/src/main/java/com/juick/server/api/rss/Feeds.java b/src/main/java/com/juick/server/api/rss/Feeds.java
index dd225979..76c2b217 100644
--- a/src/main/java/com/juick/server/api/rss/Feeds.java
+++ b/src/main/java/com/juick/server/api/rss/Feeds.java
@@ -17,7 +17,7 @@
package com.juick.server.api.rss;
-import com.juick.User;
+import com.juick.model.User;
import com.juick.server.util.HttpNotFoundException;
import com.juick.service.MessagesService;
import com.juick.service.UserService;
diff --git a/src/main/java/com/juick/server/api/rss/MessagesView.java b/src/main/java/com/juick/server/api/rss/MessagesView.java
index 0e26419f..e7bc1bb3 100644
--- a/src/main/java/com/juick/server/api/rss/MessagesView.java
+++ b/src/main/java/com/juick/server/api/rss/MessagesView.java
@@ -17,8 +17,8 @@
package com.juick.server.api.rss;
-import com.juick.Message;
-import com.juick.User;
+import com.juick.model.Message;
+import com.juick.model.User;
import com.juick.server.api.rss.extension.JuickModule;
import com.juick.server.api.rss.extension.JuickModuleImpl;
import com.juick.server.www.WebApp;
diff --git a/src/main/java/com/juick/server/api/webfinger/Resource.java b/src/main/java/com/juick/server/api/webfinger/Resource.java
index 25981cb0..8fb808b1 100644
--- a/src/main/java/com/juick/server/api/webfinger/Resource.java
+++ b/src/main/java/com/juick/server/api/webfinger/Resource.java
@@ -17,7 +17,7 @@
package com.juick.server.api.webfinger;
-import com.juick.User;
+import com.juick.model.User;
import com.juick.server.api.webfinger.model.Account;
import com.juick.server.api.webfinger.model.Link;
import com.juick.server.util.HttpNotFoundException;
diff --git a/src/main/java/com/juick/server/util/ImageUtils.java b/src/main/java/com/juick/server/util/ImageUtils.java
index 60bce1a0..e06339ba 100644
--- a/src/main/java/com/juick/server/util/ImageUtils.java
+++ b/src/main/java/com/juick/server/util/ImageUtils.java
@@ -17,7 +17,7 @@
package com.juick.server.util;
-import com.juick.Attachment;
+import com.juick.model.Attachment;
import org.apache.commons.imaging.ImageReadException;
import org.apache.commons.imaging.Imaging;
import org.apache.commons.imaging.common.ImageMetadata;
diff --git a/src/main/java/com/juick/server/util/TagUtils.java b/src/main/java/com/juick/server/util/TagUtils.java
index ab42ff6c..754d8020 100644
--- a/src/main/java/com/juick/server/util/TagUtils.java
+++ b/src/main/java/com/juick/server/util/TagUtils.java
@@ -17,7 +17,7 @@
package com.juick.server.util;
-import com.juick.Tag;
+import com.juick.model.Tag;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
diff --git a/src/main/java/com/juick/server/www/WebApp.java b/src/main/java/com/juick/server/www/WebApp.java
index 2bc2b596..8476224d 100644
--- a/src/main/java/com/juick/server/www/WebApp.java
+++ b/src/main/java/com/juick/server/www/WebApp.java
@@ -16,8 +16,8 @@
*/
package com.juick.server.www;
-import com.juick.Tag;
-import com.juick.User;
+import com.juick.model.Tag;
+import com.juick.model.User;
import com.juick.service.TagService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
diff --git a/src/main/java/com/juick/server/www/controllers/Help.java b/src/main/java/com/juick/server/www/controllers/Help.java
index d37a87de..8bb9aecd 100644
--- a/src/main/java/com/juick/server/www/controllers/Help.java
+++ b/src/main/java/com/juick/server/www/controllers/Help.java
@@ -17,7 +17,7 @@
package com.juick.server.www.controllers;
-import com.juick.User;
+import com.juick.model.User;
import com.juick.server.util.HttpNotFoundException;
import com.juick.server.www.HelpService;
import com.juick.server.www.WebApp;
diff --git a/src/main/java/com/juick/server/www/controllers/Login.java b/src/main/java/com/juick/server/www/controllers/Login.java
index 20ab45a4..e6d6904c 100644
--- a/src/main/java/com/juick/server/www/controllers/Login.java
+++ b/src/main/java/com/juick/server/www/controllers/Login.java
@@ -16,7 +16,7 @@
*/
package com.juick.server.www.controllers;
-import com.juick.User;
+import com.juick.model.User;
import com.juick.service.UserService;
import com.juick.service.security.annotation.Visitor;
import org.springframework.stereotype.Controller;
diff --git a/src/main/java/com/juick/server/www/controllers/MessagesWWW.java b/src/main/java/com/juick/server/www/controllers/MessagesWWW.java
index 946b13b3..a7e4c127 100644
--- a/src/main/java/com/juick/server/www/controllers/MessagesWWW.java
+++ b/src/main/java/com/juick/server/www/controllers/MessagesWWW.java
@@ -16,9 +16,9 @@
*/
package com.juick.server.www.controllers;
-import com.juick.Message;
-import com.juick.Tag;
-import com.juick.User;
+import com.juick.model.Message;
+import com.juick.model.Tag;
+import com.juick.model.User;
import com.juick.formatters.PlainTextFormatter;
import com.juick.server.Utils;
import com.juick.server.util.HttpForbiddenException;
@@ -73,7 +73,7 @@ public class MessagesWWW {
@Inject
private WebApp webApp;
- private void fillUserModel(ModelMap model, com.juick.User user, com.juick.User visitor) {
+ private void fillUserModel(ModelMap model, User user, User visitor) {
user.setAvatar(webApp.getAvatarWebPath(user));
model.addAttribute("user", user);
model.addAttribute("isSubscribed", userService.isSubscribed(visitor.getUid(), user.getUid()));
@@ -156,7 +156,7 @@ public class MessagesWWW {
model.addAttribute("headers", head);
model.addAttribute("visitor", visitor);
model.addAttribute("noindex", !(paramShow == null && paramBefore == 0));
- List<com.juick.Message> msgs = messagesService.getMessages(visitor, mids);
+ List<Message> msgs = messagesService.getMessages(visitor, mids);
msgs.forEach(m -> m.getUser().setAvatar(webApp.getAvatarWebPath(m.getUser())));
if (!visitor.isAnonymous()) {
fillUserModel(model, visitor, visitor);
@@ -203,7 +203,7 @@ public class MessagesWWW {
@RequestParam(required = false, defaultValue = "0") Integer before,
@CookieValue(name = "sape_cookie", required = false, defaultValue = StringUtils.EMPTY) String sapeCookie,
ModelMap model) {
- com.juick.User user = userService.getUserByName(uname);
+ User user = userService.getUserByName(uname);
if (user.isBanned() || user.isAnonymous()) {
throw new HttpNotFoundException();
}
@@ -211,7 +211,7 @@ public class MessagesWWW {
List<Integer> mids;
- com.juick.Tag paramTag = null;
+ Tag paramTag = null;
if (paramTagStr != null) {
if (paramTagStr.length() < 64) {
paramTag = tagService.getTag(paramTagStr, false);
@@ -273,7 +273,7 @@ public class MessagesWWW {
model.addAttribute("noindex", paramShow == null && before == 0);
fillUserModel(model, user, visitor);
model.addAttribute("paramTag", paramTag);
- List<com.juick.Message> msgs = messagesService.getMessages(visitor, mids);
+ List<Message> msgs = messagesService.getMessages(visitor, mids);
msgs.forEach(m -> m.getUser().setAvatar(webApp.getAvatarWebPath(m.getUser())));
if (!visitor.isAnonymous()) {
List<Integer> unread = messagesService.getUnread(visitor);
@@ -312,7 +312,7 @@ public class MessagesWWW {
protected String doGetTags(
@Visitor User visitor,
@PathVariable String uname, ModelMap model) {
- com.juick.User user = userService.getUserByName(uname);
+ User user = userService.getUserByName(uname);
if (visitor.isBanned()) {
throw new HttpNotFoundException();
}
@@ -332,7 +332,7 @@ public class MessagesWWW {
protected String doGetFriends(
@Visitor User visitor,
@PathVariable String uname, ModelMap model) {
- com.juick.User user = userService.getUserByName(uname);
+ User user = userService.getUserByName(uname);
if (visitor.isBanned()) {
throw new HttpNotFoundException();
}
@@ -350,7 +350,7 @@ public class MessagesWWW {
protected String doGetReaders(
@Visitor User visitor,
@PathVariable String uname, ModelMap model) {
- com.juick.User user = userService.getUserByName(uname);
+ User user = userService.getUserByName(uname);
visitor.setAvatar(webApp.getAvatarWebPath(visitor));
model.addAttribute("title", "Читатели " + user.getName());
model.addAttribute("headers", "<meta name=\"robots\" content=\"noindex\"/>");
@@ -365,7 +365,7 @@ public class MessagesWWW {
protected String doGetBL(
@Visitor User visitor,
@PathVariable String uname, ModelMap model) {
- com.juick.User user = userService.getUserByName(uname);
+ User user = userService.getUserByName(uname);
if (visitor.getUid() != user.getUid()) {
throw new HttpForbiddenException();
}
@@ -388,11 +388,11 @@ public class MessagesWWW {
ModelMap model) {
visitor.setAvatar(webApp.getAvatarWebPath(visitor));
String paramTagStr = StringEscapeUtils.unescapeHtml4(tagName);
- com.juick.Tag paramTag = tagService.getTag(paramTagStr, false);
+ Tag paramTag = tagService.getTag(paramTagStr, false);
if (paramTag == null) {
throw new HttpNotFoundException();
} else if (paramTag.SynonymID > 0 && paramTag.TID != paramTag.SynonymID) {
- com.juick.Tag synTag = tagService.getTag(paramTag.SynonymID);
+ Tag synTag = tagService.getTag(paramTag.SynonymID);
String url = "/tag/" + URLEncoder.encode(StringEscapeUtils.escapeHtml4(synTag.getName()), StandardCharsets.UTF_8);
if (request.getQueryString() != null) {
url += "?" + request.getQueryString();
@@ -409,7 +409,7 @@ public class MessagesWWW {
String title = "*" + StringEscapeUtils.escapeHtml4(paramTag.getName());
model.addAttribute("title", title);
List<Integer> mids = messagesService.getTag(paramTag.TID, visitor.getUid(), before, (visitor.isAnonymous()) ? 40 : 20);
- List<com.juick.Message> msgs = messagesService.getMessages(visitor, mids);
+ List<Message> msgs = messagesService.getMessages(visitor, mids);
msgs.forEach(m -> m.getUser().setAvatar(webApp.getAvatarWebPath(m.getUser())));
if (!visitor.isAnonymous()) {
List<Integer> unread = messagesService.getUnread(visitor);
@@ -457,7 +457,7 @@ public class MessagesWWW {
}
visitor.setAvatar(webApp.getAvatarWebPath(visitor));
String title = "PM: Inbox";
- List<com.juick.Message> msgs = pmQueriesService.getLastPMInbox(visitor.getUid());
+ List<Message> msgs = pmQueriesService.getLastPMInbox(visitor.getUid());
msgs.forEach(m -> m.getUser().setAvatar(webApp.getAvatarWebPath(m.getUser())));
fillUserModel(model, visitor, visitor);
model.addAttribute("title", title);
@@ -477,7 +477,7 @@ public class MessagesWWW {
}
visitor.setAvatar(webApp.getAvatarWebPath(visitor));
String title = "PM: Sent";
- List<com.juick.Message> msgs = pmQueriesService.getLastPMSent(visitor.getUid());
+ List<Message> msgs = pmQueriesService.getLastPMSent(visitor.getUid());
msgs.forEach(m -> m.getUser().setAvatar(webApp.getAvatarWebPath(m.getUser())));
if (WebUtils.isNotUserName(uname)) {
uname = StringUtils.EMPTY;
@@ -501,7 +501,7 @@ public class MessagesWWW {
throw new HttpForbiddenException();
}
visitor.setAvatar(webApp.getAvatarWebPath(visitor));
- Optional<com.juick.Message> message = messagesService.getMessage(mid);
+ Optional<Message> message = messagesService.getMessage(mid);
if (message.isEmpty()) {
throw new HttpNotFoundException();
@@ -509,13 +509,13 @@ public class MessagesWWW {
Message msg = message.get();
- com.juick.User user = userService.getUserByName(uname);
+ User user = userService.getUserByName(uname);
if (user.isAnonymous() || !msg.getUser().equals(user)) {
return String.format("redirect:/%s/%d", msg.getUser().getName(), mid);
}
msg.VisitorCanComment = !visitor.isAnonymous();
msg.getUser().setAvatar(webApp.getAvatarWebPath(msg.getUser()));
- List<com.juick.Message> replies = messagesService.getReplies(visitor, msg.getMid());
+ List<Message> replies = messagesService.getReplies(visitor, msg.getMid());
// this should be after getReplies to mark thread as read
fillUserModel(model, user, visitor);
if (!visitor.isAnonymous()) {
diff --git a/src/main/java/com/juick/server/www/controllers/Settings.java b/src/main/java/com/juick/server/www/controllers/Settings.java
index 7e3e2514..e535eef0 100644
--- a/src/main/java/com/juick/server/www/controllers/Settings.java
+++ b/src/main/java/com/juick/server/www/controllers/Settings.java
@@ -16,7 +16,7 @@
*/
package com.juick.server.www.controllers;
-import com.juick.User;
+import com.juick.model.User;
import com.juick.model.NotifyOpts;
import com.juick.server.util.HttpBadRequestException;
import com.juick.server.util.HttpUtils;
diff --git a/src/main/java/com/juick/server/www/controllers/SignUp.java b/src/main/java/com/juick/server/www/controllers/SignUp.java
index 7332dc2e..cc2101a3 100644
--- a/src/main/java/com/juick/server/www/controllers/SignUp.java
+++ b/src/main/java/com/juick/server/www/controllers/SignUp.java
@@ -16,7 +16,7 @@
*/
package com.juick.server.www.controllers;
-import com.juick.User;
+import com.juick.model.User;
import com.juick.server.util.HttpBadRequestException;
import com.juick.server.util.HttpForbiddenException;
import com.juick.server.www.WebApp;
diff --git a/src/main/java/com/juick/server/www/controllers/SocialLogin.java b/src/main/java/com/juick/server/www/controllers/SocialLogin.java
index 710bae8e..e3b7a33b 100644
--- a/src/main/java/com/juick/server/www/controllers/SocialLogin.java
+++ b/src/main/java/com/juick/server/www/controllers/SocialLogin.java
@@ -22,8 +22,8 @@ import com.github.scribejava.core.builder.ServiceBuilder;
import com.github.scribejava.core.model.*;
import com.github.scribejava.core.oauth.OAuth10aService;
import com.github.scribejava.core.oauth.OAuth20Service;
-import com.juick.model.facebook.User;
-import com.juick.model.vk.UsersResponse;
+import com.juick.model.ext.facebook.User;
+import com.juick.model.ext.vk.UsersResponse;
import com.juick.server.Utils;
import com.juick.server.util.HttpBadRequestException;
import com.juick.service.CrosspostService;
@@ -193,7 +193,7 @@ public class SocialLogin {
}
@GetMapping("/_twitter")
protected void doTwitterLogin(
- @Visitor com.juick.User user,
+ @Visitor com.juick.model.User user,
HttpServletRequest request, HttpServletResponse response)
throws IOException, ExecutionException, InterruptedException {
String hash = StringUtils.EMPTY, request_token = StringUtils.EMPTY, request_token_secret = StringUtils.EMPTY;
@@ -229,8 +229,8 @@ public class SocialLogin {
OAuth1AccessToken accessToken = oAuthService.getAccessToken(requestToken, verifier);
OAuthRequest oAuthRequest = new OAuthRequest(Verb.GET, TWITTER_VERIFY_URL);
oAuthService.signRequest(accessToken, oAuthRequest);
- com.juick.model.twitter.User twitterUser = jsonMapper.readValue(oAuthService.execute(oAuthRequest).getBody(),
- com.juick.model.twitter.User.class);
+ com.juick.model.ext.twitter.User twitterUser = jsonMapper.readValue(oAuthService.execute(oAuthRequest).getBody(),
+ com.juick.model.ext.twitter.User.class);
if (userService.linkTwitterAccount(user, accessToken.getToken(), accessToken.getTokenSecret(),
twitterUser.getScreenName())) {
response.setStatus(HttpServletResponse.SC_FOUND);
@@ -267,7 +267,7 @@ public class SocialLogin {
vkAuthService.signRequest(token, meRequest);
String graph = vkAuthService.execute(meRequest).getBody();
- com.juick.model.vk.User jsonUser = jsonMapper.readValue(graph, UsersResponse.class).getUsers().get(0);
+ com.juick.model.ext.vk.User jsonUser = jsonMapper.readValue(graph, UsersResponse.class).getUsers().get(0);
String vkName = jsonUser.getFirstName() + " " + jsonUser.getLastName();
String vkLink = jsonUser.getScreenName();
@@ -348,7 +348,7 @@ public class SocialLogin {
AppleSignInApi api = (AppleSignInApi) appleSignInService.getApi();
var email = api.validateToken(idToken);
if (email.isPresent()) {
- com.juick.User user = userService.getUserByEmail(email.get());
+ com.juick.model.User user = userService.getUserByEmail(email.get());
if (!user.isAnonymous()) {
Cookie c = new Cookie("hash", userService.getHashByUID(user.getUid()));
c.setMaxAge(50 * 24 * 60 * 60);
diff --git a/src/main/java/com/juick/server/www/filters/AnythingFilter.java b/src/main/java/com/juick/server/www/filters/AnythingFilter.java
index cf484357..9a012089 100644
--- a/src/main/java/com/juick/server/www/filters/AnythingFilter.java
+++ b/src/main/java/com/juick/server/www/filters/AnythingFilter.java
@@ -17,6 +17,7 @@
package com.juick.server.www.filters;
+import com.juick.model.User;
import com.juick.server.util.WebUtils;
import com.juick.service.MessagesService;
import com.juick.service.UserService;
@@ -59,7 +60,7 @@ public class AnythingFilter extends OncePerRequestFilter {
if (isPostNumber && anything.equals(Integer.toString(messageId))) {
if (messageId > 0) {
- com.juick.User author = messagesService.getMessageAuthor(messageId);
+ User author = messagesService.getMessageAuthor(messageId);
if (author != null) {
servletResponse.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
@@ -68,14 +69,14 @@ public class AnythingFilter extends OncePerRequestFilter {
}
}
}
- com.juick.User user = userService.getUserByName(anything);
+ User user = userService.getUserByName(anything);
if (user.getUid() > 0) {
servletResponse.sendRedirect("/" + user.getName() + "/");
} else {
filterChain.doFilter(servletRequest, servletResponse);
}
} else {
- com.juick.User user = userService.getUserByName(anything);
+ User user = userService.getUserByName(anything);
if (!user.isAnonymous()) {
servletResponse.sendRedirect("/" + user.getName() + "/?before=" + before);
} else {
diff --git a/src/main/java/com/juick/service/ActivityPubService.java b/src/main/java/com/juick/service/ActivityPubService.java
index e1091748..e98b1c75 100644
--- a/src/main/java/com/juick/service/ActivityPubService.java
+++ b/src/main/java/com/juick/service/ActivityPubService.java
@@ -17,7 +17,7 @@
package com.juick.service;
-import com.juick.User;
+import com.juick.model.User;
import com.juick.model.AnonymousUser;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Repository;
diff --git a/src/main/java/com/juick/service/CrosspostService.java b/src/main/java/com/juick/service/CrosspostService.java
index d22f244a..66e10737 100644
--- a/src/main/java/com/juick/service/CrosspostService.java
+++ b/src/main/java/com/juick/service/CrosspostService.java
@@ -17,7 +17,7 @@
package com.juick.service;
-import com.juick.ExternalToken;
+import com.juick.model.ExternalToken;
import com.juick.model.ApplicationStatus;
import org.apache.commons.lang3.tuple.Pair;
diff --git a/src/main/java/com/juick/service/CrosspostServiceImpl.java b/src/main/java/com/juick/service/CrosspostServiceImpl.java
index 3b00c219..3fe21588 100644
--- a/src/main/java/com/juick/service/CrosspostServiceImpl.java
+++ b/src/main/java/com/juick/service/CrosspostServiceImpl.java
@@ -17,7 +17,7 @@
package com.juick.service;
-import com.juick.ExternalToken;
+import com.juick.model.ExternalToken;
import com.juick.model.ApplicationStatus;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
diff --git a/src/main/java/com/juick/service/ImagesService.java b/src/main/java/com/juick/service/ImagesService.java
index 7aa4b411..7288937f 100644
--- a/src/main/java/com/juick/service/ImagesService.java
+++ b/src/main/java/com/juick/service/ImagesService.java
@@ -17,7 +17,7 @@
package com.juick.service;
-import com.juick.Message;
+import com.juick.model.Message;
import java.io.IOException;
diff --git a/src/main/java/com/juick/service/ImagesServiceImpl.java b/src/main/java/com/juick/service/ImagesServiceImpl.java
index 7cdb8d60..abaec940 100644
--- a/src/main/java/com/juick/service/ImagesServiceImpl.java
+++ b/src/main/java/com/juick/service/ImagesServiceImpl.java
@@ -17,9 +17,9 @@
package com.juick.service;
-import com.juick.Attachment;
-import com.juick.Message;
-import com.juick.Photo;
+import com.juick.model.Attachment;
+import com.juick.model.Message;
+import com.juick.model.Photo;
import com.juick.server.util.ImageUtils;
import org.springframework.util.StringUtils;
diff --git a/src/main/java/com/juick/service/MessagesService.java b/src/main/java/com/juick/service/MessagesService.java
index e6e039d3..3e3e027d 100644
--- a/src/main/java/com/juick/service/MessagesService.java
+++ b/src/main/java/com/juick/service/MessagesService.java
@@ -17,10 +17,11 @@
package com.juick.service;
-import com.juick.Message;
-import com.juick.Reaction;
-import com.juick.User;
+import com.juick.model.Message;
+import com.juick.model.Reaction;
+import com.juick.model.User;
import com.juick.model.ResponseReply;
+import com.juick.model.Tag;
import org.apache.commons.lang3.tuple.Pair;
import java.net.URI;
@@ -30,7 +31,7 @@ import java.util.*;
* Created by aalexeev on 11/13/16.
*/
public interface MessagesService {
- int createMessage(int uid, String txt, String attachment, List<com.juick.Tag> tags);
+ int createMessage(int uid, String txt, String attachment, List<Tag> tags);
int createReply(int mid, int rid, User user, String txt, String attachment);
enum RecommendStatus {
@@ -60,9 +61,9 @@ public interface MessagesService {
Optional<Message> getMessage(int mid);
- com.juick.Message getReply(int mid, int rid);
+ Message getReply(int mid, int rid);
- com.juick.Message getReplyByUri(String replyUri);
+ Message getReplyByUri(String replyUri);
User getMessageAuthor(int mid);
@@ -104,11 +105,11 @@ public interface MessagesService {
List<Integer> getUserSearch(User visitor, int UID, String search, int privacy, int page);
- List<com.juick.Message> getMessages(User visitor, List<Integer> mids);
+ List<Message> getMessages(User visitor, List<Integer> mids);
Map<Integer,Set<Reaction>> updateReactionsFor(final List<Integer> mid);
- List<com.juick.Message> getReplies(User user, int mid);
+ List<Message> getReplies(User user, int mid);
boolean setMessagePopular(int mid, int popular);
diff --git a/src/main/java/com/juick/service/MessagesServiceImpl.java b/src/main/java/com/juick/service/MessagesServiceImpl.java
index 8f1387cf..e2b5e2b1 100644
--- a/src/main/java/com/juick/service/MessagesServiceImpl.java
+++ b/src/main/java/com/juick/service/MessagesServiceImpl.java
@@ -17,12 +17,8 @@
package com.juick.service;
-import com.juick.Message;
-import com.juick.Reaction;
-import com.juick.User;
-import com.juick.model.AnonymousUser;
-import com.juick.model.PrivacyOpts;
-import com.juick.model.ResponseReply;
+import com.juick.model.*;
+import com.juick.model.User;
import com.juick.server.www.WebApp;
import com.juick.util.MessageUtils;
import org.apache.commons.collections4.CollectionUtils;
@@ -134,7 +130,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
*/
@Transactional
@Override
- public int createMessage(final int uid, final String txt, final String attachment, final List<com.juick.Tag> tags) {
+ public int createMessage(final int uid, final String txt, final String attachment, final List<Tag> tags) {
SimpleJdbcInsert simpleJdbcInsert = new SimpleJdbcInsert(getJdbcTemplate()).withTableName("messages")
.usingColumns("user_id", "attach", "ts")
.usingGeneratedKeyColumns("message_id");
@@ -370,9 +366,9 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
@Transactional(readOnly = true)
@Override
- public Optional<com.juick.Message> getMessage(final int mid) {
+ public Optional<Message> getMessage(final int mid) {
- List<com.juick.Message> list = getJdbcTemplate().query(
+ List<Message> list = getJdbcTemplate().query(
"SELECT messages.message_id as mid, 0 as rid, 0 as replyto, "
+ "messages.user_id as uid, users.nick, users.banned as banned, "
+ ""
@@ -405,8 +401,8 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
@Transactional(readOnly = true)
@Override
- public com.juick.Message getReply(final int mid, final int rid) {
- List<com.juick.Message> list = getJdbcTemplate().query(
+ public Message getReply(final int mid, final int rid) {
+ List<Message> list = getJdbcTemplate().query(
"SELECT replies.user_id, users.nick,"
+ "replies.replyto, replies.ts,"
+ "replies.attach, replies.txt, IFNULL(q.txt,t.txt) as quote, "
@@ -481,7 +477,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
+ "FROM messages INNER JOIN users ON messages.user_id = users.id WHERE messages.message_id = ?",
new Object[]{mid},
(rs, num) -> {
- User res = new com.juick.User();
+ User res = new User();
res.setUid(rs.getInt(1));
res.setName(rs.getString(2));
return res;
@@ -875,10 +871,10 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
@Transactional(readOnly = true)
@Override
- public List<com.juick.Message> getMessages(final User visitor, final List<Integer> mids) {
+ public List<Message> getMessages(final User visitor, final List<Integer> mids) {
if (CollectionUtils.isNotEmpty(mids)) {
- List<com.juick.Message> msgs = getNamedParameterJdbcTemplate().query(
+ List<Message> msgs = getNamedParameterJdbcTemplate().query(
"WITH RECURSIVE banned(message_id, reply_id) "
+ "AS (SELECT message_id, reply_id FROM replies WHERE replies.message_id IN (:ids) "
+ "AND (EXISTS (SELECT 1 FROM bl_users b WHERE b.user_id = :uid AND b.bl_user_id = replies.user_id) "
diff --git a/src/main/java/com/juick/service/PMQueriesService.java b/src/main/java/com/juick/service/PMQueriesService.java
index 4f748758..aa5ec794 100644
--- a/src/main/java/com/juick/service/PMQueriesService.java
+++ b/src/main/java/com/juick/service/PMQueriesService.java
@@ -17,8 +17,9 @@
package com.juick.service;
-import com.juick.Chat;
-import com.juick.User;
+import com.juick.model.Chat;
+import com.juick.model.User;
+import com.juick.model.Message;
import java.util.List;
@@ -36,9 +37,9 @@ public interface PMQueriesService {
List<Chat> getLastChats(User user);
- List<com.juick.Message> getPMMessages(int uid, int uidTo);
+ List<Message> getPMMessages(int uid, int uidTo);
- List<com.juick.Message> getLastPMInbox(int uid);
+ List<Message> getLastPMInbox(int uid);
- List<com.juick.Message> getLastPMSent(int uid);
+ List<Message> getLastPMSent(int uid);
}
diff --git a/src/main/java/com/juick/service/PMQueriesServiceImpl.java b/src/main/java/com/juick/service/PMQueriesServiceImpl.java
index c4ffc269..903529fb 100644
--- a/src/main/java/com/juick/service/PMQueriesServiceImpl.java
+++ b/src/main/java/com/juick/service/PMQueriesServiceImpl.java
@@ -17,8 +17,9 @@
package com.juick.service;
-import com.juick.Chat;
-import com.juick.User;
+import com.juick.model.Chat;
+import com.juick.model.User;
+import com.juick.model.Message;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
import org.springframework.jdbc.core.namedparam.SqlParameterSource;
import org.springframework.stereotype.Repository;
@@ -76,7 +77,7 @@ public class PMQueriesServiceImpl extends BaseJdbcService implements PMQueriesSe
+ "WHERE pm.user_id_to=? "
+ "ORDER BY l.last DESC",
(rs, rowNum) -> {
- com.juick.Chat u = new com.juick.Chat();
+ Chat u = new Chat();
u.setUid(rs.getInt(1));
u.setName(rs.getString(2));
u.setLastMessageTimestamp(rs.getTimestamp(3).toInstant());
@@ -88,7 +89,7 @@ public class PMQueriesServiceImpl extends BaseJdbcService implements PMQueriesSe
@Transactional
@Override
- public List<com.juick.Message> getPMMessages(final int uid, final int uidTo) {
+ public List<Message> getPMMessages(final int uid, final int uidTo) {
SqlParameterSource sqlParameterSource = new MapSqlParameterSource()
.addValue("uid", uid)
.addValue("uidTo", uidTo);
@@ -98,7 +99,7 @@ public class PMQueriesServiceImpl extends BaseJdbcService implements PMQueriesSe
+ "OR (user_id_to = :uid AND user_id = :uidTo) ORDER BY ts DESC LIMIT 20",
sqlParameterSource,
(rs, rowNum) -> {
- com.juick.Message msg = new com.juick.Message();
+ Message msg = new Message();
int uuid = rs.getInt(1);
User user = new User();
user.setUid(uuid);
@@ -112,12 +113,12 @@ public class PMQueriesServiceImpl extends BaseJdbcService implements PMQueriesSe
@Transactional(readOnly = true)
@Override
- public List<com.juick.Message> getLastPMInbox(final int uid) {
+ public List<Message> getLastPMInbox(final int uid) {
return getJdbcTemplate().query(
"SELECT pm.user_id, users.nick, pm.txt, pm.ts " +
"FROM pm INNER JOIN users ON pm.user_id=users.id WHERE pm.user_id_to=? ORDER BY pm.ts DESC LIMIT 20",
(rs, num) -> {
- com.juick.Message msg = new com.juick.Message();
+ Message msg = new Message();
msg.setUser(new User());
msg.getUser().setUid(rs.getInt(1));
msg.getUser().setName(rs.getString(2));
@@ -130,13 +131,13 @@ public class PMQueriesServiceImpl extends BaseJdbcService implements PMQueriesSe
@Transactional(readOnly = true)
@Override
- public List<com.juick.Message> getLastPMSent(final int uid) {
+ public List<Message> getLastPMSent(final int uid) {
return getJdbcTemplate().query(
"SELECT pm.user_id_to, users.nick, pm.txt, " +
"pm.ts FROM pm INNER JOIN users ON pm.user_id_to=users.id " +
"WHERE pm.user_id=? ORDER BY pm.ts DESC LIMIT 20",
(rs, num) -> {
- com.juick.Message msg = new com.juick.Message();
+ Message msg = new Message();
msg.setUser(new User());
msg.getUser().setUid(rs.getInt(1));
msg.getUser().setName(rs.getString(2));
diff --git a/src/main/java/com/juick/service/PrivacyQueriesService.java b/src/main/java/com/juick/service/PrivacyQueriesService.java
index 52ba5485..e8f6b089 100644
--- a/src/main/java/com/juick/service/PrivacyQueriesService.java
+++ b/src/main/java/com/juick/service/PrivacyQueriesService.java
@@ -17,8 +17,8 @@
package com.juick.service;
-import com.juick.Tag;
-import com.juick.User;
+import com.juick.model.Tag;
+import com.juick.model.User;
/**
* Created by aalexeev on 11/13/16.
diff --git a/src/main/java/com/juick/service/PrivacyQueriesServiceImpl.java b/src/main/java/com/juick/service/PrivacyQueriesServiceImpl.java
index c8702edf..3696b4e4 100644
--- a/src/main/java/com/juick/service/PrivacyQueriesServiceImpl.java
+++ b/src/main/java/com/juick/service/PrivacyQueriesServiceImpl.java
@@ -17,8 +17,8 @@
package com.juick.service;
-import com.juick.Tag;
-import com.juick.User;
+import com.juick.model.Tag;
+import com.juick.model.User;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
diff --git a/src/main/java/com/juick/service/SearchService.java b/src/main/java/com/juick/service/SearchService.java
index ab27cc12..fbcb61a9 100644
--- a/src/main/java/com/juick/service/SearchService.java
+++ b/src/main/java/com/juick/service/SearchService.java
@@ -17,7 +17,7 @@
package com.juick.service;
-import com.juick.User;
+import com.juick.model.User;
import java.util.List;
diff --git a/src/main/java/com/juick/service/ShowQueriesService.java b/src/main/java/com/juick/service/ShowQueriesService.java
index 3b1f712f..4fcbe7d5 100644
--- a/src/main/java/com/juick/service/ShowQueriesService.java
+++ b/src/main/java/com/juick/service/ShowQueriesService.java
@@ -17,7 +17,7 @@
package com.juick.service;
-import com.juick.User;
+import com.juick.model.User;
import java.util.List;
diff --git a/src/main/java/com/juick/service/ShowQueriesServiceImpl.java b/src/main/java/com/juick/service/ShowQueriesServiceImpl.java
index 54661e64..c5d669bb 100644
--- a/src/main/java/com/juick/service/ShowQueriesServiceImpl.java
+++ b/src/main/java/com/juick/service/ShowQueriesServiceImpl.java
@@ -17,7 +17,7 @@
package com.juick.service;
-import com.juick.User;
+import com.juick.model.User;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
diff --git a/src/main/java/com/juick/service/SocialService.java b/src/main/java/com/juick/service/SocialService.java
index 5fe170cd..9d66ff3a 100644
--- a/src/main/java/com/juick/service/SocialService.java
+++ b/src/main/java/com/juick/service/SocialService.java
@@ -17,7 +17,7 @@
package com.juick.service;
-import com.juick.User;
+import com.juick.model.User;
import javax.annotation.Nonnull;
import java.util.List;
diff --git a/src/main/java/com/juick/service/SphinxSearchService.java b/src/main/java/com/juick/service/SphinxSearchService.java
index 049dc7cc..dd06c485 100644
--- a/src/main/java/com/juick/service/SphinxSearchService.java
+++ b/src/main/java/com/juick/service/SphinxSearchService.java
@@ -17,7 +17,7 @@
package com.juick.service;
-import com.juick.User;
+import com.juick.model.User;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
diff --git a/src/main/java/com/juick/service/SubscriptionService.java b/src/main/java/com/juick/service/SubscriptionService.java
index 51e639ec..3dcc285e 100644
--- a/src/main/java/com/juick/service/SubscriptionService.java
+++ b/src/main/java/com/juick/service/SubscriptionService.java
@@ -17,9 +17,9 @@
package com.juick.service;
-import com.juick.Message;
-import com.juick.Tag;
-import com.juick.User;
+import com.juick.model.Message;
+import com.juick.model.Tag;
+import com.juick.model.User;
import com.juick.model.NotifyOpts;
import java.util.List;
diff --git a/src/main/java/com/juick/service/SubscriptionServiceImpl.java b/src/main/java/com/juick/service/SubscriptionServiceImpl.java
index 4f0a4568..977fbec0 100644
--- a/src/main/java/com/juick/service/SubscriptionServiceImpl.java
+++ b/src/main/java/com/juick/service/SubscriptionServiceImpl.java
@@ -17,9 +17,9 @@
package com.juick.service;
-import com.juick.Message;
-import com.juick.Tag;
-import com.juick.User;
+import com.juick.model.Message;
+import com.juick.model.Tag;
+import com.juick.model.User;
import com.juick.model.NotifyOpts;
import com.juick.util.MessageUtils;
import org.apache.commons.collections4.CollectionUtils;
diff --git a/src/main/java/com/juick/service/TagService.java b/src/main/java/com/juick/service/TagService.java
index 741249a9..3c77e3e6 100644
--- a/src/main/java/com/juick/service/TagService.java
+++ b/src/main/java/com/juick/service/TagService.java
@@ -17,8 +17,8 @@
package com.juick.service;
-import com.juick.Tag;
-import com.juick.User;
+import com.juick.model.Tag;
+import com.juick.model.User;
import com.juick.model.TagStats;
import org.apache.commons.lang3.tuple.Pair;
diff --git a/src/main/java/com/juick/service/TagServiceImpl.java b/src/main/java/com/juick/service/TagServiceImpl.java
index 95a1a309..438438b0 100644
--- a/src/main/java/com/juick/service/TagServiceImpl.java
+++ b/src/main/java/com/juick/service/TagServiceImpl.java
@@ -17,8 +17,8 @@
package com.juick.service;
-import com.juick.Tag;
-import com.juick.User;
+import com.juick.model.Tag;
+import com.juick.model.User;
import com.juick.model.TagStats;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@@ -52,7 +52,7 @@ public class TagServiceImpl extends BaseJdbcService implements TagService {
@Transactional(readOnly = true)
@Override
- public com.juick.Tag getTag(final int tid) {
+ public Tag getTag(final int tid) {
List<Tag> list = getJdbcTemplate().query(
"SELECT synonym_id,name FROM tags WHERE tag_id=?",
(rs, num) -> {
@@ -69,7 +69,7 @@ public class TagServiceImpl extends BaseJdbcService implements TagService {
@Transactional
@Override
- public com.juick.Tag getTag(final String tag, final boolean autoCreate) {
+ public Tag getTag(final String tag, final boolean autoCreate) {
if (StringUtils.isBlank(tag))
return null;
@@ -87,7 +87,7 @@ public class TagServiceImpl extends BaseJdbcService implements TagService {
null : list.get(0);
if (ret == null && autoCreate) {
- ret = new com.juick.Tag(tag);
+ ret = new Tag(tag);
ret.TID = createTag(tag);
}
@@ -236,7 +236,7 @@ public class TagServiceImpl extends BaseJdbcService implements TagService {
"SELECT tags.tag_id,synonym_id,name,stat_messages FROM tags " +
"INNER JOIN messages_tags ON (messages_tags.message_id = ? AND messages_tags.tag_id = tags.tag_id)",
(rs, num) -> {
- com.juick.Tag t = new com.juick.Tag(rs.getString(3));
+ Tag t = new Tag(rs.getString(3));
t.TID = rs.getInt(1);
t.SynonymID = rs.getInt(2);
TagStats s = new TagStats();
diff --git a/src/main/java/com/juick/service/TelegramService.java b/src/main/java/com/juick/service/TelegramService.java
index 9fb55022..1b742c39 100644
--- a/src/main/java/com/juick/service/TelegramService.java
+++ b/src/main/java/com/juick/service/TelegramService.java
@@ -17,7 +17,7 @@
package com.juick.service;
-import com.juick.User;
+import com.juick.model.User;
import java.util.List;
diff --git a/src/main/java/com/juick/service/TelegramServiceImpl.java b/src/main/java/com/juick/service/TelegramServiceImpl.java
index 52e17307..04f4b47c 100644
--- a/src/main/java/com/juick/service/TelegramServiceImpl.java
+++ b/src/main/java/com/juick/service/TelegramServiceImpl.java
@@ -17,7 +17,7 @@
package com.juick.service;
-import com.juick.User;
+import com.juick.model.User;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
diff --git a/src/main/java/com/juick/service/UserService.java b/src/main/java/com/juick/service/UserService.java
index 71b38594..e171126d 100644
--- a/src/main/java/com/juick/service/UserService.java
+++ b/src/main/java/com/juick/service/UserService.java
@@ -17,8 +17,8 @@
package com.juick.service;
-import com.juick.Message;
-import com.juick.User;
+import com.juick.model.Message;
+import com.juick.model.User;
import com.juick.model.AuthResponse;
import javax.annotation.Nonnull;
@@ -61,7 +61,8 @@ public interface UserService {
int getUIDbyHash(String hash);
- @Nonnull com.juick.User getUserByHash(String hash);
+ @Nonnull
+ User getUserByHash(String hash);
String getHashByUID(int uid);
@@ -91,7 +92,7 @@ public interface UserService {
boolean isSubscribed(int uid, int check);
- List<com.juick.User> getUserReadLeastPopular(int uid, int cnt);
+ List<User> getUserReadLeastPopular(int uid, int cnt);
List<User> getUserReaders(int uid);
@@ -99,7 +100,7 @@ public interface UserService {
Integer getUserRecommendations(User user);
- List<com.juick.User> getUserBLUsers(int uid);
+ List<User> getUserBLUsers(int uid);
boolean linkTwitterAccount(User user, String accessToken, String accessTokenSecret, String screenName);
diff --git a/src/main/java/com/juick/service/UserServiceImpl.java b/src/main/java/com/juick/service/UserServiceImpl.java
index 9f01b4db..084f3a00 100644
--- a/src/main/java/com/juick/service/UserServiceImpl.java
+++ b/src/main/java/com/juick/service/UserServiceImpl.java
@@ -17,8 +17,8 @@
package com.juick.service;
-import com.juick.Message;
-import com.juick.User;
+import com.juick.model.Message;
+import com.juick.model.User;
import com.juick.model.AnonymousUser;
import com.juick.model.AuthResponse;
import org.apache.commons.collections4.CollectionUtils;
@@ -284,7 +284,7 @@ public class UserServiceImpl extends BaseJdbcService implements UserService {
@Transactional(readOnly = true)
@Override
- public com.juick.User getUserByHash(final String hash) {
+ public User getUserByHash(final String hash) {
if (StringUtils.isNotBlank(hash)) {
List<User> list = getJdbcTemplate().query(
"SELECT DISTINCT logins.user_id, u.nick, u.passw, u.banned, u.last_seen," +
@@ -504,14 +504,14 @@ public class UserServiceImpl extends BaseJdbcService implements UserService {
@Transactional(readOnly = true)
@Override
- public List<com.juick.User> getUserReadLeastPopular(final int uid, final int cnt) {
+ public List<User> getUserReadLeastPopular(final int uid, final int cnt) {
return getJdbcTemplate().query(
"SELECT users.id,users.nick FROM (subscr_users " +
"INNER JOIN users_subscr ON (subscr_users.suser_id=? " +
"AND subscr_users.user_id=users_subscr.user_id)) INNER JOIN users " +
"ON subscr_users.user_id=users.id ORDER BY cnt LIMIT ?",
(rs, num) -> {
- com.juick.User u = new com.juick.User();
+ User u = new User();
u.setUid(rs.getInt(1));
u.setName(rs.getString(2));
return u;
@@ -528,7 +528,7 @@ public class UserServiceImpl extends BaseJdbcService implements UserService {
"INNER JOIN users ON subscr_users.suser_id=users.id " +
"WHERE subscr_users.user_id=? ORDER BY users.nick",
(rs, num) -> {
- com.juick.User u = new com.juick.User();
+ User u = new User();
u.setUid(rs.getInt(1));
u.setName(rs.getString(2));
return u;
@@ -545,7 +545,7 @@ public class UserServiceImpl extends BaseJdbcService implements UserService {
"WHERE subscr_users.suser_id=? AND users.id!=? " +
"ORDER BY users.nick",
(rs, num) -> {
- com.juick.User u = new com.juick.User();
+ User u = new User();
u.setUid(rs.getInt(1));
u.setName(rs.getString(2));
return u;
@@ -566,11 +566,11 @@ public class UserServiceImpl extends BaseJdbcService implements UserService {
@Transactional(readOnly = true)
@Override
- public List<com.juick.User> getUserBLUsers(final int uid) {
+ public List<User> getUserBLUsers(final int uid) {
return getJdbcTemplate().query("SELECT users.id,users.nick FROM users INNER JOIN bl_users " +
"ON(bl_users.bl_user_id=users.id) WHERE bl_users.user_id=? ORDER BY users.nick",
(rs, num) -> {
- com.juick.User u = new com.juick.User();
+ User u = new User();
u.setUid(rs.getInt(1));
u.setName(rs.getString(2));
return u;
diff --git a/src/main/java/com/juick/service/activities/DeleteMessageEvent.java b/src/main/java/com/juick/service/activities/DeleteMessageEvent.java
index c858ec72..8ca75122 100644
--- a/src/main/java/com/juick/service/activities/DeleteMessageEvent.java
+++ b/src/main/java/com/juick/service/activities/DeleteMessageEvent.java
@@ -17,7 +17,7 @@
package com.juick.service.activities;
-import com.juick.Message;
+import com.juick.model.Message;
import org.springframework.context.ApplicationEvent;
public class DeleteMessageEvent extends ApplicationEvent {
diff --git a/src/main/java/com/juick/service/activities/UpdateEvent.java b/src/main/java/com/juick/service/activities/UpdateEvent.java
index 0d02e80b..59833c8d 100644
--- a/src/main/java/com/juick/service/activities/UpdateEvent.java
+++ b/src/main/java/com/juick/service/activities/UpdateEvent.java
@@ -17,7 +17,7 @@
package com.juick.service.activities;
-import com.juick.User;
+import com.juick.model.User;
import org.springframework.context.ApplicationEvent;
public class UpdateEvent extends ApplicationEvent {
diff --git a/src/main/java/com/juick/service/component/PingEvent.java b/src/main/java/com/juick/service/component/PingEvent.java
index e7e4a3c7..45a63dd7 100644
--- a/src/main/java/com/juick/service/component/PingEvent.java
+++ b/src/main/java/com/juick/service/component/PingEvent.java
@@ -17,7 +17,7 @@
package com.juick.service.component;
-import com.juick.User;
+import com.juick.model.User;
import org.springframework.context.ApplicationEvent;
public class PingEvent extends ApplicationEvent {
diff --git a/src/main/java/com/juick/service/component/UserUpdatedEvent.java b/src/main/java/com/juick/service/component/UserUpdatedEvent.java
index cbb96da8..f22a5a43 100644
--- a/src/main/java/com/juick/service/component/UserUpdatedEvent.java
+++ b/src/main/java/com/juick/service/component/UserUpdatedEvent.java
@@ -17,7 +17,7 @@
package com.juick.service.component;
-import com.juick.User;
+import com.juick.model.User;
import org.springframework.context.ApplicationEvent;
import org.springframework.lang.NonNull;
diff --git a/src/main/java/com/juick/service/security/HTTPSignatureAuthenticationFilter.java b/src/main/java/com/juick/service/security/HTTPSignatureAuthenticationFilter.java
index 01a35695..1b3cb936 100644
--- a/src/main/java/com/juick/service/security/HTTPSignatureAuthenticationFilter.java
+++ b/src/main/java/com/juick/service/security/HTTPSignatureAuthenticationFilter.java
@@ -17,7 +17,7 @@
package com.juick.service.security;
-import com.juick.User;
+import com.juick.model.User;
import com.juick.server.SignatureManager;
import com.juick.service.UserService;
import com.juick.service.security.entities.JuickUser;
diff --git a/src/main/java/com/juick/service/security/HashParamAuthenticationFilter.java b/src/main/java/com/juick/service/security/HashParamAuthenticationFilter.java
index 3dc58782..68ae91ee 100644
--- a/src/main/java/com/juick/service/security/HashParamAuthenticationFilter.java
+++ b/src/main/java/com/juick/service/security/HashParamAuthenticationFilter.java
@@ -17,7 +17,7 @@
package com.juick.service.security;
-import com.juick.User;
+import com.juick.model.User;
import com.juick.service.UserService;
import com.juick.service.security.entities.JuickUser;
import org.apache.commons.lang3.StringUtils;
diff --git a/src/main/java/com/juick/service/security/JuickUserDetailsService.java b/src/main/java/com/juick/service/security/JuickUserDetailsService.java
index fd539a8c..a62bdadd 100644
--- a/src/main/java/com/juick/service/security/JuickUserDetailsService.java
+++ b/src/main/java/com/juick/service/security/JuickUserDetailsService.java
@@ -17,6 +17,7 @@
package com.juick.service.security;
+import com.juick.model.User;
import com.juick.service.UserService;
import com.juick.service.security.entities.JuickUser;
import org.apache.commons.lang3.StringUtils;
@@ -41,7 +42,7 @@ public class JuickUserDetailsService implements UserDetailsService {
if (StringUtils.isBlank(username))
throw new UsernameNotFoundException("Invalid user name " + username);
- com.juick.User user = userService.getUserByName(username);
+ User user = userService.getUserByName(username);
if (!user.isAnonymous()) {
user.setAuthHash(userService.getHashByUID(user.getUid()));
diff --git a/src/main/java/com/juick/service/security/entities/JuickUser.java b/src/main/java/com/juick/service/security/entities/JuickUser.java
index eb2e43dc..062db3a4 100644
--- a/src/main/java/com/juick/service/security/entities/JuickUser.java
+++ b/src/main/java/com/juick/service/security/entities/JuickUser.java
@@ -17,7 +17,7 @@
package com.juick.service.security.entities;
-import com.juick.User;
+import com.juick.model.User;
import com.juick.model.AnonymousUser;
import org.apache.commons.lang3.StringUtils;
import org.springframework.security.core.GrantedAuthority;
@@ -40,14 +40,14 @@ public class JuickUser implements UserDetails {
public static final JuickUser ANONYMOUS_USER = new JuickUser(AnonymousUser.INSTANCE, ANONYMOUS_AUTHORITY);
- private final com.juick.User user;
+ private final User user;
private final Collection<? extends GrantedAuthority> authorities;
- public JuickUser(com.juick.User user) {
+ public JuickUser(User user) {
this(user, USER_AUTHORITY);
}
- public JuickUser(com.juick.User user, Collection<? extends GrantedAuthority> authorities) {
+ public JuickUser(User user, Collection<? extends GrantedAuthority> authorities) {
this.user = user;
this.authorities = authorities;
}
diff --git a/src/main/java/com/juick/util/MessageUtils.java b/src/main/java/com/juick/util/MessageUtils.java
index b922d980..b4c33474 100644
--- a/src/main/java/com/juick/util/MessageUtils.java
+++ b/src/main/java/com/juick/util/MessageUtils.java
@@ -17,15 +17,13 @@
package com.juick.util;
-import com.juick.Message;
-import com.juick.Tag;
-import com.juick.User;
+import com.juick.model.Message;
+import com.juick.model.Tag;
+import com.juick.model.User;
import com.juick.model.Entity;
-import org.apache.commons.codec.CharEncoding;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.util.UriComponentsBuilder;
-import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
diff --git a/src/main/java/com/mitchellbosecke/pebble/extension/filters/FormatMessageFilter.java b/src/main/java/com/mitchellbosecke/pebble/extension/filters/FormatMessageFilter.java
index 27b9d970..3f641b15 100644
--- a/src/main/java/com/mitchellbosecke/pebble/extension/filters/FormatMessageFilter.java
+++ b/src/main/java/com/mitchellbosecke/pebble/extension/filters/FormatMessageFilter.java
@@ -17,7 +17,7 @@
package com.mitchellbosecke.pebble.extension.filters;
-import com.juick.Message;
+import com.juick.model.Message;
import com.juick.util.MessageUtils;
import com.mitchellbosecke.pebble.extension.Filter;
import com.mitchellbosecke.pebble.extension.escaper.SafeString;
diff --git a/src/main/java/com/mitchellbosecke/pebble/extension/filters/TagsListFilter.java b/src/main/java/com/mitchellbosecke/pebble/extension/filters/TagsListFilter.java
index c83c3a45..9bb0decd 100644
--- a/src/main/java/com/mitchellbosecke/pebble/extension/filters/TagsListFilter.java
+++ b/src/main/java/com/mitchellbosecke/pebble/extension/filters/TagsListFilter.java
@@ -17,7 +17,7 @@
package com.mitchellbosecke.pebble.extension.filters;
-import com.juick.Tag;
+import com.juick.model.Tag;
import com.mitchellbosecke.pebble.extension.Filter;
import com.mitchellbosecke.pebble.template.EvaluationContext;
import com.mitchellbosecke.pebble.template.PebbleTemplate;