From c9d67837cbcaae84a03b7bd14e508ca62880f87f Mon Sep 17 00:00:00 2001
From: Vitaly Takmazov
Date: Sat, 7 Mar 2020 13:20:45 +0300
Subject: Reorganize project layout
---
src/main/java/com/juick/API.java | 33 ++
src/main/java/com/juick/ApiServer.java | 33 --
src/main/java/com/juick/Attachment.java | 77 ----
src/main/java/com/juick/Chat.java | 44 ---
src/main/java/com/juick/ExternalToken.java | 64 ----
src/main/java/com/juick/Message.java | 390 ---------------------
src/main/java/com/juick/Photo.java | 55 ---
src/main/java/com/juick/Reaction.java | 64 ----
src/main/java/com/juick/Status.java | 49 ---
src/main/java/com/juick/Tag.java | 74 ----
src/main/java/com/juick/User.java | 273 ---------------
.../java/com/juick/adapters/SimpleDateAdapter.java | 4 +-
.../com/juick/formatters/PlainTextFormatter.java | 6 +-
src/main/java/com/juick/model/AnonymousUser.java | 2 -
src/main/java/com/juick/model/Attachment.java | 77 ++++
src/main/java/com/juick/model/Chat.java | 44 +++
src/main/java/com/juick/model/CommandResult.java | 2 -
src/main/java/com/juick/model/ExternalToken.java | 64 ++++
src/main/java/com/juick/model/Message.java | 389 ++++++++++++++++++++
src/main/java/com/juick/model/Photo.java | 55 +++
src/main/java/com/juick/model/PrivateChats.java | 1 -
src/main/java/com/juick/model/Reaction.java | 64 ++++
src/main/java/com/juick/model/Status.java | 49 +++
src/main/java/com/juick/model/Tag.java | 74 ++++
src/main/java/com/juick/model/TagStats.java | 1 -
src/main/java/com/juick/model/User.java | 272 ++++++++++++++
.../java/com/juick/model/ext/facebook/User.java | 55 +++
.../java/com/juick/model/ext/twitter/User.java | 34 ++
src/main/java/com/juick/model/ext/vk/Token.java | 46 +++
src/main/java/com/juick/model/ext/vk/User.java | 51 +++
.../java/com/juick/model/ext/vk/UsersResponse.java | 34 ++
src/main/java/com/juick/model/facebook/User.java | 55 ---
src/main/java/com/juick/model/package-info.java | 35 ++
src/main/java/com/juick/model/twitter/User.java | 34 --
src/main/java/com/juick/model/vk/Token.java | 46 ---
src/main/java/com/juick/model/vk/User.java | 51 ---
.../java/com/juick/model/vk/UsersResponse.java | 34 --
src/main/java/com/juick/package-info.java | 35 --
.../java/com/juick/server/ActivityPubManager.java | 9 +-
.../java/com/juick/server/CommandsManager.java | 16 +-
src/main/java/com/juick/server/EmailManager.java | 6 +-
src/main/java/com/juick/server/ServerManager.java | 12 +-
.../java/com/juick/server/SignatureManager.java | 2 +-
.../java/com/juick/server/TelegramBotManager.java | 40 +--
src/main/java/com/juick/server/TopManager.java | 6 +-
src/main/java/com/juick/server/TwitterManager.java | 8 +-
src/main/java/com/juick/server/XMPPManager.java | 20 +-
.../java/com/juick/server/api/ApiSocialLogin.java | 15 +-
src/main/java/com/juick/server/api/Messages.java | 18 +-
.../java/com/juick/server/api/Notifications.java | 8 +-
src/main/java/com/juick/server/api/PM.java | 12 +-
src/main/java/com/juick/server/api/Post.java | 16 +-
src/main/java/com/juick/server/api/Service.java | 4 +-
.../java/com/juick/server/api/SystemActivity.java | 4 +-
src/main/java/com/juick/server/api/Tags.java | 2 +-
src/main/java/com/juick/server/api/Users.java | 8 +-
.../com/juick/server/api/activity/Profile.java | 4 +-
src/main/java/com/juick/server/api/rss/Feeds.java | 2 +-
.../com/juick/server/api/rss/MessagesView.java | 4 +-
.../com/juick/server/api/webfinger/Resource.java | 2 +-
.../java/com/juick/server/util/ImageUtils.java | 2 +-
src/main/java/com/juick/server/util/TagUtils.java | 2 +-
src/main/java/com/juick/server/www/WebApp.java | 4 +-
.../com/juick/server/www/controllers/Help.java | 2 +-
.../com/juick/server/www/controllers/Login.java | 2 +-
.../juick/server/www/controllers/MessagesWWW.java | 40 +--
.../com/juick/server/www/controllers/Settings.java | 2 +-
.../com/juick/server/www/controllers/SignUp.java | 2 +-
.../juick/server/www/controllers/SocialLogin.java | 14 +-
.../juick/server/www/filters/AnythingFilter.java | 7 +-
.../java/com/juick/service/ActivityPubService.java | 2 +-
.../java/com/juick/service/CrosspostService.java | 2 +-
.../com/juick/service/CrosspostServiceImpl.java | 2 +-
src/main/java/com/juick/service/ImagesService.java | 2 +-
.../java/com/juick/service/ImagesServiceImpl.java | 6 +-
.../java/com/juick/service/MessagesService.java | 17 +-
.../com/juick/service/MessagesServiceImpl.java | 24 +-
.../java/com/juick/service/PMQueriesService.java | 11 +-
.../com/juick/service/PMQueriesServiceImpl.java | 19 +-
.../com/juick/service/PrivacyQueriesService.java | 4 +-
.../juick/service/PrivacyQueriesServiceImpl.java | 4 +-
src/main/java/com/juick/service/SearchService.java | 2 +-
.../java/com/juick/service/ShowQueriesService.java | 2 +-
.../com/juick/service/ShowQueriesServiceImpl.java | 2 +-
src/main/java/com/juick/service/SocialService.java | 2 +-
.../com/juick/service/SphinxSearchService.java | 2 +-
.../com/juick/service/SubscriptionService.java | 6 +-
.../com/juick/service/SubscriptionServiceImpl.java | 6 +-
src/main/java/com/juick/service/TagService.java | 4 +-
.../java/com/juick/service/TagServiceImpl.java | 12 +-
.../java/com/juick/service/TelegramService.java | 2 +-
.../com/juick/service/TelegramServiceImpl.java | 2 +-
src/main/java/com/juick/service/UserService.java | 11 +-
.../java/com/juick/service/UserServiceImpl.java | 18 +-
.../service/activities/DeleteMessageEvent.java | 2 +-
.../com/juick/service/activities/UpdateEvent.java | 2 +-
.../com/juick/service/component/PingEvent.java | 2 +-
.../juick/service/component/UserUpdatedEvent.java | 2 +-
.../HTTPSignatureAuthenticationFilter.java | 2 +-
.../security/HashParamAuthenticationFilter.java | 2 +-
.../service/security/JuickUserDetailsService.java | 3 +-
.../juick/service/security/entities/JuickUser.java | 8 +-
src/main/java/com/juick/util/MessageUtils.java | 8 +-
.../extension/filters/FormatMessageFilter.java | 2 +-
.../pebble/extension/filters/TagsListFilter.java | 2 +-
105 files changed, 1628 insertions(+), 1636 deletions(-)
create mode 100644 src/main/java/com/juick/API.java
delete mode 100644 src/main/java/com/juick/ApiServer.java
delete mode 100644 src/main/java/com/juick/Attachment.java
delete mode 100644 src/main/java/com/juick/Chat.java
delete mode 100644 src/main/java/com/juick/ExternalToken.java
delete mode 100644 src/main/java/com/juick/Message.java
delete mode 100644 src/main/java/com/juick/Photo.java
delete mode 100644 src/main/java/com/juick/Reaction.java
delete mode 100644 src/main/java/com/juick/Status.java
delete mode 100644 src/main/java/com/juick/Tag.java
delete mode 100644 src/main/java/com/juick/User.java
create mode 100644 src/main/java/com/juick/model/Attachment.java
create mode 100644 src/main/java/com/juick/model/Chat.java
create mode 100644 src/main/java/com/juick/model/ExternalToken.java
create mode 100644 src/main/java/com/juick/model/Message.java
create mode 100644 src/main/java/com/juick/model/Photo.java
create mode 100644 src/main/java/com/juick/model/Reaction.java
create mode 100644 src/main/java/com/juick/model/Status.java
create mode 100644 src/main/java/com/juick/model/Tag.java
create mode 100644 src/main/java/com/juick/model/User.java
create mode 100644 src/main/java/com/juick/model/ext/facebook/User.java
create mode 100644 src/main/java/com/juick/model/ext/twitter/User.java
create mode 100644 src/main/java/com/juick/model/ext/vk/Token.java
create mode 100644 src/main/java/com/juick/model/ext/vk/User.java
create mode 100644 src/main/java/com/juick/model/ext/vk/UsersResponse.java
delete mode 100644 src/main/java/com/juick/model/facebook/User.java
create mode 100644 src/main/java/com/juick/model/package-info.java
delete mode 100644 src/main/java/com/juick/model/twitter/User.java
delete mode 100644 src/main/java/com/juick/model/vk/Token.java
delete mode 100644 src/main/java/com/juick/model/vk/User.java
delete mode 100644 src/main/java/com/juick/model/vk/UsersResponse.java
delete mode 100644 src/main/java/com/juick/package-info.java
(limited to 'src/main')
diff --git a/src/main/java/com/juick/API.java b/src/main/java/com/juick/API.java
new file mode 100644
index 00000000..fdfc4977
--- /dev/null
+++ b/src/main/java/com/juick/API.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2008-2019, Juick
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package com.juick;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.mail.MailSenderAutoConfiguration;
+import org.springframework.context.annotation.ComponentScan;
+
+@SpringBootApplication
+@EnableAutoConfiguration(exclude = { MailSenderAutoConfiguration.class })
+@ComponentScan(basePackages = {"com.juick.server", "com.juick.service"})
+public class API {
+ public static void main(String[] args) {
+ SpringApplication.run(API.class, args);
+ }
+}
diff --git a/src/main/java/com/juick/ApiServer.java b/src/main/java/com/juick/ApiServer.java
deleted file mode 100644
index a5d55102..00000000
--- a/src/main/java/com/juick/ApiServer.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2008-2019, Juick
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package com.juick;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.autoconfigure.mail.MailSenderAutoConfiguration;
-import org.springframework.context.annotation.ComponentScan;
-
-@SpringBootApplication
-@EnableAutoConfiguration(exclude = { MailSenderAutoConfiguration.class })
-@ComponentScan(basePackages = {"com.juick.server", "com.juick.service"})
-public class ApiServer {
- public static void main(String[] args) {
- SpringApplication.run(ApiServer.class, args);
- }
-}
diff --git a/src/main/java/com/juick/Attachment.java b/src/main/java/com/juick/Attachment.java
deleted file mode 100644
index 3c4d2343..00000000
--- a/src/main/java/com/juick/Attachment.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (C) 2008-2019, Juick
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package com.juick;
-
-import java.io.Serializable;
-
-public class Attachment implements Serializable {
- private String url;
- private Integer height;
- private Integer width;
- private Attachment small;
- private Attachment medium;
- private Attachment thumbnail;
-
- public String getUrl() {
- return url;
- }
-
- public void setUrl(String url) {
- this.url = url;
- }
-
- public Integer getHeight() {
- return height;
- }
-
- public void setHeight(Integer height) {
- this.height = height;
- }
-
- public Integer getWidth() {
- return width;
- }
-
- public void setWidth(Integer width) {
- this.width = width;
- }
-
- public Attachment getSmall() {
- return small;
- }
-
- public void setSmall(Attachment small) {
- this.small = small;
- }
-
- public Attachment getMedium() {
- return medium;
- }
-
- public void setMedium(Attachment medium) {
- this.medium = medium;
- }
-
- public Attachment getThumbnail() {
- return thumbnail;
- }
-
- public void setThumbnail(Attachment thumbnail) {
- this.thumbnail = thumbnail;
- }
-}
diff --git a/src/main/java/com/juick/Chat.java b/src/main/java/com/juick/Chat.java
deleted file mode 100644
index 5f50976d..00000000
--- a/src/main/java/com/juick/Chat.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2008-2019, Juick
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package com.juick;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-
-import java.time.Instant;
-
-public class Chat extends User {
- private Instant lastMessageTimestamp;
- private String lastMessageText;
-
- public Instant getLastMessageTimestamp() {
- return lastMessageTimestamp;
- }
-
- @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "UTC")
- public void setLastMessageTimestamp(Instant lastMessageTimestamp) {
- this.lastMessageTimestamp = lastMessageTimestamp;
- }
-
- public String getLastMessageText() {
- return lastMessageText;
- }
-
- public void setLastMessageText(String lastMessageText) {
- this.lastMessageText = lastMessageText;
- }
-}
diff --git a/src/main/java/com/juick/ExternalToken.java b/src/main/java/com/juick/ExternalToken.java
deleted file mode 100644
index 8f35d6d9..00000000
--- a/src/main/java/com/juick/ExternalToken.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2008-2019, Juick
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package com.juick;
-
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * Created by vitalyster on 22.11.2016.
- */
-public class ExternalToken {
- private String name;
- private String type;
- private String token;
- private String secret;
-
- @JsonCreator
- public ExternalToken(@JsonProperty("name") String name,
- @JsonProperty("type") String type,
- @JsonProperty("token") String token,
- @JsonProperty("secret") String secret) {
- this.name = name;
- this.type = type;
- this.token = token;
- this.secret = secret;
- if (this.type == null) {
- throw new IllegalStateException("Token must have type");
- }
- if (this.token == null) {
- throw new IllegalStateException("Token must have value");
- }
- }
-
- public String getType() {
- return type;
- }
-
- public String getToken() {
- return token;
- }
-
- public String getName() {
- return name;
- }
-
- public String getSecret() {
- return secret;
- }
-}
diff --git a/src/main/java/com/juick/Message.java b/src/main/java/com/juick/Message.java
deleted file mode 100644
index 8c270326..00000000
--- a/src/main/java/com/juick/Message.java
+++ /dev/null
@@ -1,390 +0,0 @@
-/*
- * Copyright (C) 2008-2019, Juick
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-package com.juick;
-
-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;
-import javax.xml.bind.annotation.*;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import java.io.Serializable;
-import java.net.URI;
-import java.time.Instant;
-import java.util.HashSet;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Objects;
-import java.util.Set;
-
-/**
- * @author Ugnich Anton
- */
-@XmlRootElement(name = "juick", namespace = "http://juick.com/message")
-@XmlAccessorType()
-public class Message implements Comparable, Serializable {
- private int mid = 0;
- private int rid = 0;
- private int replyto = 0;
- private String text = null;
- private User user = null;
- private Set tags;
- private Instant created;
- private Instant updated;
- private Instant updatedAt;
- private boolean unread;
- @JsonIgnore
- private int privacy = 1;
- @XmlTransient
- @JsonIgnore
- public boolean FriendsOnly = false;
- @XmlTransient
- @JsonIgnore
- public boolean ReadOnly = false;
- @XmlTransient
- @JsonIgnore
- public boolean Hidden = false;
- @JsonIgnore
- @XmlTransient
- public boolean VisitorCanComment = true;
- private int replies = 0;
- private String repliesBy;
- private String attachmentType;
- @XmlTransient
- private Photo photo;
- @XmlTransient
- private Attachment attachment;
- private int likes;
- private User to;
- private String replyQuote;
- @XmlTransient
- private Set reactions;
- private boolean service;
- private URI replyUri;
- private URI replyToUri;
- private boolean html;
-
- private Set recommendations;
-
- private List entities;
-
- public Message() {
- tags = new LinkedHashSet<>();
- reactions = new HashSet<>();
- }
-
- @Override
- public String toString() {
- return new ToStringBuilder(this)
- .append("mid", mid)
- .append("rid", rid)
- .append("replyto", replyto)
- .append("privacy", privacy)
- .append("FriendsOnly", FriendsOnly)
- .append("ReadOnly", ReadOnly)
- .append("Hidden", Hidden)
- .append("VisitorCanComment", VisitorCanComment)
- .append("replies", replies)
- .append("likes", likes)
- .append("reactions", reactions)
- .toString();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == this)
- return true;
-
- if (!(obj instanceof Message))
- return false;
-
- Message jmsg = (Message) obj;
- return (this.getMid() == jmsg.getMid() && this.getRid() == jmsg.getRid());
- }
-
- @Override
- public int compareTo(@Nonnull Object obj) throws ClassCastException {
- if (obj == this)
- return 0;
-
- if (!(obj instanceof Message))
- throw new ClassCastException();
-
- Message jmsg = (Message) obj;
-
- int cmp = Integer.compare(jmsg.getMid(), getMid());
-
- if (cmp == 0)
- cmp = Integer.compare(getRid(), jmsg.getRid());
-
- return cmp;
- }
-
- @JsonProperty("mid")
- @XmlAttribute(name = "mid")
- public int getMid() {
- return mid;
- }
-
- public void setMid(int mid) {
- this.mid = mid;
- }
-
- @JsonProperty("rid")
- @XmlAttribute(name = "rid")
- public int getRid() {
- return rid;
- }
-
- public void setRid(int rid) {
- this.rid = rid;
- }
-
- @XmlElement(name = "user", namespace = "http://juick.com/user")
- public com.juick.User getUser() {
- return user;
- }
-
- public void setUser(com.juick.User user) {
- this.user = user;
- }
-
- @JsonProperty("body")
- @XmlElement(name = "body")
- public String getText() {
- return text;
- }
-
- public void setText(String text) {
- this.text = text;
- }
-
- @JsonProperty("timestamp")
- @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "UTC")
- @XmlAttribute(name = "ts")
- @XmlJavaTypeAdapter(SimpleDateAdapter.class)
- public Instant getCreated() {
- return created;
- }
-
- public void setCreated(Instant timestamp) {
- this.created = timestamp;
- }
-
- @XmlTransient
- public User getTo() {
- return to;
- }
-
- public void setTo(User to) {
- this.to = to;
- }
-
- @XmlAttribute(name = "quote")
- public String getReplyQuote() {
- return replyQuote;
- }
-
- public void setReplyQuote(String quote) {
- replyQuote = quote;
- }
-
- @JsonProperty("replyto")
- @XmlAttribute(name = "replyto")
- public int getReplyto() {
- return replyto;
- }
-
- public void setReplyto(int replyto) {
- this.replyto = replyto;
- }
-
- @JsonProperty("tags")
- @XmlElement(name = "tag")
- public Set getTags() {
- return tags;
- }
-
- public void setTags(Set tags) {
- this.tags = tags;
- }
-
- @XmlAttribute
- public int getPrivacy() {
- return privacy;
- }
-
- public void setPrivacy(int privacy) {
- this.privacy = privacy;
- }
-
- public Photo getPhoto() {
- return photo;
- }
-
- public void setPhoto(Photo photo) {
- this.photo = photo;
- }
-
- @XmlAttribute(name = "attach")
- @JsonProperty("attach")
- public String getAttachmentType() {
- return attachmentType;
- }
-
- public void setAttachmentType(String attachmentType) {
- this.attachmentType = attachmentType;
- }
-
- @XmlTransient
- public int getReplies() {
- return replies;
- }
-
- public void setReplies(int replies) {
- this.replies = replies;
- }
-
- @XmlTransient
- public int getLikes() {
- return likes;
- }
-
- public void setLikes(int likes) {
- this.likes = likes;
- }
-
- @JsonProperty("repliesby")
- public String getRepliesBy() {
- return repliesBy;
- }
-
- public void setRepliesBy(String repliesBy) {
- this.repliesBy = repliesBy;
- }
-
- public Attachment getAttachment() {
- return attachment;
- }
- public void setAttachment(Attachment attachment) {
- this.attachment = attachment;
- }
-
- /**
- * @return timestamp of the last comment
- */
- @XmlTransient
- public Instant getUpdated() {
- return updated;
- }
-
- public void setUpdated(Instant updated) {
- this.updated = updated;
- }
-
- @XmlTransient
- public boolean isUnread() {
- return unread;
- }
-
- public void setUnread(boolean unread) {
- this.unread = unread;
- }
-
-
- @XmlTransient
- public Set getReactions() {
- return reactions;
- }
-
- public void setReactions(Set reactions) {
- this.reactions = reactions;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(mid, rid);
- }
-
- public boolean isService() {
- return service;
- }
-
- public void setService(boolean service) {
- this.service = service;
- }
-
- public Set getRecommendations() {
- return recommendations;
- }
-
- public void setRecommendations(Set recommendations) {
- this.recommendations = recommendations;
- }
-
- /**
- * @return timestamp of the last edit
- */
- @XmlTransient
- @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "UTC")
- @JsonProperty("updated_at")
- public Instant getUpdatedAt() {
- return updatedAt;
- }
-
- public void setUpdatedAt(Instant updatedAt) {
- this.updatedAt = updatedAt;
- }
-
- public URI getReplyUri() {
- return replyUri;
- }
-
- public void setReplyUri(URI replyUri) {
- this.replyUri = replyUri;
- }
-
- @XmlAttribute(name = "html")
- public boolean isHtml() {
- return html;
- }
-
- public void setHtml(boolean html) {
- this.html = html;
- }
-
- @XmlTransient
- public URI getReplyToUri() {
- return replyToUri;
- }
-
- public void setReplyToUri(URI replyToUri) {
- this.replyToUri = replyToUri;
- }
-
- public List getEntities() {
- return entities;
- }
-
- public void setEntities(List entities) {
- this.entities = entities;
- }
-}
diff --git a/src/main/java/com/juick/Photo.java b/src/main/java/com/juick/Photo.java
deleted file mode 100644
index 441804c9..00000000
--- a/src/main/java/com/juick/Photo.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2008-2019, Juick
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package com.juick;
-
-import java.io.Serializable;
-
-/**
- * Created by vitalyster on 30.11.2016.
- */
-// used for compatibility
-@Deprecated
-public class Photo implements Serializable {
- private String small;
- private String medium;
- private String thumbnail;
-
- public String getSmall() {
- return small;
- }
-
- public void setSmall(String small) {
- this.small = small;
- }
-
- public String getMedium() {
- return medium;
- }
-
- public void setMedium(String medium) {
- this.medium = medium;
- }
-
- public String getThumbnail() {
- return thumbnail;
- }
-
- public void setThumbnail(String thumbnail) {
- this.thumbnail = thumbnail;
- }
-}
diff --git a/src/main/java/com/juick/Reaction.java b/src/main/java/com/juick/Reaction.java
deleted file mode 100644
index 77cebd5f..00000000
--- a/src/main/java/com/juick/Reaction.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2008-2019, Juick
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package com.juick;
-
-import org.apache.commons.lang3.builder.ToStringBuilder;
-
-import java.io.Serializable;
-
-public class Reaction implements Serializable {
-
- public static final int LIKE = 1;
-
- private final int id;
- private String description;
- private int count;
-
- public Reaction(int id) {
- this.id = id;
- }
-
- @Override
- public String toString() {
- return new ToStringBuilder(this)
- .append("id", getId())
- .append("description", description)
- .append("count", count)
- .build();
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public int getCount() {
- return count;
- }
-
- public void setCount(int count) {
- this.count = count;
- }
-
- public int getId() {
- return id;
- }
-}
diff --git a/src/main/java/com/juick/Status.java b/src/main/java/com/juick/Status.java
deleted file mode 100644
index bb6eb031..00000000
--- a/src/main/java/com/juick/Status.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2008-2019, Juick
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package com.juick;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * Created by vitalyster on 25.07.2016.
- */
-public class Status {
- private final String value;
-
- public static final Status OK = new Status("ok");
- public static final Status FAIL = new Status("Fail");
- public static final Status ERROR = new Status("Error");
-
- public static Status getStatus(final String stringStatus) {
- return new Status(stringStatus);
- }
-
- private Status(String value) {
- this.value = value;
- }
-
- @JsonProperty("status")
- public String getValue() {
- return value;
- }
-
- @Override
- public String toString() {
- return "value = " + value;
- }
-}
diff --git a/src/main/java/com/juick/Tag.java b/src/main/java/com/juick/Tag.java
deleted file mode 100644
index d234f2c1..00000000
--- a/src/main/java/com/juick/Tag.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2008-2019, Juick
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-package com.juick;
-
-import com.fasterxml.jackson.annotation.JsonValue;
-
-import javax.xml.bind.annotation.*;
-import java.io.Serializable;
-import java.util.Comparator;
-import java.util.Objects;
-
-/**
- * @author Ugnich Anton
- */
-@XmlRootElement(name = "tag", namespace = "http://juick.com/message")
-@XmlAccessorType(XmlAccessType.FIELD)
-public class Tag implements Comparable, Serializable {
- @XmlValue
- private String name;
-
- @XmlTransient
- public int TID = 0;
- @XmlTransient
- public int SynonymID = 0;
-
- public Tag() {
- // required for (de)serialization
- }
-
- public Tag(String name) {
- this.name = name;
- }
-
- @Override
- public boolean equals(Object o) {
- return o == this ||
- (o instanceof Tag) && Objects.equals(name, ((Tag) o).name);
- }
-
- @XmlTransient
- @JsonValue
- public String getName() {
- return name;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(name);
- }
-
- @Override
- public String toString() {
- return name;
- }
-
- @Override
- public int compareTo(Tag o) {
- return Objects.compare(name, o.getName(), Comparator.naturalOrder());
- }
-}
diff --git a/src/main/java/com/juick/User.java b/src/main/java/com/juick/User.java
deleted file mode 100644
index 38e71c15..00000000
--- a/src/main/java/com/juick/User.java
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- * Copyright (C) 2008-2019, Juick
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-package com.juick;
-
-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;
-
-import javax.annotation.Nonnull;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlTransient;
-import java.io.Serializable;
-import java.net.URI;
-import java.time.Instant;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-
-/**
- * @author Ugnich Anton
- */
-@XmlRootElement(name = "user", namespace = "http://juick.com/user")
-@XmlAccessorType()
-public class User implements Serializable {
- private int uid;
- private String name;
- private String avatar;
- private String fullName;
- private int messagesCount;
- private String authHash;
- private boolean banned;
- private String credentials;
- private List tokens;
- private List read;
- private List readers;
- private List unread;
- private URI uri;
- private Instant seen;
- private boolean verified;
- private String country;
- private String url;
- private String description;
- private List tagStats;
-
- public User() {
- tokens = new ArrayList<>();
- tagStats = new ArrayList<>();
- uri = URI.create(StringUtils.EMPTY);
- }
-
- @Override
- public boolean equals(Object obj) {
- return obj == this ||
- (obj instanceof User && ((User) obj).getUid() == this.getUid()
- && ((User) obj).getUri().toString().equals(this.getUri().toString()));
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(uid, uri);
- }
-
- @Override
- public String toString() {
- return new ToStringBuilder(this)
- .append("uid", uid)
- .append("name", name)
- .append("fullName", fullName)
- .append("messagesCount", messagesCount)
- .append("banned", banned)
- .toString();
- }
-
- @JsonProperty("uid")
- @XmlAttribute(name = "uid")
- public int getUid() {
- return uid;
- }
-
- public void setUid(int uid) {
- this.uid = uid;
- }
-
- @JsonProperty("uname")
- @XmlAttribute(name = "uname")
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- @JsonProperty("fullname")
- @XmlTransient
- public String getFullName() {
- return fullName;
- }
-
- public void setFullName(String fullName) {
- this.fullName = fullName;
- }
-
- @XmlTransient
- @JsonIgnore
- public String getAuthHash() {
- return authHash;
- }
-
- public void setAuthHash(String authHash) {
- this.authHash = authHash;
- }
-
- @JsonProperty("unreadCount")
- @XmlTransient
- public Integer getUnreadCount() {
- return messagesCount;
- }
-
- public void setUnreadCount(Integer count) {
- this.messagesCount = count;
- }
-
- @XmlTransient
- public boolean isBanned() {
- return banned;
- }
-
- public void setBanned(boolean banned) {
- this.banned = banned;
- }
-
- public String getAvatar() {
- return avatar;
- }
-
- public void setAvatar(String avatarUri) {
- this.avatar = avatarUri;
- }
-
- @XmlTransient
- @JsonIgnore
- public String getCredentials() {
- return credentials;
- }
-
- public void setCredentials(String credentials) {
- this.credentials = credentials;
- }
-
- @XmlTransient
- public int getMessagesCount() {
- return messagesCount;
- }
-
- public void setMessagesCount(int messagesCount) {
- this.messagesCount = messagesCount;
- }
-
- @XmlTransient
- @JsonIgnore
- public boolean isAnonymous() {
- return uid == 0;
- }
-
- @Nonnull
- public List getTokens() {
- return tokens;
- }
-
- public void setTokens(List tokens) {
- this.tokens = tokens;
- }
-
- public List getRead() {
- return read;
- }
- public List getReaders() {
- return readers;
- }
-
- public void setRead(List read) {
- this.read = read;
- }
-
- public void setReaders(List readers) {
- this.readers = readers;
- }
-
- public List getUnread() {
- return unread;
- }
-
- public void setUnread(List unread) {
- this.unread = unread;
- }
-
- @Nonnull
- @XmlTransient
- public URI getUri() {
- if (uri == null) {
- uri = URI.create(StringUtils.EMPTY);
- }
- return uri;
- }
-
- public void setUri(URI uri) {
- this.uri = uri;
- }
-
- public Instant getSeen() {
- return seen;
- }
-
- public void setSeen(Instant seen) {
- this.seen = seen;
- }
-
- @XmlTransient
- public boolean isVerified() {
- return verified;
- }
-
- public void setVerified(boolean verified) {
- this.verified = verified;
- }
-
- public String getCountry() {
- return country;
- }
-
- public void setCountry(String country) {
- this.country = country;
- }
-
- public String getUrl() {
- return url;
- }
-
- public void setUrl(String url) {
- this.url = url;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public List getTagStats() {
- return tagStats;
- }
-}
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 {
@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/model/Attachment.java b/src/main/java/com/juick/model/Attachment.java
new file mode 100644
index 00000000..485c69bc
--- /dev/null
+++ b/src/main/java/com/juick/model/Attachment.java
@@ -0,0 +1,77 @@
+/*
+ * 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
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package com.juick.model;
+
+import java.io.Serializable;
+
+public class Attachment implements Serializable {
+ private String url;
+ private Integer height;
+ private Integer width;
+ private Attachment small;
+ private Attachment medium;
+ private Attachment thumbnail;
+
+ public String getUrl() {
+ return url;
+ }
+
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+ public Integer getHeight() {
+ return height;
+ }
+
+ public void setHeight(Integer height) {
+ this.height = height;
+ }
+
+ public Integer getWidth() {
+ return width;
+ }
+
+ public void setWidth(Integer width) {
+ this.width = width;
+ }
+
+ public Attachment getSmall() {
+ return small;
+ }
+
+ public void setSmall(Attachment small) {
+ this.small = small;
+ }
+
+ public Attachment getMedium() {
+ return medium;
+ }
+
+ public void setMedium(Attachment medium) {
+ this.medium = medium;
+ }
+
+ public Attachment getThumbnail() {
+ return thumbnail;
+ }
+
+ public void setThumbnail(Attachment thumbnail) {
+ this.thumbnail = thumbnail;
+ }
+}
diff --git a/src/main/java/com/juick/model/Chat.java b/src/main/java/com/juick/model/Chat.java
new file mode 100644
index 00000000..e72afb30
--- /dev/null
+++ b/src/main/java/com/juick/model/Chat.java
@@ -0,0 +1,44 @@
+/*
+ * 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
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package com.juick.model;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.time.Instant;
+
+public class Chat extends User {
+ private Instant lastMessageTimestamp;
+ private String lastMessageText;
+
+ public Instant getLastMessageTimestamp() {
+ return lastMessageTimestamp;
+ }
+
+ @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "UTC")
+ public void setLastMessageTimestamp(Instant lastMessageTimestamp) {
+ this.lastMessageTimestamp = lastMessageTimestamp;
+ }
+
+ public String getLastMessageText() {
+ return lastMessageText;
+ }
+
+ public void setLastMessageText(String lastMessageText) {
+ this.lastMessageText = lastMessageText;
+ }
+}
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/model/ExternalToken.java b/src/main/java/com/juick/model/ExternalToken.java
new file mode 100644
index 00000000..f2eac8de
--- /dev/null
+++ b/src/main/java/com/juick/model/ExternalToken.java
@@ -0,0 +1,64 @@
+/*
+ * 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
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package com.juick.model;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * Created by vitalyster on 22.11.2016.
+ */
+public class ExternalToken {
+ private String name;
+ private String type;
+ private String token;
+ private String secret;
+
+ @JsonCreator
+ public ExternalToken(@JsonProperty("name") String name,
+ @JsonProperty("type") String type,
+ @JsonProperty("token") String token,
+ @JsonProperty("secret") String secret) {
+ this.name = name;
+ this.type = type;
+ this.token = token;
+ this.secret = secret;
+ if (this.type == null) {
+ throw new IllegalStateException("Token must have type");
+ }
+ if (this.token == null) {
+ throw new IllegalStateException("Token must have value");
+ }
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public String getToken() {
+ return token;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getSecret() {
+ return secret;
+ }
+}
diff --git a/src/main/java/com/juick/model/Message.java b/src/main/java/com/juick/model/Message.java
new file mode 100644
index 00000000..b1460957
--- /dev/null
+++ b/src/main/java/com/juick/model/Message.java
@@ -0,0 +1,389 @@
+/*
+ * 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
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+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 org.apache.commons.lang3.builder.ToStringBuilder;
+
+import javax.annotation.Nonnull;
+import javax.xml.bind.annotation.*;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import java.io.Serializable;
+import java.net.URI;
+import java.time.Instant;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Objects;
+import java.util.Set;
+
+/**
+ * @author Ugnich Anton
+ */
+@XmlRootElement(name = "juick", namespace = "http://juick.com/message")
+@XmlAccessorType()
+public class Message implements Comparable, Serializable {
+ private int mid = 0;
+ private int rid = 0;
+ private int replyto = 0;
+ private String text = null;
+ private User user = null;
+ private Set tags;
+ private Instant created;
+ private Instant updated;
+ private Instant updatedAt;
+ private boolean unread;
+ @JsonIgnore
+ private int privacy = 1;
+ @XmlTransient
+ @JsonIgnore
+ public boolean FriendsOnly = false;
+ @XmlTransient
+ @JsonIgnore
+ public boolean ReadOnly = false;
+ @XmlTransient
+ @JsonIgnore
+ public boolean Hidden = false;
+ @JsonIgnore
+ @XmlTransient
+ public boolean VisitorCanComment = true;
+ private int replies = 0;
+ private String repliesBy;
+ private String attachmentType;
+ @XmlTransient
+ private Photo photo;
+ @XmlTransient
+ private Attachment attachment;
+ private int likes;
+ private User to;
+ private String replyQuote;
+ @XmlTransient
+ private Set reactions;
+ private boolean service;
+ private URI replyUri;
+ private URI replyToUri;
+ private boolean html;
+
+ private Set recommendations;
+
+ private List entities;
+
+ public Message() {
+ tags = new LinkedHashSet<>();
+ reactions = new HashSet<>();
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this)
+ .append("mid", mid)
+ .append("rid", rid)
+ .append("replyto", replyto)
+ .append("privacy", privacy)
+ .append("FriendsOnly", FriendsOnly)
+ .append("ReadOnly", ReadOnly)
+ .append("Hidden", Hidden)
+ .append("VisitorCanComment", VisitorCanComment)
+ .append("replies", replies)
+ .append("likes", likes)
+ .append("reactions", reactions)
+ .toString();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this)
+ return true;
+
+ if (!(obj instanceof Message))
+ return false;
+
+ Message jmsg = (Message) obj;
+ return (this.getMid() == jmsg.getMid() && this.getRid() == jmsg.getRid());
+ }
+
+ @Override
+ public int compareTo(@Nonnull Object obj) throws ClassCastException {
+ if (obj == this)
+ return 0;
+
+ if (!(obj instanceof Message))
+ throw new ClassCastException();
+
+ Message jmsg = (Message) obj;
+
+ int cmp = Integer.compare(jmsg.getMid(), getMid());
+
+ if (cmp == 0)
+ cmp = Integer.compare(getRid(), jmsg.getRid());
+
+ return cmp;
+ }
+
+ @JsonProperty("mid")
+ @XmlAttribute(name = "mid")
+ public int getMid() {
+ return mid;
+ }
+
+ public void setMid(int mid) {
+ this.mid = mid;
+ }
+
+ @JsonProperty("rid")
+ @XmlAttribute(name = "rid")
+ public int getRid() {
+ return rid;
+ }
+
+ public void setRid(int rid) {
+ this.rid = rid;
+ }
+
+ @XmlElement(name = "user", namespace = "http://juick.com/user")
+ public User getUser() {
+ return user;
+ }
+
+ public void setUser(User user) {
+ this.user = user;
+ }
+
+ @JsonProperty("body")
+ @XmlElement(name = "body")
+ public String getText() {
+ return text;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ @JsonProperty("timestamp")
+ @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "UTC")
+ @XmlAttribute(name = "ts")
+ @XmlJavaTypeAdapter(SimpleDateAdapter.class)
+ public Instant getCreated() {
+ return created;
+ }
+
+ public void setCreated(Instant timestamp) {
+ this.created = timestamp;
+ }
+
+ @XmlTransient
+ public User getTo() {
+ return to;
+ }
+
+ public void setTo(User to) {
+ this.to = to;
+ }
+
+ @XmlAttribute(name = "quote")
+ public String getReplyQuote() {
+ return replyQuote;
+ }
+
+ public void setReplyQuote(String quote) {
+ replyQuote = quote;
+ }
+
+ @JsonProperty("replyto")
+ @XmlAttribute(name = "replyto")
+ public int getReplyto() {
+ return replyto;
+ }
+
+ public void setReplyto(int replyto) {
+ this.replyto = replyto;
+ }
+
+ @JsonProperty("tags")
+ @XmlElement(name = "tag")
+ public Set getTags() {
+ return tags;
+ }
+
+ public void setTags(Set tags) {
+ this.tags = tags;
+ }
+
+ @XmlAttribute
+ public int getPrivacy() {
+ return privacy;
+ }
+
+ public void setPrivacy(int privacy) {
+ this.privacy = privacy;
+ }
+
+ public Photo getPhoto() {
+ return photo;
+ }
+
+ public void setPhoto(Photo photo) {
+ this.photo = photo;
+ }
+
+ @XmlAttribute(name = "attach")
+ @JsonProperty("attach")
+ public String getAttachmentType() {
+ return attachmentType;
+ }
+
+ public void setAttachmentType(String attachmentType) {
+ this.attachmentType = attachmentType;
+ }
+
+ @XmlTransient
+ public int getReplies() {
+ return replies;
+ }
+
+ public void setReplies(int replies) {
+ this.replies = replies;
+ }
+
+ @XmlTransient
+ public int getLikes() {
+ return likes;
+ }
+
+ public void setLikes(int likes) {
+ this.likes = likes;
+ }
+
+ @JsonProperty("repliesby")
+ public String getRepliesBy() {
+ return repliesBy;
+ }
+
+ public void setRepliesBy(String repliesBy) {
+ this.repliesBy = repliesBy;
+ }
+
+ public Attachment getAttachment() {
+ return attachment;
+ }
+ public void setAttachment(Attachment attachment) {
+ this.attachment = attachment;
+ }
+
+ /**
+ * @return timestamp of the last comment
+ */
+ @XmlTransient
+ public Instant getUpdated() {
+ return updated;
+ }
+
+ public void setUpdated(Instant updated) {
+ this.updated = updated;
+ }
+
+ @XmlTransient
+ public boolean isUnread() {
+ return unread;
+ }
+
+ public void setUnread(boolean unread) {
+ this.unread = unread;
+ }
+
+
+ @XmlTransient
+ public Set getReactions() {
+ return reactions;
+ }
+
+ public void setReactions(Set reactions) {
+ this.reactions = reactions;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(mid, rid);
+ }
+
+ public boolean isService() {
+ return service;
+ }
+
+ public void setService(boolean service) {
+ this.service = service;
+ }
+
+ public Set getRecommendations() {
+ return recommendations;
+ }
+
+ public void setRecommendations(Set recommendations) {
+ this.recommendations = recommendations;
+ }
+
+ /**
+ * @return timestamp of the last edit
+ */
+ @XmlTransient
+ @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "UTC")
+ @JsonProperty("updated_at")
+ public Instant getUpdatedAt() {
+ return updatedAt;
+ }
+
+ public void setUpdatedAt(Instant updatedAt) {
+ this.updatedAt = updatedAt;
+ }
+
+ public URI getReplyUri() {
+ return replyUri;
+ }
+
+ public void setReplyUri(URI replyUri) {
+ this.replyUri = replyUri;
+ }
+
+ @XmlAttribute(name = "html")
+ public boolean isHtml() {
+ return html;
+ }
+
+ public void setHtml(boolean html) {
+ this.html = html;
+ }
+
+ @XmlTransient
+ public URI getReplyToUri() {
+ return replyToUri;
+ }
+
+ public void setReplyToUri(URI replyToUri) {
+ this.replyToUri = replyToUri;
+ }
+
+ public List getEntities() {
+ return entities;
+ }
+
+ public void setEntities(List entities) {
+ this.entities = entities;
+ }
+}
diff --git a/src/main/java/com/juick/model/Photo.java b/src/main/java/com/juick/model/Photo.java
new file mode 100644
index 00000000..e759f70d
--- /dev/null
+++ b/src/main/java/com/juick/model/Photo.java
@@ -0,0 +1,55 @@
+/*
+ * 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
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package com.juick.model;
+
+import java.io.Serializable;
+
+/**
+ * Created by vitalyster on 30.11.2016.
+ */
+// used for compatibility
+@Deprecated
+public class Photo implements Serializable {
+ private String small;
+ private String medium;
+ private String thumbnail;
+
+ public String getSmall() {
+ return small;
+ }
+
+ public void setSmall(String small) {
+ this.small = small;
+ }
+
+ public String getMedium() {
+ return medium;
+ }
+
+ public void setMedium(String medium) {
+ this.medium = medium;
+ }
+
+ public String getThumbnail() {
+ return thumbnail;
+ }
+
+ public void setThumbnail(String thumbnail) {
+ this.thumbnail = thumbnail;
+ }
+}
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/model/Reaction.java b/src/main/java/com/juick/model/Reaction.java
new file mode 100644
index 00000000..4b3501d4
--- /dev/null
+++ b/src/main/java/com/juick/model/Reaction.java
@@ -0,0 +1,64 @@
+/*
+ * 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
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package com.juick.model;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+import java.io.Serializable;
+
+public class Reaction implements Serializable {
+
+ public static final int LIKE = 1;
+
+ private final int id;
+ private String description;
+ private int count;
+
+ public Reaction(int id) {
+ this.id = id;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this)
+ .append("id", getId())
+ .append("description", description)
+ .append("count", count)
+ .build();
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public int getCount() {
+ return count;
+ }
+
+ public void setCount(int count) {
+ this.count = count;
+ }
+
+ public int getId() {
+ return id;
+ }
+}
diff --git a/src/main/java/com/juick/model/Status.java b/src/main/java/com/juick/model/Status.java
new file mode 100644
index 00000000..15904f17
--- /dev/null
+++ b/src/main/java/com/juick/model/Status.java
@@ -0,0 +1,49 @@
+/*
+ * 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
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package com.juick.model;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * Created by vitalyster on 25.07.2016.
+ */
+public class Status {
+ private final String value;
+
+ public static final Status OK = new Status("ok");
+ public static final Status FAIL = new Status("Fail");
+ public static final Status ERROR = new Status("Error");
+
+ public static Status getStatus(final String stringStatus) {
+ return new Status(stringStatus);
+ }
+
+ private Status(String value) {
+ this.value = value;
+ }
+
+ @JsonProperty("status")
+ public String getValue() {
+ return value;
+ }
+
+ @Override
+ public String toString() {
+ return "value = " + value;
+ }
+}
diff --git a/src/main/java/com/juick/model/Tag.java b/src/main/java/com/juick/model/Tag.java
new file mode 100644
index 00000000..75266303
--- /dev/null
+++ b/src/main/java/com/juick/model/Tag.java
@@ -0,0 +1,74 @@
+/*
+ * 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
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+package com.juick.model;
+
+import com.fasterxml.jackson.annotation.JsonValue;
+
+import javax.xml.bind.annotation.*;
+import java.io.Serializable;
+import java.util.Comparator;
+import java.util.Objects;
+
+/**
+ * @author Ugnich Anton
+ */
+@XmlRootElement(name = "tag", namespace = "http://juick.com/message")
+@XmlAccessorType(XmlAccessType.FIELD)
+public class Tag implements Comparable, Serializable {
+ @XmlValue
+ private String name;
+
+ @XmlTransient
+ public int TID = 0;
+ @XmlTransient
+ public int SynonymID = 0;
+
+ public Tag() {
+ // required for (de)serialization
+ }
+
+ public Tag(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return o == this ||
+ (o instanceof Tag) && Objects.equals(name, ((Tag) o).name);
+ }
+
+ @XmlTransient
+ @JsonValue
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(name);
+ }
+
+ @Override
+ public String toString() {
+ return name;
+ }
+
+ @Override
+ public int compareTo(Tag o) {
+ return Objects.compare(name, o.getName(), Comparator.naturalOrder());
+ }
+}
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/model/User.java b/src/main/java/com/juick/model/User.java
new file mode 100644
index 00000000..7a84b115
--- /dev/null
+++ b/src/main/java/com/juick/model/User.java
@@ -0,0 +1,272 @@
+/*
+ * 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
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+package com.juick.model;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+import javax.annotation.Nonnull;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
+import java.io.Serializable;
+import java.net.URI;
+import java.time.Instant;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * @author Ugnich Anton
+ */
+@XmlRootElement(name = "user", namespace = "http://juick.com/user")
+@XmlAccessorType()
+public class User implements Serializable {
+ private int uid;
+ private String name;
+ private String avatar;
+ private String fullName;
+ private int messagesCount;
+ private String authHash;
+ private boolean banned;
+ private String credentials;
+ private List tokens;
+ private List read;
+ private List readers;
+ private List unread;
+ private URI uri;
+ private Instant seen;
+ private boolean verified;
+ private String country;
+ private String url;
+ private String description;
+ private List tagStats;
+
+ public User() {
+ tokens = new ArrayList<>();
+ tagStats = new ArrayList<>();
+ uri = URI.create(StringUtils.EMPTY);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ return obj == this ||
+ (obj instanceof User && ((User) obj).getUid() == this.getUid()
+ && ((User) obj).getUri().toString().equals(this.getUri().toString()));
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(uid, uri);
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this)
+ .append("uid", uid)
+ .append("name", name)
+ .append("fullName", fullName)
+ .append("messagesCount", messagesCount)
+ .append("banned", banned)
+ .toString();
+ }
+
+ @JsonProperty("uid")
+ @XmlAttribute(name = "uid")
+ public int getUid() {
+ return uid;
+ }
+
+ public void setUid(int uid) {
+ this.uid = uid;
+ }
+
+ @JsonProperty("uname")
+ @XmlAttribute(name = "uname")
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @JsonProperty("fullname")
+ @XmlTransient
+ public String getFullName() {
+ return fullName;
+ }
+
+ public void setFullName(String fullName) {
+ this.fullName = fullName;
+ }
+
+ @XmlTransient
+ @JsonIgnore
+ public String getAuthHash() {
+ return authHash;
+ }
+
+ public void setAuthHash(String authHash) {
+ this.authHash = authHash;
+ }
+
+ @JsonProperty("unreadCount")
+ @XmlTransient
+ public Integer getUnreadCount() {
+ return messagesCount;
+ }
+
+ public void setUnreadCount(Integer count) {
+ this.messagesCount = count;
+ }
+
+ @XmlTransient
+ public boolean isBanned() {
+ return banned;
+ }
+
+ public void setBanned(boolean banned) {
+ this.banned = banned;
+ }
+
+ public String getAvatar() {
+ return avatar;
+ }
+
+ public void setAvatar(String avatarUri) {
+ this.avatar = avatarUri;
+ }
+
+ @XmlTransient
+ @JsonIgnore
+ public String getCredentials() {
+ return credentials;
+ }
+
+ public void setCredentials(String credentials) {
+ this.credentials = credentials;
+ }
+
+ @XmlTransient
+ public int getMessagesCount() {
+ return messagesCount;
+ }
+
+ public void setMessagesCount(int messagesCount) {
+ this.messagesCount = messagesCount;
+ }
+
+ @XmlTransient
+ @JsonIgnore
+ public boolean isAnonymous() {
+ return uid == 0;
+ }
+
+ @Nonnull
+ public List getTokens() {
+ return tokens;
+ }
+
+ public void setTokens(List tokens) {
+ this.tokens = tokens;
+ }
+
+ public List getRead() {
+ return read;
+ }
+ public List getReaders() {
+ return readers;
+ }
+
+ public void setRead(List read) {
+ this.read = read;
+ }
+
+ public void setReaders(List readers) {
+ this.readers = readers;
+ }
+
+ public List getUnread() {
+ return unread;
+ }
+
+ public void setUnread(List unread) {
+ this.unread = unread;
+ }
+
+ @Nonnull
+ @XmlTransient
+ public URI getUri() {
+ if (uri == null) {
+ uri = URI.create(StringUtils.EMPTY);
+ }
+ return uri;
+ }
+
+ public void setUri(URI uri) {
+ this.uri = uri;
+ }
+
+ public Instant getSeen() {
+ return seen;
+ }
+
+ public void setSeen(Instant seen) {
+ this.seen = seen;
+ }
+
+ @XmlTransient
+ public boolean isVerified() {
+ return verified;
+ }
+
+ public void setVerified(boolean verified) {
+ this.verified = verified;
+ }
+
+ public String getCountry() {
+ return country;
+ }
+
+ public void setCountry(String country) {
+ this.country = country;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public List getTagStats() {
+ return tagStats;
+ }
+}
diff --git a/src/main/java/com/juick/model/ext/facebook/User.java b/src/main/java/com/juick/model/ext/facebook/User.java
new file mode 100644
index 00000000..5dee4d9e
--- /dev/null
+++ b/src/main/java/com/juick/model/ext/facebook/User.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2008-2019, Juick
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package com.juick.model.ext.facebook;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * Created by vitalyster on 28.11.2016.
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class User {
+ private String id;
+ private String name;
+ private String firstName;
+ private String lastName;
+ private String email;
+
+ public String getId() {
+ return id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ @JsonProperty("first_name")
+ public String getFirstName() {
+ return firstName;
+ }
+
+ @JsonProperty("last_name")
+ public String getLastName() {
+ return lastName;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+}
diff --git a/src/main/java/com/juick/model/ext/twitter/User.java b/src/main/java/com/juick/model/ext/twitter/User.java
new file mode 100644
index 00000000..27ae652c
--- /dev/null
+++ b/src/main/java/com/juick/model/ext/twitter/User.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2008-2019, Juick
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package com.juick.model.ext.twitter;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * Created by vitalyster on 28.11.2016.
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class User {
+ private String screenName;
+
+ @JsonProperty("screen_name")
+ public String getScreenName() {
+ return screenName;
+ }
+}
diff --git a/src/main/java/com/juick/model/ext/vk/Token.java b/src/main/java/com/juick/model/ext/vk/Token.java
new file mode 100644
index 00000000..1d8c2372
--- /dev/null
+++ b/src/main/java/com/juick/model/ext/vk/Token.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2008-2019, Juick
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package com.juick.model.ext.vk;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * Created by vitalyster on 28.11.2016.
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class Token {
+ private Long userId;
+ private String accessToken;
+ private String expiresIn;
+
+ @JsonProperty("user_id")
+ public Long getUserId() {
+ return userId;
+ }
+
+ @JsonProperty("access_token")
+ public String getAccessToken() {
+ return accessToken;
+ }
+
+ @JsonProperty("expires_in")
+ public String getExpiresIn() {
+ return expiresIn;
+ }
+}
diff --git a/src/main/java/com/juick/model/ext/vk/User.java b/src/main/java/com/juick/model/ext/vk/User.java
new file mode 100644
index 00000000..b6b0efd0
--- /dev/null
+++ b/src/main/java/com/juick/model/ext/vk/User.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2008-2019, Juick
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package com.juick.model.ext.vk;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * Created by vitalyster on 28.11.2016.
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class User {
+ private String id;
+ private String firstName;
+ private String lastName;
+ private String screenName;
+
+ @JsonProperty("first_name")
+ public String getFirstName() {
+ return firstName;
+ }
+
+ @JsonProperty("last_name")
+ public String getLastName() {
+ return lastName;
+ }
+
+ @JsonProperty("screen_name")
+ public String getScreenName() {
+ return screenName;
+ }
+
+ public String getId() {
+ return id;
+ }
+}
diff --git a/src/main/java/com/juick/model/ext/vk/UsersResponse.java b/src/main/java/com/juick/model/ext/vk/UsersResponse.java
new file mode 100644
index 00000000..f3dc116b
--- /dev/null
+++ b/src/main/java/com/juick/model/ext/vk/UsersResponse.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2008-2019, Juick
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package com.juick.model.ext.vk;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.util.List;
+
+/**
+ * Created by vitalyster on 28.11.2016.
+ */
+public class UsersResponse {
+ private List users;
+
+ @JsonProperty("response")
+ public List getUsers() {
+ return users;
+ }
+}
diff --git a/src/main/java/com/juick/model/facebook/User.java b/src/main/java/com/juick/model/facebook/User.java
deleted file mode 100644
index 49fc81f9..00000000
--- a/src/main/java/com/juick/model/facebook/User.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2008-2019, Juick
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package com.juick.model.facebook;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * Created by vitalyster on 28.11.2016.
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class User {
- private String id;
- private String name;
- private String firstName;
- private String lastName;
- private String email;
-
- public String getId() {
- return id;
- }
-
- public String getName() {
- return name;
- }
-
- @JsonProperty("first_name")
- public String getFirstName() {
- return firstName;
- }
-
- @JsonProperty("last_name")
- public String getLastName() {
- return lastName;
- }
-
- public String getEmail() {
- return email;
- }
-}
diff --git a/src/main/java/com/juick/model/package-info.java b/src/main/java/com/juick/model/package-info.java
new file mode 100644
index 00000000..be9e6c2b
--- /dev/null
+++ b/src/main/java/com/juick/model/package-info.java
@@ -0,0 +1,35 @@
+/*
+ * 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
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+/**
+ * Created by vitalyster on 15.11.2016.
+ */
+@XmlSchema(
+ namespace="http://juick.com/message",
+ elementFormDefault = XmlNsForm.QUALIFIED,
+ xmlns={
+ @XmlNs(prefix= StringUtils.EMPTY, namespaceURI="http://juick.com/message"),
+ @XmlNs(prefix="user", namespaceURI="http://juick.com/user")
+ }
+)
+package com.juick.model;
+
+import org.apache.commons.lang3.StringUtils;
+
+import javax.xml.bind.annotation.XmlNs;
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlSchema;
\ No newline at end of file
diff --git a/src/main/java/com/juick/model/twitter/User.java b/src/main/java/com/juick/model/twitter/User.java
deleted file mode 100644
index 7325a7c0..00000000
--- a/src/main/java/com/juick/model/twitter/User.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2008-2019, Juick
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package com.juick.model.twitter;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * Created by vitalyster on 28.11.2016.
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class User {
- private String screenName;
-
- @JsonProperty("screen_name")
- public String getScreenName() {
- return screenName;
- }
-}
diff --git a/src/main/java/com/juick/model/vk/Token.java b/src/main/java/com/juick/model/vk/Token.java
deleted file mode 100644
index 56d6e476..00000000
--- a/src/main/java/com/juick/model/vk/Token.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2008-2019, Juick
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package com.juick.model.vk;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * Created by vitalyster on 28.11.2016.
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class Token {
- private Long userId;
- private String accessToken;
- private String expiresIn;
-
- @JsonProperty("user_id")
- public Long getUserId() {
- return userId;
- }
-
- @JsonProperty("access_token")
- public String getAccessToken() {
- return accessToken;
- }
-
- @JsonProperty("expires_in")
- public String getExpiresIn() {
- return expiresIn;
- }
-}
diff --git a/src/main/java/com/juick/model/vk/User.java b/src/main/java/com/juick/model/vk/User.java
deleted file mode 100644
index 5a4c4721..00000000
--- a/src/main/java/com/juick/model/vk/User.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2008-2019, Juick
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package com.juick.model.vk;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * Created by vitalyster on 28.11.2016.
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class User {
- private String id;
- private String firstName;
- private String lastName;
- private String screenName;
-
- @JsonProperty("first_name")
- public String getFirstName() {
- return firstName;
- }
-
- @JsonProperty("last_name")
- public String getLastName() {
- return lastName;
- }
-
- @JsonProperty("screen_name")
- public String getScreenName() {
- return screenName;
- }
-
- public String getId() {
- return id;
- }
-}
diff --git a/src/main/java/com/juick/model/vk/UsersResponse.java b/src/main/java/com/juick/model/vk/UsersResponse.java
deleted file mode 100644
index cec47ea7..00000000
--- a/src/main/java/com/juick/model/vk/UsersResponse.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2008-2019, Juick
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package com.juick.model.vk;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-import java.util.List;
-
-/**
- * Created by vitalyster on 28.11.2016.
- */
-public class UsersResponse {
- private List users;
-
- @JsonProperty("response")
- public List getUsers() {
- return users;
- }
-}
diff --git a/src/main/java/com/juick/package-info.java b/src/main/java/com/juick/package-info.java
deleted file mode 100644
index 23e2a4e60..00000000
--- a/src/main/java/com/juick/package-info.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2008-2019, Juick
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-/**
- * Created by vitalyster on 15.11.2016.
- */
-@XmlSchema(
- namespace="http://juick.com/message",
- elementFormDefault = XmlNsForm.QUALIFIED,
- xmlns={
- @XmlNs(prefix= StringUtils.EMPTY, namespaceURI="http://juick.com/message"),
- @XmlNs(prefix="user", namespaceURI="http://juick.com/user")
- }
-)
-package com.juick;
-
-import org.apache.commons.lang3.StringUtils;
-
-import javax.xml.bind.annotation.XmlNs;
-import javax.xml.bind.annotation.XmlNsForm;
-import javax.xml.bind.annotation.XmlSchema;
\ No newline at end of file
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 msg = messagesService.getMessage(mid);
+ Optional 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 msg = messagesService.getMessage(mid);
+ Optional msg = messagesService.getMessage(mid);
if (msg.isPresent()) {
if (showReplies) {
- List replies = messagesService.getReplies(user, mid);
+ List 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 subscribedUsers) {
+ private void processMessage(Message msg, List 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 subscribedUsers) {
+ private void onJuickMessagePost(final Message jmsg, List subscribedUsers) {
messageEvent(jmsg, subscribedUsers);
messageEvent(jmsg, Collections.singletonList(AnonymousUser.INSTANCE));
}
- private void onJuickMessageReply(final com.juick.Message jmsg, final List subscribedUsers) {
+ private void onJuickMessageReply(final Message jmsg, final List 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 subscribers) {
+ private void processMessage(User from, Message jmsg, List subscribers) {
List 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 subscribedUsers) {
+ private void processMessage(com.juick.model.Message jmsg, List subscribedUsers) {
if (jmsg.isService()) {
return;
}
@@ -432,17 +432,17 @@ public class TelegramBotManager implements NotificationListener {
}
}
- private void processLike(User liker, com.juick.Message message, List subscribers) {
+ private void processLike(User liker, com.juick.model.Message message, List 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 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 users) {
+ private void sendJuickMessage(com.juick.model.Message jmsg, List users) {
List 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 users) {
+ private void sendJuickComment(com.juick.model.Message jmsg, List 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 subscribers) {
+ private void processMessage(com.juick.model.Message msg, List 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 users) {
+ public void processLike(User liker, com.juick.model.Message jmsg, List 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 signupWithEmail(String username, String password, String verificationCode) {
+ public ResponseEntity 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> NOT_FOUND = ResponseEntity
+ private static final ResponseEntity> NOT_FOUND = ResponseEntity
.status(HttpStatus.NOT_FOUND)
.body(Collections.emptyList());
- private static final ResponseEntity> FORBIDDEN = ResponseEntity
+ private static final ResponseEntity> FORBIDDEN = ResponseEntity
.status(HttpStatus.FORBIDDEN)
.body(Collections.emptyList());
@@ -76,7 +76,7 @@ public class Messages {
// TODO: serialize image urls
@GetMapping("/api/home")
- public ResponseEntity> getHome(
+ public ResponseEntity> 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> getMessages(
+ public ResponseEntity> 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> getThread(
+ public ResponseEntity> getThread(
@Visitor User visitor,
@RequestParam(defaultValue = "0") int mid) {
Optional 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 replies = messagesService.getReplies(visitor, mid);
+ List 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 doGetPM(
+ public List 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 message = messagesService.getMessage(mid);
+ Optional 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 message = messagesService.getMessage(mid);
+ Optional 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 message = messagesService.getMessage(mid);
+ Optional 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 doGetUsers(
@Visitor User visitor,
@RequestParam(value = "uname", required = false) List unames) {
- List users = new ArrayList<>();
+ List 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 msgs = messagesService.getMessages(visitor, mids);
+ List 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 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 msgs = messagesService.getMessages(visitor, mids);
+ List msgs = messagesService.getMessages(visitor, mids);
msgs.forEach(m -> m.getUser().setAvatar(webApp.getAvatarWebPath(m.getUser())));
if (!visitor.isAnonymous()) {
List 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", "");
@@ -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 mids = messagesService.getTag(paramTag.TID, visitor.getUid(), before, (visitor.isAnonymous()) ? 40 : 20);
- List msgs = messagesService.getMessages(visitor, mids);
+ List msgs = messagesService.getMessages(visitor, mids);
msgs.forEach(m -> m.getUser().setAvatar(webApp.getAvatarWebPath(m.getUser())));
if (!visitor.isAnonymous()) {
List unread = messagesService.getUnread(visitor);
@@ -457,7 +457,7 @@ public class MessagesWWW {
}
visitor.setAvatar(webApp.getAvatarWebPath(visitor));
String title = "PM: Inbox";
- List msgs = pmQueriesService.getLastPMInbox(visitor.getUid());
+ List 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 msgs = pmQueriesService.getLastPMSent(visitor.getUid());
+ List 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 message = messagesService.getMessage(mid);
+ Optional 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 replies = messagesService.getReplies(visitor, msg.getMid());
+ List 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 tags);
+ int createMessage(int uid, String txt, String attachment, List tags);
int createReply(int mid, int rid, User user, String txt, String attachment);
enum RecommendStatus {
@@ -60,9 +61,9 @@ public interface MessagesService {
Optional 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 getUserSearch(User visitor, int UID, String search, int privacy, int page);
- List getMessages(User visitor, List mids);
+ List getMessages(User visitor, List mids);
Map> updateReactionsFor(final List mid);
- List getReplies(User user, int mid);
+ List 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 tags) {
+ public int createMessage(final int uid, final String txt, final String attachment, final List 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 getMessage(final int mid) {
+ public Optional getMessage(final int mid) {
- List list = getJdbcTemplate().query(
+ List 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 list = getJdbcTemplate().query(
+ public Message getReply(final int mid, final int rid) {
+ List 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 getMessages(final User visitor, final List mids) {
+ public List getMessages(final User visitor, final List mids) {
if (CollectionUtils.isNotEmpty(mids)) {
- List msgs = getNamedParameterJdbcTemplate().query(
+ List 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 getLastChats(User user);
- List getPMMessages(int uid, int uidTo);
+ List getPMMessages(int uid, int uidTo);
- List getLastPMInbox(int uid);
+ List getLastPMInbox(int uid);
- List getLastPMSent(int uid);
+ List 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 getPMMessages(final int uid, final int uidTo) {
+ public List 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 getLastPMInbox(final int uid) {
+ public List 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 getLastPMSent(final int uid) {
+ public List 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 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 getUserReadLeastPopular(int uid, int cnt);
+ List getUserReadLeastPopular(int uid, int cnt);
List getUserReaders(int uid);
@@ -99,7 +100,7 @@ public interface UserService {
Integer getUserRecommendations(User user);
- List getUserBLUsers(int uid);
+ List 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 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 getUserReadLeastPopular(final int uid, final int cnt) {
+ public List 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 getUserBLUsers(final int uid) {
+ public List 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;
--
cgit v1.2.3