aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/service/activities
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/service/activities')
-rw-r--r--src/main/java/com/juick/service/activities/ActivityListener.java19
-rw-r--r--src/main/java/com/juick/service/activities/DeleteMessageEvent.java21
-rw-r--r--src/main/java/com/juick/service/activities/DeleteUserEvent.java20
-rw-r--r--src/main/java/com/juick/service/activities/FollowEvent.java21
-rw-r--r--src/main/java/com/juick/service/activities/UndoFollowEvent.java26
5 files changed, 107 insertions, 0 deletions
diff --git a/src/main/java/com/juick/service/activities/ActivityListener.java b/src/main/java/com/juick/service/activities/ActivityListener.java
new file mode 100644
index 00000000..863bda04
--- /dev/null
+++ b/src/main/java/com/juick/service/activities/ActivityListener.java
@@ -0,0 +1,19 @@
+package com.juick.service.activities;
+
+import org.springframework.context.event.EventListener;
+import org.springframework.scheduling.annotation.Async;
+
+public interface ActivityListener {
+ @Async
+ @EventListener
+ void processFollowEvent(FollowEvent event);
+ @Async
+ @EventListener
+ void undoFollowEvent(UndoFollowEvent event);
+ @Async
+ @EventListener
+ void deleteUserEvent(DeleteUserEvent event);
+ @Async
+ @EventListener
+ void deleteMessageEvent(DeleteMessageEvent event);
+}
diff --git a/src/main/java/com/juick/service/activities/DeleteMessageEvent.java b/src/main/java/com/juick/service/activities/DeleteMessageEvent.java
new file mode 100644
index 00000000..67e40f44
--- /dev/null
+++ b/src/main/java/com/juick/service/activities/DeleteMessageEvent.java
@@ -0,0 +1,21 @@
+package com.juick.service.activities;
+
+import com.juick.Message;
+import org.springframework.context.ApplicationEvent;
+
+public class DeleteMessageEvent extends ApplicationEvent {
+ private Message message;
+ /**
+ * Create a new ApplicationEvent.
+ *
+ * @param source the object on which the event initially occurred (never {@code null})
+ */
+ public DeleteMessageEvent(Object source, Message message) {
+ super(source);
+ this.message = message;
+ }
+
+ public Message getMessage() {
+ return message;
+ }
+}
diff --git a/src/main/java/com/juick/service/activities/DeleteUserEvent.java b/src/main/java/com/juick/service/activities/DeleteUserEvent.java
new file mode 100644
index 00000000..8b51da9d
--- /dev/null
+++ b/src/main/java/com/juick/service/activities/DeleteUserEvent.java
@@ -0,0 +1,20 @@
+package com.juick.service.activities;
+
+import org.springframework.context.ApplicationEvent;
+
+public class DeleteUserEvent extends ApplicationEvent {
+ private String userUri;
+ /**
+ * Create a new ApplicationEvent.
+ *
+ * @param source the object on which the event initially occurred (never {@code null})
+ */
+ public DeleteUserEvent(Object source, String userUri) {
+ super(source);
+ this.userUri = userUri;
+ }
+
+ public String getUserUri() {
+ return userUri;
+ }
+}
diff --git a/src/main/java/com/juick/service/activities/FollowEvent.java b/src/main/java/com/juick/service/activities/FollowEvent.java
new file mode 100644
index 00000000..c96613ba
--- /dev/null
+++ b/src/main/java/com/juick/service/activities/FollowEvent.java
@@ -0,0 +1,21 @@
+package com.juick.service.activities;
+
+import com.juick.server.api.activity.model.activities.Follow;
+import org.springframework.context.ApplicationEvent;
+
+public class FollowEvent extends ApplicationEvent {
+ private Follow request;
+ /**
+ * Create a new ApplicationEvent.
+ *
+ * @param source the object on which the event initially occurred (never {@code null})
+ */
+ public FollowEvent(Object source, Follow followRequest) {
+ super(source);
+ this.request = followRequest;
+ }
+
+ public Follow getRequest() {
+ return request;
+ }
+}
diff --git a/src/main/java/com/juick/service/activities/UndoFollowEvent.java b/src/main/java/com/juick/service/activities/UndoFollowEvent.java
new file mode 100644
index 00000000..2b48e6f6
--- /dev/null
+++ b/src/main/java/com/juick/service/activities/UndoFollowEvent.java
@@ -0,0 +1,26 @@
+package com.juick.service.activities;
+
+import org.springframework.context.ApplicationEvent;
+
+public class UndoFollowEvent extends ApplicationEvent {
+ private String actor;
+ private String object;
+ /**
+ * Create a new ApplicationEvent.
+ *
+ * @param source the object on which the event initially occurred (never {@code null})
+ */
+ public UndoFollowEvent(Object source, String actor, String object) {
+ super(source);
+ this.actor = actor;
+ this.object = object;
+ }
+
+ public String getActor() {
+ return actor;
+ }
+
+ public String getObject() {
+ return object;
+ }
+}