コード例 #1
0
  private static void cleanPrivateData(DashBoard dashBoard) {
    Twitter twitter = dashBoard.getWidgetByType(Twitter.class);
    if (twitter != null) {
      twitter.cleanPrivateData();
    }

    Notification notification = dashBoard.getWidgetByType(Notification.class);
    if (notification != null) {
      notification.cleanPrivateData();
    }
  }
コード例 #2
0
  public void messageReceived(ChannelHandlerContext ctx, StringMessage message) {
    String token = message.body;

    User userThatShared = userDao.sharedTokenManager.getUserByToken(token);

    if (userThatShared == null) {
      throw new InvalidTokenException(
          "Illegal sharing token. No user with those shared token.", message.id);
    }

    Integer dashId = getSharedDashId(userThatShared.dashShareTokens, token);

    if (dashId == null) {
      throw new InvalidTokenException(
          "Illegal sharing token. User has not token. Could happen only in rare cases.",
          message.id);
    }

    DashBoard dashBoard = userThatShared.profile.getDashById(dashId, message.id);
    cleanPrivateData(dashBoard);

    ctx.writeAndFlush(produce(message.id, message.command, dashBoard.toString()));
  }