From 3ab17252a7d9f6c5834d85d050a19fa41be0c07d Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 19 Dec 2019 13:21:40 +0300 Subject: Send Update activites on message updates --- .../juick/service/activities/ActivityListener.java | 3 ++ .../com/juick/service/activities/UpdateEvent.java | 47 ++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 src/main/java/com/juick/service/activities/UpdateEvent.java (limited to 'src/main/java/com/juick/service/activities') diff --git a/src/main/java/com/juick/service/activities/ActivityListener.java b/src/main/java/com/juick/service/activities/ActivityListener.java index d32585bb..81190ef2 100644 --- a/src/main/java/com/juick/service/activities/ActivityListener.java +++ b/src/main/java/com/juick/service/activities/ActivityListener.java @@ -39,4 +39,7 @@ public interface ActivityListener { @Async @EventListener void undoAnnounceEvent(UndoAnnounceEvent event); + @Async + @EventListener + void processUpdateEvent(UpdateEvent event); } diff --git a/src/main/java/com/juick/service/activities/UpdateEvent.java b/src/main/java/com/juick/service/activities/UpdateEvent.java new file mode 100644 index 00000000..0d02e80b --- /dev/null +++ b/src/main/java/com/juick/service/activities/UpdateEvent.java @@ -0,0 +1,47 @@ +/* + * 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.service.activities; + +import com.juick.User; +import org.springframework.context.ApplicationEvent; + +public class UpdateEvent extends ApplicationEvent { + private final User actor; + private final String messageUri; + /** + * Create a new {@code ApplicationEvent}. + * + * @param source the object on which the event initially occurred or with + * which the event is associated (never {@code null}) + * @param actor the event author + * @param messageUri the object's id + */ + public UpdateEvent(Object source, User actor, String messageUri) { + super(source); + this.actor = actor; + this.messageUri = messageUri; + } + + public User getUser() { + return actor; + } + + public String getMessageUri() { + return messageUri; + } +} -- cgit v1.2.3