projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Convert “Sone insert was aborted” into EventBus-based event.
[Sone.git]
/
src
/
main
/
java
/
net
/
pterodactylus
/
sone
/
web
/
WebInterface.java
diff --git
a/src/main/java/net/pterodactylus/sone/web/WebInterface.java
b/src/main/java/net/pterodactylus/sone/web/WebInterface.java
index
96b42b0
..
7c16c09
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/WebInterface.java
+++ b/
src/main/java/net/pterodactylus/sone/web/WebInterface.java
@@
-45,6
+45,9
@@
import net.pterodactylus.sone.core.event.NewPostReplyFoundEvent;
import net.pterodactylus.sone.core.event.NewSoneFoundEvent;
import net.pterodactylus.sone.core.event.PostRemovedEvent;
import net.pterodactylus.sone.core.event.PostReplyRemovedEvent;
import net.pterodactylus.sone.core.event.NewSoneFoundEvent;
import net.pterodactylus.sone.core.event.PostRemovedEvent;
import net.pterodactylus.sone.core.event.PostReplyRemovedEvent;
+import net.pterodactylus.sone.core.event.SoneInsertAbortedEvent;
+import net.pterodactylus.sone.core.event.SoneInsertedEvent;
+import net.pterodactylus.sone.core.event.SoneInsertingEvent;
import net.pterodactylus.sone.core.event.SoneLockedEvent;
import net.pterodactylus.sone.core.event.SoneRemovedEvent;
import net.pterodactylus.sone.core.event.SoneUnlockedEvent;
import net.pterodactylus.sone.core.event.SoneLockedEvent;
import net.pterodactylus.sone.core.event.SoneRemovedEvent;
import net.pterodactylus.sone.core.event.SoneUnlockedEvent;
@@
-972,48
+975,57
@@
public class WebInterface implements CoreListener {
Ticker.getInstance().deregisterEvent(lockedSonesTickerObjects.remove(soneUnlockedEvent.sone()));
}
Ticker.getInstance().deregisterEvent(lockedSonesTickerObjects.remove(soneUnlockedEvent.sone()));
}
- //
- // CORELISTENER METHODS
- //
-
/**
/**
- * {@inheritDoc}
+ * Notifies the web interface that a {@link Sone} is being inserted.
+ *
+ * @param soneInsertingEvent
+ * The event
*/
*/
- @
Overrid
e
- public void soneInserting(Sone
sone
) {
- TemplateNotification soneInsertNotification = getSoneInsertNotification(sone);
+ @
Subscrib
e
+ public void soneInserting(Sone
InsertingEvent soneInsertingEvent
) {
+ TemplateNotification soneInsertNotification = getSoneInsertNotification(sone
InsertingEvent.sone()
);
soneInsertNotification.set("soneStatus", "inserting");
soneInsertNotification.set("soneStatus", "inserting");
- if (sone.getOptions().getBooleanOption("EnableSoneInsertNotifications").get()) {
+ if (sone
InsertingEvent.sone()
.getOptions().getBooleanOption("EnableSoneInsertNotifications").get()) {
notificationManager.addNotification(soneInsertNotification);
}
}
/**
notificationManager.addNotification(soneInsertNotification);
}
}
/**
- * {@inheritDoc}
+ * Notifies the web interface that a {@link Sone} was inserted.
+ *
+ * @param soneInsertedEvent
+ * The event
*/
*/
- @
Overrid
e
- public void soneInserted(Sone
sone, long insertDuration
) {
- TemplateNotification soneInsertNotification = getSoneInsertNotification(sone);
+ @
Subscrib
e
+ public void soneInserted(Sone
InsertedEvent soneInsertedEvent
) {
+ TemplateNotification soneInsertNotification = getSoneInsertNotification(sone
InsertedEvent.sone()
);
soneInsertNotification.set("soneStatus", "inserted");
soneInsertNotification.set("soneStatus", "inserted");
- soneInsertNotification.set("insertDuration",
insertDuration
/ 1000);
- if (sone.getOptions().getBooleanOption("EnableSoneInsertNotifications").get()) {
+ soneInsertNotification.set("insertDuration",
soneInsertedEvent.insertDuration()
/ 1000);
+ if (sone
InsertedEvent.sone()
.getOptions().getBooleanOption("EnableSoneInsertNotifications").get()) {
notificationManager.addNotification(soneInsertNotification);
}
}
/**
notificationManager.addNotification(soneInsertNotification);
}
}
/**
- * {@inheritDoc}
+ * Notifies the web interface that a {@link Sone} insert was aborted.
+ *
+ * @param soneInsertAbortedEvent
+ * The event
*/
*/
- @
Overrid
e
- public void soneInsertAborted(Sone
sone, Throwable cause
) {
- TemplateNotification soneInsertNotification = getSoneInsertNotification(sone);
+ @
Subscrib
e
+ public void soneInsertAborted(Sone
InsertAbortedEvent soneInsertAbortedEvent
) {
+ TemplateNotification soneInsertNotification = getSoneInsertNotification(sone
InsertAbortedEvent.sone()
);
soneInsertNotification.set("soneStatus", "insert-aborted");
soneInsertNotification.set("soneStatus", "insert-aborted");
- soneInsertNotification.set("insert-error",
cause
);
- if (sone.getOptions().getBooleanOption("EnableSoneInsertNotifications").get()) {
+ soneInsertNotification.set("insert-error",
soneInsertAbortedEvent.cause()
);
+ if (sone
InsertAbortedEvent.sone()
.getOptions().getBooleanOption("EnableSoneInsertNotifications").get()) {
notificationManager.addNotification(soneInsertNotification);
}
}
notificationManager.addNotification(soneInsertNotification);
}
}
+ //
+ // CORELISTENER METHODS
+ //
+
/**
* {@inheritDoc}
*/
/**
* {@inheritDoc}
*/