use of com.google.gson.JsonObject in project bigbluebutton by bigbluebutton.
the class DeskShareHangUpEventMessage method fromJson.
public static DeskShareHangUpEventMessage 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 (DESKSHARE_HANG_UP_MESSAGE.equals(messageName)) {
if (payload.has(CONFERENCE_NAME) && payload.has(FS_CONFERENCE_NAME) && payload.has(TIMESTAMP)) {
String conferenceName = payload.get(CONFERENCE_NAME).getAsString();
String fsConferenceName = payload.get(FS_CONFERENCE_NAME).getAsString();
String timestamp = payload.get(TIMESTAMP).getAsString();
return new DeskShareHangUpEventMessage(conferenceName, fsConferenceName, timestamp);
}
}
}
}
return null;
}
use of com.google.gson.JsonObject in project bigbluebutton by bigbluebutton.
the class EjectUserFromVoiceConfRequestMessage method fromJson.
public static EjectUserFromVoiceConfRequestMessage 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 (EJECT_VOICE_USER_REQUEST.equals(messageName)) {
if (payload.has(MEETING_ID) && payload.has(VOICE_CONF_ID) && payload.has(VOICE_USER_ID)) {
String id = payload.get(MEETING_ID).getAsString();
String voiceConfId = payload.get(VOICE_CONF_ID).getAsString();
String voiceUserId = payload.get(VOICE_USER_ID).getAsString();
return new EjectUserFromVoiceConfRequestMessage(id, voiceConfId, voiceUserId);
}
}
}
}
return null;
}
use of com.google.gson.JsonObject in project bigbluebutton by bigbluebutton.
the class EditCaptionHistoryMessage method fromJson.
public static EditCaptionHistoryMessage 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 (EDIT_CAPTION_HISTORY.equals(messageName)) {
if (payload.has(Constants.MEETING_ID) && payload.has(Constants.USER_ID) && payload.has(Constants.START_INDEX) && payload.has(Constants.END_INDEX) && payload.has(Constants.LOCALE) && payload.has(Constants.LOCALE_CODE) && payload.has(Constants.TEXT)) {
String meetingID = payload.get(Constants.MEETING_ID).getAsString();
String userID = payload.get(Constants.USER_ID).getAsString();
Integer startIndex = payload.get(Constants.START_INDEX).getAsInt();
Integer endIndex = payload.get(Constants.END_INDEX).getAsInt();
String locale = payload.get(Constants.LOCALE).getAsString();
String localeCode = payload.get(Constants.LOCALE_CODE).getAsString();
String text = payload.get(Constants.TEXT).getAsString();
return new EditCaptionHistoryMessage(meetingID, userID, startIndex, endIndex, locale, localeCode, text);
}
}
}
}
return null;
}
use of com.google.gson.JsonObject in project bigbluebutton by bigbluebutton.
the class EjectAllUsersFromVoiceConfRequestMessage method fromJson.
public static EjectAllUsersFromVoiceConfRequestMessage 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 (EJECT_ALL_VOICE_USERS_REQUEST.equals(messageName)) {
if (payload.has(MEETING_ID) && payload.has(VOICE_CONF_ID)) {
String id = payload.get(MEETING_ID).getAsString();
String voiceConfId = payload.get(VOICE_CONF_ID).getAsString();
return new EjectAllUsersFromVoiceConfRequestMessage(id, voiceConfId);
}
}
}
}
return null;
}
use of com.google.gson.JsonObject in project disunity by ata4.
the class JsonTablePrinter method tableToJson.
private JsonArray tableToJson(Table<Integer, Integer, Object> table, Gson gson) {
JsonArray jsonTable = new JsonArray();
table.rowMap().forEach((rk, r) -> {
if (rk == 0) {
return;
}
JsonObject jsonRow = new JsonObject();
table.columnMap().forEach((ck, c) -> {
String key = String.valueOf(table.get(0, ck)).toLowerCase();
Object value = table.get(rk, ck);
jsonRow.add(key, gson.toJsonTree(value));
});
jsonTable.add(jsonRow);
});
JsonObject jsonRoot = new JsonObject();
if (file != null) {
jsonRoot.add("file", new JsonPrimitive(file.toString()));
}
return jsonTable;
}
Aggregations