use of com.google.gson.JsonParser in project bigbluebutton by bigbluebutton.
the class LockLayoutRequestMessage method fromJson.
public static LockLayoutRequestMessage 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 (LOCK_LAYOUT_REQUEST.equals(messageName)) {
if (payload.has(Constants.MEETING_ID) && payload.has(Constants.USER_ID) && payload.has(LOCK) && payload.has(VIEWERS_ONLY) && payload.has(LAYOUT)) {
String id = payload.get(Constants.MEETING_ID).getAsString();
String userid = payload.get(Constants.USER_ID).getAsString();
Boolean lock = payload.get(LOCK).getAsBoolean();
Boolean viewersOnly = payload.get(VIEWERS_ONLY).getAsBoolean();
String layout = payload.get(LAYOUT).getAsString();
return new LockLayoutRequestMessage(id, userid, lock, viewersOnly, layout);
}
}
}
}
return null;
}
use of com.google.gson.JsonParser in project bigbluebutton by bigbluebutton.
the class LockUserMessage method fromJson.
public static LockUserMessage 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 (LOCK_USER.equals(messageName)) {
if (payload.has(Constants.MEETING_ID) && payload.has(Constants.REQUESTER_ID) && payload.has(Constants.LOCK) && payload.has(Constants.INTERNAL_USER_ID)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
String requesterId = payload.get(Constants.REQUESTER_ID).getAsString();
boolean lock = payload.get(Constants.LOCK).getAsBoolean();
String internalUserId = payload.get(Constants.INTERNAL_USER_ID).getAsString();
return new LockUserMessage(meetingId, requesterId, lock, internalUserId);
}
}
}
}
return null;
}
use of com.google.gson.JsonParser in project bigbluebutton by bigbluebutton.
the class StartPollRequestMessage method fromJson.
public static StartPollRequestMessage 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 (START_POLL_REQUEST.equals(messageName)) {
if (payload.has(Constants.MEETING_ID) && payload.has(REQUESTER_ID) && payload.has(POLL_ID) && payload.has(POLL_TYPE)) {
String id = payload.get(Constants.MEETING_ID).getAsString();
String requesterId = payload.get(REQUESTER_ID).getAsString();
String pollId = payload.get(POLL_ID).getAsString();
String pollType = payload.get(POLL_TYPE).getAsString();
return new StartPollRequestMessage(id, requesterId, pollId, pollType);
}
}
}
}
return null;
}
use of com.google.gson.JsonParser in project bigbluebutton by bigbluebutton.
the class StopPollRequestMessage method fromJson.
public static StopPollRequestMessage 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 (STOP_POLL_REQUEST.equals(messageName)) {
if (payload.has(Constants.MEETING_ID) && payload.has(REQUESTER_ID) && payload.has(POLL_ID)) {
String id = payload.get(Constants.MEETING_ID).getAsString();
String requesterId = payload.get(REQUESTER_ID).getAsString();
String pollId = payload.get(POLL_ID).getAsString();
return new StopPollRequestMessage(id, requesterId, pollId);
}
}
}
}
return null;
}
use of com.google.gson.JsonParser in project bigbluebutton by bigbluebutton.
the class TransferUserToVoiceConfRequestMessage method fromJson.
public static TransferUserToVoiceConfRequestMessage 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 (TRANSFER_USER_TO_VOICE_CONF_REQUEST.equals(messageName)) {
if (payload.has(VOICE_CONF_ID) && payload.has(TARGET_VOICE_CONF_ID) && payload.has(VOICE_USER_ID)) {
String id = payload.get(VOICE_CONF_ID).getAsString();
String targetVoiceConfId = payload.get(TARGET_VOICE_CONF_ID).getAsString();
String voiceUserId = payload.get(VOICE_USER_ID).getAsString();
return new TransferUserToVoiceConfRequestMessage(id, targetVoiceConfId, voiceUserId);
}
}
}
}
return null;
}
Aggregations