Fixed guest policy getting, setting an changed messages

This commit is contained in:
Pedro Beschorner Marin 2015-12-04 15:16:09 +00:00
parent 59cd4f64bf
commit 438e5fc1e6
6 changed files with 27 additions and 26 deletions

View File

@ -377,7 +377,7 @@ public class UsersMessageReceiver implements MessageHandler{
private void processSetGuestPolicyMessage(String message) {
SetGuestPolicyMessage msg = SetGuestPolicyMessage.fromJson(message);
if (msg != null) {
bbbInGW.setGuestPolicy(msg.meetingId, msg.policy, msg.setBy);
bbbInGW.setGuestPolicy(msg.meetingId, msg.guestPolicy, msg.setBy);
}
}

View File

@ -127,7 +127,7 @@ public class Constants {
public static final String GUEST = "guest";
public static final String WAITING_FOR_ACCEPTANCE = "waiting_for_acceptance";
public static final String DOWNLOADABLE = "downloadable";
public static final String POLICY = "policy";
public static final String GUEST_POLICY = "guest_policy";
public static final String NOTE_ID = "note_id";
public static final String PATCH = "patch";
public static final String NOTE_NAME = "note_name";

View File

@ -10,19 +10,19 @@ public class GetGuestPolicyReplyMessage implements IBigBlueButtonMessage {
public final String meetingId;
public final String requesterId;
public final String policy;
public final String guestPolicy;
public GetGuestPolicyReplyMessage(String meetingId, String requesterId, String policy) {
public GetGuestPolicyReplyMessage(String meetingId, String requesterId, String guestPolicy) {
this.meetingId = meetingId;
this.requesterId = requesterId;
this.policy = policy;
this.guestPolicy = guestPolicy;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.REQUESTER_ID, requesterId);
payload.put(Constants.POLICY, policy);
payload.put(Constants.GUEST_POLICY, guestPolicy);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(GET_GUEST_POLICY_REPLY, VERSION, null);
return MessageBuilder.buildJson(header, payload);
@ -31,6 +31,7 @@ public class GetGuestPolicyReplyMessage implements IBigBlueButtonMessage {
public static GetGuestPolicyReplyMessage 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");
@ -40,12 +41,12 @@ public class GetGuestPolicyReplyMessage implements IBigBlueButtonMessage {
if (GET_GUEST_POLICY_REPLY.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.REQUESTER_ID)
&& payload.has(Constants.POLICY)) {
&& payload.has(Constants.GUEST_POLICY)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
String requesterId = payload.get(Constants.REQUESTER_ID).getAsString();
String policy = payload.get(Constants.POLICY).getAsString();
String guestPolicy = payload.get(Constants.GUEST_POLICY).getAsString();
return new GetGuestPolicyReplyMessage(meetingId, requesterId, policy);
return new GetGuestPolicyReplyMessage(meetingId, requesterId, guestPolicy);
}
}
}

View File

@ -9,17 +9,17 @@ public class GuestPolicyChangedMessage implements IBigBlueButtonMessage {
public static final String VERSION = "0.0.1";
public final String meetingId;
public final String policy;
public final String guestPolicy;
public GuestPolicyChangedMessage(String meetingId, String policy) {
public GuestPolicyChangedMessage(String meetingId, String guestPolicy) {
this.meetingId = meetingId;
this.policy = policy;
this.guestPolicy = guestPolicy;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.POLICY, policy);
payload.put(Constants.GUEST_POLICY, guestPolicy);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(GUEST_POLICY_CHANGED, VERSION, null);
return MessageBuilder.buildJson(header, payload);
@ -36,11 +36,11 @@ public class GuestPolicyChangedMessage implements IBigBlueButtonMessage {
String messageName = header.get("name").getAsString();
if (GUEST_POLICY_CHANGED.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.POLICY)) {
&& payload.has(Constants.GUEST_POLICY)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
String policy = payload.get(Constants.POLICY).getAsString();
String guestPolicy = payload.get(Constants.GUEST_POLICY).getAsString();
return new GuestPolicyChangedMessage(meetingId, policy);
return new GuestPolicyChangedMessage(meetingId, guestPolicy);
}
}
}

View File

@ -9,19 +9,19 @@ public class SetGuestPolicyMessage implements IBigBlueButtonMessage {
public static final String VERSION = "0.0.1";
public final String meetingId;
public final String policy;
public final String guestPolicy;
public final String setBy;
public SetGuestPolicyMessage(String meetingId, String policy, String setBy) {
public SetGuestPolicyMessage(String meetingId, String guestPolicy, String setBy) {
this.meetingId = meetingId;
this.policy = policy;
this.guestPolicy = guestPolicy;
this.setBy = setBy;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.POLICY, policy);
payload.put(Constants.GUEST_POLICY, guestPolicy);
payload.put(Constants.SET_BY, setBy);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(SET_GUEST_POLICY, VERSION, null);
@ -39,13 +39,13 @@ public class SetGuestPolicyMessage implements IBigBlueButtonMessage {
String messageName = header.get("name").getAsString();
if (SET_GUEST_POLICY.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.POLICY)
&& payload.has(Constants.GUEST_POLICY)
&& payload.has(Constants.SET_BY)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
String policy = payload.get(Constants.POLICY).getAsString();
String guestPolicy = payload.get(Constants.GUEST_POLICY).getAsString();
String setBy = payload.get(Constants.SET_BY).getAsString();
return new SetGuestPolicyMessage(meetingId, policy, setBy);
return new SetGuestPolicyMessage(meetingId, guestPolicy, setBy);
}
}
}

View File

@ -501,7 +501,7 @@ public class UserClientMessageSender {
private void processGetGuestPolicyReplyMessage(GetGuestPolicyReplyMessage msg) {
Map<String, Object> args = new HashMap<String, Object>();
args.put("guestPolicy", msg.policy.toString());
args.put("guestPolicy", msg.guestPolicy.toString());
Map<String, Object> message = new HashMap<String, Object>();
Gson gson = new Gson();
@ -513,7 +513,7 @@ public class UserClientMessageSender {
private void processGuestPolicyChangedMessage(GuestPolicyChangedMessage msg) {
Map<String, Object> args = new HashMap<String, Object>();
args.put("guestPolicy", msg.policy.toString());
args.put("guestPolicy", msg.guestPolicy.toString());
Map<String, Object> message = new HashMap<String, Object>();
Gson gson = new Gson();