use of com.google.gson.JsonParser in project bigbluebutton by bigbluebutton.
the class MuteUserInVoiceConfRequestMessage method fromJson.
public static MuteUserInVoiceConfRequestMessage fromJson(String message) {
JsonParser parser = new JsonParser();
JsonObject obj = (JsonObject) parser.parse(message);
if (obj.has("header") && obj.has("payload")) {
JsonObject header = (JsonObject) obj.get("header");
JsonObject payload = (JsonObject) obj.get("payload");
if (header.has("name")) {
String messageName = header.get("name").getAsString();
if (MUTE_VOICE_USER_REQUEST.equals(messageName)) {
if (payload.has(MEETING_ID) && payload.has(VOICE_CONF_ID) && payload.has(VOICE_USER_ID) && payload.has(MUTE)) {
String id = payload.get(MEETING_ID).getAsString();
String voiceConfId = payload.get(VOICE_CONF_ID).getAsString();
String voiceUserId = payload.get(VOICE_USER_ID).getAsString();
Boolean mute = payload.get(MUTE).getAsBoolean();
return new MuteUserInVoiceConfRequestMessage(id, voiceConfId, voiceUserId, mute);
}
}
}
}
return null;
}
use of com.google.gson.JsonParser in project bigbluebutton by bigbluebutton.
the class MuteUserRequestMessage method fromJson.
public static MuteUserRequestMessage fromJson(String message) {
JsonParser parser = new JsonParser();
JsonObject obj = (JsonObject) parser.parse(message);
if (obj.has("header") && obj.has("payload")) {
JsonObject header = (JsonObject) obj.get("header");
JsonObject payload = (JsonObject) obj.get("payload");
if (header.has("name")) {
String messageName = header.get("name").getAsString();
if (MUTE_USER_REQUEST.equals(messageName)) {
if (payload.has(MEETING_ID) && payload.has(REQUESTER_ID) && payload.has(USER_ID) && payload.has(MUTE)) {
String id = payload.get(MEETING_ID).getAsString();
String requesterId = payload.get(REQUESTER_ID).getAsString();
String userId = payload.get(USER_ID).getAsString();
Boolean mute = payload.get(MUTE).getAsBoolean();
return new MuteUserRequestMessage(id, requesterId, userId, mute);
}
}
}
}
return null;
}
use of com.google.gson.JsonParser in project bigbluebutton by bigbluebutton.
the class PollCreatedMessage method fromJson.
public static PollCreatedMessage fromJson(String message) {
JsonParser parser = new JsonParser();
JsonObject obj = (JsonObject) parser.parse(message);
if (obj.has("header") && obj.has("payload")) {
JsonObject header = (JsonObject) obj.get("header");
JsonObject payload = (JsonObject) obj.get("payload");
if (header.has("name")) {
String messageName = header.get("name").getAsString();
if (POLL_CREATED.equals(messageName)) {
if (payload.has(Constants.MEETING_ID) && payload.has(REQUESTER_ID) && payload.has(POLL_ID) && payload.has(POLL)) {
String id = payload.get(Constants.MEETING_ID).getAsString();
String requesterId = payload.get(REQUESTER_ID).getAsString();
String pollId = payload.get(POLL_ID).getAsString();
JsonObject poll = payload.get(POLL).getAsJsonObject();
Map<String, Object> pollMap = decodePoll(poll);
return new PollCreatedMessage(id, requesterId, pollId, pollMap);
}
}
}
}
return null;
}
use of com.google.gson.JsonParser in project bigbluebutton by bigbluebutton.
the class PollShowResultMessage method fromJson.
public static PollShowResultMessage fromJson(String message) {
JsonParser parser = new JsonParser();
JsonObject obj = (JsonObject) parser.parse(message);
if (obj.has("header") && obj.has("payload")) {
JsonObject header = (JsonObject) obj.get("header");
JsonObject payload = (JsonObject) obj.get("payload");
if (header.has("name")) {
String messageName = header.get("name").getAsString();
if (POLL_SHOW_RESULT.equals(messageName)) {
if (payload.has(Constants.MEETING_ID) && payload.has(POLL)) {
String id = payload.get(Constants.MEETING_ID).getAsString();
JsonObject poll = payload.get(POLL).getAsJsonObject();
Util util = new Util();
Map<String, Object> pollMap = util.decodeSimplePollResult(poll);
return new PollShowResultMessage(id, pollMap);
}
}
}
}
return null;
}
use of com.google.gson.JsonParser in project bigbluebutton by bigbluebutton.
the class IsWhiteboardEnabledReplyMessage method fromJson.
public static IsWhiteboardEnabledReplyMessage fromJson(String message) {
JsonParser parser = new JsonParser();
JsonObject obj = (JsonObject) parser.parse(message);
if (obj.has("header") && obj.has("payload")) {
JsonObject header = (JsonObject) obj.get("header");
JsonObject payload = (JsonObject) obj.get("payload");
if (header.has("name")) {
String messageName = header.get("name").getAsString();
if (IS_WHITEBOARD_ENABLED_REPLY.equals(messageName)) {
if (payload.has(Constants.MEETING_ID) && payload.has(Constants.REQUESTER_ID) && payload.has(Constants.ENABLED)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
String requesterId = payload.get(Constants.REQUESTER_ID).getAsString();
boolean enabled = payload.get(Constants.ENABLED).getAsBoolean();
return new IsWhiteboardEnabledReplyMessage(meetingId, requesterId, enabled);
}
}
}
}
return null;
}
Aggregations