From a1058eeef3963634853f8470d1957ecf58c4481a Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 29 Nov 2018 13:08:02 +0300 Subject: ActivityPub likes refactoring --- .../juick/service/activities/ActivityListener.java | 6 ++++++ .../juick/service/activities/AnnounceEvent.java | 22 ++++++++++++++++++++++ .../service/activities/UndoAnnounceEvent.java | 22 ++++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 src/main/java/com/juick/service/activities/AnnounceEvent.java create mode 100644 src/main/java/com/juick/service/activities/UndoAnnounceEvent.java (limited to 'src/main/java/com/juick/service') diff --git a/src/main/java/com/juick/service/activities/ActivityListener.java b/src/main/java/com/juick/service/activities/ActivityListener.java index 863bda04..68e1d42a 100644 --- a/src/main/java/com/juick/service/activities/ActivityListener.java +++ b/src/main/java/com/juick/service/activities/ActivityListener.java @@ -16,4 +16,10 @@ public interface ActivityListener { @Async @EventListener void deleteMessageEvent(DeleteMessageEvent event); + @Async + @EventListener + void processAnnounceEvent(AnnounceEvent event); + @Async + @EventListener + void undoAnnounceEvent(UndoAnnounceEvent event); } diff --git a/src/main/java/com/juick/service/activities/AnnounceEvent.java b/src/main/java/com/juick/service/activities/AnnounceEvent.java new file mode 100644 index 00000000..00dbea8c --- /dev/null +++ b/src/main/java/com/juick/service/activities/AnnounceEvent.java @@ -0,0 +1,22 @@ +package com.juick.service.activities; + +import org.springframework.context.ApplicationEvent; + +public class AnnounceEvent extends ApplicationEvent { + private String actorUri; + private String messageUri; + + public AnnounceEvent(Object source, String actor, String messageUri) { + super(source); + this.actorUri = actor; + this.messageUri = messageUri; + } + + public String getActorUri() { + return actorUri; + } + + public String getMessageUri() { + return messageUri; + } +} diff --git a/src/main/java/com/juick/service/activities/UndoAnnounceEvent.java b/src/main/java/com/juick/service/activities/UndoAnnounceEvent.java new file mode 100644 index 00000000..115f3146 --- /dev/null +++ b/src/main/java/com/juick/service/activities/UndoAnnounceEvent.java @@ -0,0 +1,22 @@ +package com.juick.service.activities; + +import org.springframework.context.ApplicationEvent; + +public class UndoAnnounceEvent extends ApplicationEvent { + private String actorUri; + private String messageUri; + + public UndoAnnounceEvent(Object source, String actor, String messageUri) { + super(source); + this.actorUri = actor; + this.messageUri = messageUri; + } + + public String getActorUri() { + return actorUri; + } + + public String getMessageUri() { + return messageUri; + } +} -- cgit v1.2.3