Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.bigbluebutton.common.messages;
 
 import java.util.Map;
 
 
 
public class UserVotedPollMessage implements ISubscribedMessage {
	public static final String USER_VOTED_POLL  = "user_voted_poll_message";
	public static final String VERSION = "0.0.1";
	public static final String MEETING_ID = "meeting_id";
	public static final String PRESENTER_ID = "presenter_id";
	public static final String POLL = "poll";
	public final String meetingId;
	public final String presenterId;
	public final Map<StringObjectpoll;
	public UserVotedPollMessage(String meetingIdString presenterIdMap<StringObjectpoll) {
		this. = meetingId;
		this. = presenterId;
		this. = poll;
	}
	public String toJson() {
		HashMap<StringObjectpayload = new HashMap<StringObject>();
		payload.put(); 
		payload.put();
		java.util.HashMap<StringObjectheader = MessageBuilder.buildHeader(null);
		return MessageBuilder.buildJson(headerpayload);				
	}
	public static UserVotedPollMessage fromJson(String message) {
		JsonParser parser = new JsonParser();
		JsonObject obj = (JsonObjectparser.parse(message);
		if (obj.has("header") && obj.has("payload")) {
			JsonObject header = (JsonObjectobj.get("header");
			JsonObject payload = (JsonObjectobj.get("payload");
			if (header.has("name")) {
				String messageName = header.get("name").getAsString();
				if (.equals(messageName)) {
					if (payload.has(.
							&& payload.has()
							&& payload.has()) {
						String presenterId = payload.get().getAsString();
						JsonObject poll = payload.get().getAsJsonObject();
						Util util = new Util();
						Map<StringObjectpollMap = util.decodeSimplePollResult(poll);
						return new UserVotedPollMessage(idpresenterIdpollMap);					
					}
			}
		}
		return null;
	}
New to GrepCode? Check out our FAQ X