public static void messageReceived(ChannelHandlerContext ctx, MobileStateHolder state, StringMessage message) { String[] dashIdAndTargetIdString = split2Device(message.body); int dashId = Integer.parseInt(dashIdAndTargetIdString[0]); int targetId = MobileSyncWidget.ANY_TARGET; User user = state.user; DashBoard dash = user.profile.getDashByIdOrThrow(dashId); if (dashIdAndTargetIdString.length == 2) { targetId = Integer.parseInt(dashIdAndTargetIdString[1]); } ctx.write(ok(message.id), ctx.voidPromise()); Channel appChannel = ctx.channel(); MobileStateHolder mobileStateHolder = getAppState(appChannel); boolean isNewSyncFormat = mobileStateHolder != null && mobileStateHolder.isNewSyncFormat(); user.profile.sendAppSyncs(dash, appChannel, targetId, isNewSyncFormat); ctx.flush(); }
public static void messageReceived(Holder holder, ChannelHandlerContext ctx, User user, StringMessage message) { String[] messageParts = StringUtils.split3(message.body); if (messageParts.length < 2) { throw new IllegalCommandException("Wrong income message format."); } String[] dashIdAndDeviceId = split2Device(messageParts[0]); int dashId = Integer.parseInt(dashIdAndDeviceId[0]); long widgetId = Long.parseLong(messageParts[1]); int streamIndex = -1; if (message.body.length() == 3) { streamIndex = Integer.parseInt(messageParts[2]); } int targetId = -1; if (dashIdAndDeviceId.length == 2) { targetId = Integer.parseInt(dashIdAndDeviceId[1]); } DashBoard dash = user.profile.getDashByIdOrThrow(dashId); Widget widget = dash.getWidgetById(widgetId); if (widget == null) { widget = dash.getWidgetByIdInDeviceTilesOrThrow(widgetId); } Superchart enhancedHistoryGraph = (Superchart) widget; if (streamIndex == -1 || streamIndex > enhancedHistoryGraph.dataStreams.length - 1) { delete(holder, ctx.channel(), message.id, user, dash, targetId, enhancedHistoryGraph.dataStreams); } else { delete(holder, ctx.channel(), message.id, user, dash, targetId, enhancedHistoryGraph.dataStreams[streamIndex]); } }
public void messageReceived(ChannelHandlerContext ctx, User user, StringMessage message) { String[] messageParts = message.body.split(BODY_SEPARATOR_STRING); if (messageParts.length < 2) { throw new IllegalCommandException("Wrong income message format."); } String[] dashIdAndDeviceId = split2Device(messageParts[0]); int dashId = Integer.parseInt(dashIdAndDeviceId[0]); int targetId = -1; if (dashIdAndDeviceId.length == 2) { targetId = Integer.parseInt(dashIdAndDeviceId[1]); } DashBoard dash = user.profile.getDashByIdOrThrow(dashId); long widgetId = Long.parseLong(messageParts[1]); Widget widget = dash.getWidgetById(widgetId); if (widget == null) { widget = dash.getWidgetByIdInDeviceTilesOrThrow(widgetId); } if (widget instanceof Superchart) { Superchart enhancedHistoryGraph = (Superchart) widget; blockingIOProcessor.executeHistory( new ExportEnhancedHistoryGraphJob(ctx, dash, targetId, enhancedHistoryGraph, message.id, user) ); } else { throw new IllegalCommandException("Passed wrong widget id."); } }
String[] dashIdAndDeviceId = split2Device(messageParts[0]); int dashId = Integer.parseInt(dashIdAndDeviceId[0]); User user = state.user;
String[] dashIdAndTargetIdString = split2Device(split[0]); int dashId = Integer.parseInt(dashIdAndTargetIdString[0]); int deviceId = Integer.parseInt(dashIdAndTargetIdString[1]);
String[] dashIdAndTargetIdString = split2Device(split[0]); int dashId = Integer.parseInt(dashIdAndTargetIdString[0]);
String[] dashIdAndTargetIdString = split2Device(split[0]); int dashId = Integer.parseInt(dashIdAndTargetIdString[0]);
String[] dashIdAndTargetIdString = split2Device(messageParts[0]); if (dashIdAndTargetIdString.length == 2) { targetId = Integer.parseInt(dashIdAndTargetIdString[1]);