aboutsummaryrefslogtreecommitdiff
path: root/juick-common/src/main/java/com/juick/service/component
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-09-25 11:53:37 +0300
committerGravatar Vitaly Takmazov2018-09-25 11:53:37 +0300
commitae76024011a8442ae7eab953e0b97e9fe2c7c201 (patch)
tree9ec4bc077ad2db21dcfce0eefa126a484b1d0fc7 /juick-common/src/main/java/com/juick/service/component
parent85abc3e201539f81500754a7fb0e4f3a9d148fc4 (diff)
reorganize layout
Diffstat (limited to 'juick-common/src/main/java/com/juick/service/component')
-rw-r--r--juick-common/src/main/java/com/juick/service/component/DisconnectedEvent.java14
-rw-r--r--juick-common/src/main/java/com/juick/service/component/LikeEvent.java36
-rw-r--r--juick-common/src/main/java/com/juick/service/component/MessageEvent.java31
-rw-r--r--juick-common/src/main/java/com/juick/service/component/MessageReadEvent.java28
-rw-r--r--juick-common/src/main/java/com/juick/service/component/PingEvent.java21
-rw-r--r--juick-common/src/main/java/com/juick/service/component/SubscribeEvent.java27
-rw-r--r--juick-common/src/main/java/com/juick/service/component/UserUpdatedEvent.java23
7 files changed, 180 insertions, 0 deletions
diff --git a/juick-common/src/main/java/com/juick/service/component/DisconnectedEvent.java b/juick-common/src/main/java/com/juick/service/component/DisconnectedEvent.java
new file mode 100644
index 00000000..552c3e66
--- /dev/null
+++ b/juick-common/src/main/java/com/juick/service/component/DisconnectedEvent.java
@@ -0,0 +1,14 @@
+package com.juick.service.component;
+
+import org.springframework.context.ApplicationEvent;
+
+public class DisconnectedEvent extends ApplicationEvent {
+ /**
+ * Create a new ApplicationEvent.
+ *
+ * @param source the object on which the event initially occurred (never {@code null})
+ */
+ public DisconnectedEvent(Object source) {
+ super(source);
+ }
+}
diff --git a/juick-common/src/main/java/com/juick/service/component/LikeEvent.java b/juick-common/src/main/java/com/juick/service/component/LikeEvent.java
new file mode 100644
index 00000000..0d4df70c
--- /dev/null
+++ b/juick-common/src/main/java/com/juick/service/component/LikeEvent.java
@@ -0,0 +1,36 @@
+package com.juick.service.component;
+
+import com.juick.Message;
+import com.juick.User;
+import org.springframework.context.ApplicationEvent;
+
+import java.util.List;
+
+public class LikeEvent extends ApplicationEvent {
+ private User user;
+ private Message message;
+ private List<User> subscribers;
+ /**
+ * Create a new ApplicationEvent.
+ *
+ * @param source the object on which the event initially occurred (never {@code null})
+ */
+ public LikeEvent(Object source, User user, Message message, List<User> subscribers) {
+ super(source);
+ this.message = message;
+ this.user = user;
+ this.subscribers = subscribers;
+ }
+
+ public User getUser() {
+ return user;
+ }
+
+ public Message getMessage() {
+ return message;
+ }
+
+ public List<User> getSubscribers() {
+ return subscribers;
+ }
+}
diff --git a/juick-common/src/main/java/com/juick/service/component/MessageEvent.java b/juick-common/src/main/java/com/juick/service/component/MessageEvent.java
new file mode 100644
index 00000000..82911a58
--- /dev/null
+++ b/juick-common/src/main/java/com/juick/service/component/MessageEvent.java
@@ -0,0 +1,31 @@
+package com.juick.service.component;
+
+import com.juick.Message;
+import com.juick.User;
+import org.springframework.context.ApplicationEvent;
+
+import java.util.List;
+
+public class MessageEvent extends ApplicationEvent {
+ private Message message;
+ private List<User> users;
+ /**
+ * Create a new ApplicationEvent.
+ *
+ * @param source the object on which the event initially occurred (never {@code null})
+ * @param message app message
+ * @param interestedUsers users interested in notification
+ */
+ public MessageEvent(Object source, Message message, List<User> interestedUsers) {
+ super(source);
+ this.message = message;
+ this.users = interestedUsers;
+ }
+
+ public Message getMessage() {
+ return message;
+ }
+ public List<User> getUsers() {
+ return users;
+ }
+}
diff --git a/juick-common/src/main/java/com/juick/service/component/MessageReadEvent.java b/juick-common/src/main/java/com/juick/service/component/MessageReadEvent.java
new file mode 100644
index 00000000..82cfadd5
--- /dev/null
+++ b/juick-common/src/main/java/com/juick/service/component/MessageReadEvent.java
@@ -0,0 +1,28 @@
+package com.juick.service.component;
+
+import com.juick.Message;
+import com.juick.User;
+import org.springframework.context.ApplicationEvent;
+
+public class MessageReadEvent extends ApplicationEvent {
+ private User user;
+ private Message message;
+ /**
+ * Create a new ApplicationEvent.
+ *
+ * @param source the object on which the event initially occurred (never {@code null})
+ */
+ public MessageReadEvent(Object source, User user, Message message) {
+ super(source);
+ this.user = user;
+ this.message = message;
+ }
+
+ public User getUser() {
+ return user;
+ }
+
+ public Message getMessage() {
+ return message;
+ }
+}
diff --git a/juick-common/src/main/java/com/juick/service/component/PingEvent.java b/juick-common/src/main/java/com/juick/service/component/PingEvent.java
new file mode 100644
index 00000000..8e3f3fa7
--- /dev/null
+++ b/juick-common/src/main/java/com/juick/service/component/PingEvent.java
@@ -0,0 +1,21 @@
+package com.juick.service.component;
+
+import com.juick.User;
+import org.springframework.context.ApplicationEvent;
+
+public class PingEvent extends ApplicationEvent {
+ private User pinger;
+ /**
+ * Create a new ApplicationEvent.
+ *
+ * @param source the object on which the event initially occurred (never {@code null})
+ */
+ public PingEvent(Object source, User pinger) {
+ super(source);
+ this.pinger = pinger;
+ }
+
+ public User getPinger() {
+ return pinger;
+ }
+}
diff --git a/juick-common/src/main/java/com/juick/service/component/SubscribeEvent.java b/juick-common/src/main/java/com/juick/service/component/SubscribeEvent.java
new file mode 100644
index 00000000..9b644f2f
--- /dev/null
+++ b/juick-common/src/main/java/com/juick/service/component/SubscribeEvent.java
@@ -0,0 +1,27 @@
+package com.juick.service.component;
+
+import com.juick.User;
+import org.springframework.context.ApplicationEvent;
+
+public class SubscribeEvent extends ApplicationEvent {
+ private User user;
+ private User toUser;
+ /**
+ * Create a new ApplicationEvent.
+ *
+ * @param source the object on which the event initially occurred (never {@code null})
+ */
+ public SubscribeEvent(Object source, User user, User toUser) {
+ super(source);
+ this.user = user;
+ this.toUser = toUser;
+ }
+
+ public User getUser() {
+ return user;
+ }
+
+ public User getToUser() {
+ return toUser;
+ }
+}
diff --git a/juick-common/src/main/java/com/juick/service/component/UserUpdatedEvent.java b/juick-common/src/main/java/com/juick/service/component/UserUpdatedEvent.java
new file mode 100644
index 00000000..af2f579a
--- /dev/null
+++ b/juick-common/src/main/java/com/juick/service/component/UserUpdatedEvent.java
@@ -0,0 +1,23 @@
+package com.juick.service.component;
+
+import com.juick.User;
+import org.springframework.context.ApplicationEvent;
+import org.springframework.lang.NonNull;
+
+public class UserUpdatedEvent extends ApplicationEvent {
+ private User user;
+ /**
+ * Generated when user is updated (avatar changed, etc).
+ *
+ * @param source the object on which the event initially occurred (never {@code null})
+ * @param user updated user
+ */
+ public UserUpdatedEvent(@NonNull Object source, User user) {
+ super(source);
+ this.user = user;
+ }
+
+ public User getUser() {
+ return user;
+ }
+}