use of com.google.common.eventbus.Subscribe in project mica2 by obiba.
the class FileIndexer method reIndexAll.
@Async
@Subscribe
public void reIndexAll(IndexFilesEvent event) {
if (indexer.hasIndex(Indexer.ATTACHMENT_DRAFT_INDEX))
indexer.dropIndex(Indexer.ATTACHMENT_DRAFT_INDEX);
if (indexer.hasIndex(Indexer.ATTACHMENT_PUBLISHED_INDEX))
indexer.dropIndex(Indexer.ATTACHMENT_PUBLISHED_INDEX);
Pageable pageRequest = new PageRequest(0, 100);
Page<AttachmentState> attachments;
do {
attachments = attachmentStateRepository.findAll(pageRequest);
attachments.forEach(a -> {
if (FileUtils.isDirectory(a))
return;
indexer.index(Indexer.ATTACHMENT_DRAFT_INDEX, a);
if (a.getPublishedAttachment() != null) {
indexer.index(Indexer.ATTACHMENT_PUBLISHED_INDEX, a);
}
});
} while ((pageRequest = attachments.nextPageable()) != null);
}
use of com.google.common.eventbus.Subscribe in project mica2 by obiba.
the class ProjectService method dataAccessRequestUpdated.
//
// Event handling
//
@Async
@Subscribe
public void dataAccessRequestUpdated(DataAccessRequestUpdatedEvent event) {
DataAccessRequest request = event.getPersistable();
if (!projectRepository.exists(request.getId()) && request.getStatus() == DataAccessRequest.Status.APPROVED) {
Project project = new Project();
project.setId(event.getPersistable().getId());
project.setDataAccessRequestId(event.getPersistable().getId());
String title = dataAccessRequestUtilService.getRequestTitle(request);
if (!Strings.isNullOrEmpty(title)) {
project.setTitle(LocalizedString.from(micaConfigService.getConfig().getLocales(), title));
}
String summary = dataAccessRequestUtilService.getRequestSummary(request);
if (!Strings.isNullOrEmpty(summary)) {
project.setSummary(LocalizedString.from(micaConfigService.getConfig().getLocales(), summary));
}
save(project, "Created from Data Access Request");
}
}
use of com.google.common.eventbus.Subscribe in project Almura by AlmuraDev.
the class SimpleIngameMenu method onButtonClick.
@Subscribe
public void onButtonClick(UIButton.ClickEvent event) throws IOException, URISyntaxException, AWTException {
switch(event.getComponent().getName().toLowerCase(Locale.ENGLISH)) {
case "button.back":
this.close();
break;
case "button.shop":
Desktop.getDesktop().browse(new URI(GuiConfig.Url.SHOP));
break;
case "button.guide":
if (this.mc.player != null) {
this.close();
}
break;
case "button.instance":
Desktop.getDesktop().browse(new URI(GuiConfig.Url.MAP));
break;
case "button.statistics":
Desktop.getDesktop().browse(new URI(GuiConfig.Url.STATISTICS));
break;
case "button.advancements":
close();
if (this.mc.player != null) {
this.mc.displayGuiScreen(new GuiScreenAdvancements(this.mc.player.connection.getAdvancementManager()));
}
break;
case "button.forums":
Desktop.getDesktop().browse(new URI(GuiConfig.Url.FORUM));
break;
case "button.lan":
this.mc.displayGuiScreen(new GuiShareToLan(this));
break;
case "button.options":
this.mc.displayGuiScreen(new GuiOptions(this, this.mc.gameSettings));
break;
case "button.quit":
close();
this.mc.world.sendQuittingDisconnectingPacket();
this.mc.loadWorld(null);
this.mc.displayGuiScreen(new GuiMainMenu());
break;
}
}
use of com.google.common.eventbus.Subscribe in project Almura by AlmuraDev.
the class ServerMenu method onButtonClick.
@Subscribe
public void onButtonClick(UIButton.ClickEvent event) throws IOException, URISyntaxException {
if (!event.getComponent().getName().toLowerCase().equals("button.server.web") || (!event.getComponent().getName().toLowerCase().equals("button.server.map"))) {
// This doesn't close this screen when connecting to a server.
close();
}
switch(event.getComponent().getName().toLowerCase()) {
case "button.server.almura.live":
FMLClientHandler.instance().setupServerList();
FMLClientHandler.instance().connectToServer(this, DATA_LIVE_SERVER_CONNECT);
break;
case "button.server.almura.dev":
FMLClientHandler.instance().setupServerList();
FMLClientHandler.instance().connectToServer(this, DATA_DEV_SERVER_CONNECT);
break;
case "button.server.another":
mc.displayGuiScreen(new GuiMultiplayer(this));
break;
case "button.server.map":
Desktop.getDesktop().browse(new URI("http://srv1.almuramc.com:8123"));
break;
case "button.server.web":
Desktop.getDesktop().browse(new URI("http://www.almuramc.com"));
break;
}
}
use of com.google.common.eventbus.Subscribe in project jesos by groupon.
the class LocalSchedulerMessageProcessor method frameworkError.
@Subscribe
public void frameworkError(final FrameworkErrorMessageEnvelope envelope) {
checkState(envelope.getRecipient().equals(context.getDriverUPID()), "Received a remote message for local delivery");
final UPID sender = envelope.getSender();
if (!driverIsConnected(sender)) {
return;
}
final FrameworkErrorMessage frameworkErrorMessage = envelope.getMessage();
eventBus.post(new SchedulerCallback() {
@Override
public Runnable getCallback(final Scheduler scheduler, final SchedulerDriver schedulerDriver) {
return new Runnable() {
@Override
public void run() {
schedulerDriver.abort();
scheduler.error(schedulerDriver, frameworkErrorMessage.getMessage());
}
};
}
});
}
Aggregations