use of com.google.gson.JsonParser in project bigbluebutton by bigbluebutton.
the class UserVoiceTalkingMessage method fromJson.
public static UserVoiceTalkingMessage 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 (USER_VOICE_TALKING.equals(messageName)) {
if (payload.has(Constants.MEETING_ID) && payload.has(Constants.USER)) {
String id = payload.get(Constants.MEETING_ID).getAsString();
String voiceConf = payload.get(Constants.VOICE_CONF).getAsString();
JsonObject user = (JsonObject) payload.get(Constants.USER);
Util util = new Util();
Map<String, Object> userMap = util.extractUser(user);
if (userMap != null) {
return new UserVoiceTalkingMessage(id, userMap, voiceConf);
}
}
}
}
}
return null;
}
use of com.google.gson.JsonParser in project bigbluebutton by bigbluebutton.
the class UserLeftVoiceConfMessage method fromJson.
public static UserLeftVoiceConfMessage 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 (USER_LEFT_VOICE_CONF.equals(messageName)) {
if (payload.has(VOICE_CONF_ID) && payload.has(VOICE_USER_ID)) {
String voiceConfId = payload.get(VOICE_CONF_ID).getAsString();
String voiceUserId = payload.get(VOICE_USER_ID).getAsString();
return new UserLeftVoiceConfMessage(voiceConfId, voiceUserId);
}
}
}
}
return null;
}
use of com.google.gson.JsonParser in project bigbluebutton by bigbluebutton.
the class UserLeftVoiceMessage method fromJson.
public static UserLeftVoiceMessage 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 (USER_LEFT_VOICE.equals(messageName)) {
if (payload.has(Constants.MEETING_ID) && payload.has(Constants.USER)) {
String id = payload.get(Constants.MEETING_ID).getAsString();
String voiceConf = payload.get(Constants.VOICE_CONF).getAsString();
JsonObject user = (JsonObject) payload.get(Constants.USER);
Util util = new Util();
Map<String, Object> userMap = util.extractUser(user);
if (userMap != null) {
return new UserLeftVoiceMessage(id, userMap, voiceConf);
}
}
}
}
}
return null;
}
use of com.google.gson.JsonParser in project bigbluebutton by bigbluebutton.
the class UserListeningOnlyMessage method fromJson.
public static UserListeningOnlyMessage 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 (USER_LISTENING_ONLY.equals(messageName)) {
if (payload.has(Constants.MEETING_ID) && payload.has(Constants.USER_ID) && payload.has(Constants.LISTEN_ONLY)) {
String id = payload.get(Constants.MEETING_ID).getAsString();
String userid = payload.get(Constants.USER_ID).getAsString();
Boolean listenOnly = payload.get(Constants.LISTEN_ONLY).getAsBoolean();
return new UserListeningOnlyMessage(id, userid, listenOnly);
}
}
}
}
return null;
}
use of com.google.gson.JsonParser in project bigbluebutton by bigbluebutton.
the class UserLockedMessage method fromJson.
public static UserLockedMessage 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 (USER_LOCKED.equals(messageName)) {
if (payload.has(Constants.MEETING_ID) && payload.has(Constants.USER_ID) && payload.has(Constants.LOCKED)) {
String id = payload.get(Constants.MEETING_ID).getAsString();
String userid = payload.get(Constants.USER_ID).getAsString();
Boolean locked = payload.get(Constants.LOCKED).getAsBoolean();
return new UserLockedMessage(id, userid, locked);
}
}
}
}
return null;
}
Aggregations