- try displaying poll result as whiteboard shape

This commit is contained in:
Richard Alam 2015-07-02 22:16:11 +00:00
parent 2f170aa285
commit 72659e62ac
9 changed files with 48 additions and 16 deletions

View File

@ -8,6 +8,7 @@ public class WhiteboardKeyUtil {
public static final String ELLIPSE_TYPE = "ellipse";
public static final String TRIANGLE_TYPE = "triangle";
public static final String LINE_TYPE = "line";
public static final String POLL_RESULT_TYPE = "poll_result";
public static final String TEXT_CREATED_STATUS = "textCreated";
public static final String DRAW_START_STATUS = "DRAW_START";

View File

@ -328,7 +328,7 @@ class BigBlueButtonInGW(val system: ActorSystem, outGW: MessageOutGateway, voice
* Message Interface for Whiteboard
* *****************************************************************
*/
private def buildAnnotation(annotation: Map[String, Object]): Option[AnnotationVO] = {
private def buildAnnotation(annotation: scala.collection.mutable.Map[String, Object]): Option[AnnotationVO] = {
var shape: Option[AnnotationVO] = None
val id = annotation.getOrElse("id", null).asInstanceOf[String]
@ -345,7 +345,7 @@ class BigBlueButtonInGW(val system: ActorSystem, outGW: MessageOutGateway, voice
}
def sendWhiteboardAnnotation(meetingID: String, requesterID: String, annotation: java.util.Map[String, Object]) {
val ann = mapAsScalaMap(annotation).toMap
val ann: scala.collection.mutable.Map[String, Object] = mapAsScalaMap(annotation)
buildAnnotation(ann) match {
case Some(shape) => {

View File

@ -231,9 +231,7 @@ class Answer(val id: Int, val key: String, val text: Option[String]) {
responders.clear
}
def addResponder(responder: Responder) {
println("********************************************************************** Add response for key=[" + key + "] votes=[" + numResponders + "]")
responders += responder
println("********************************************************************** Added response for key=[" + key + "] votes=[" + numResponders + "]")
}
def numResponders(): Int = {
@ -251,7 +249,6 @@ class Answer(val id: Int, val key: String, val text: Option[String]) {
}
def toSimpleVoteOutVO(): SimpleVoteOutVO = {
println("********************************************************************** Num response for key=[" + key + "] votes=[" + numResponders + "]")
new SimpleVoteOutVO(id, key, numResponders)
}
}

View File

@ -4,6 +4,8 @@ import org.bigbluebutton.core.api._
import org.bigbluebutton.core.MeetingActor
import scala.collection.mutable.HashMap
import scala.collection.mutable.ArrayBuffer
import org.bigbluebutton.core.service.whiteboard.WhiteboardKeyUtil
import com.google.gson.Gson
trait PollApp {
this: MeetingActor =>
@ -60,11 +62,39 @@ trait PollApp {
}
}
def pollResultToWhiteboardShape(result: SimplePollResultOutVO, msg: ShowPollResultRequest): scala.collection.immutable.Map[String, Object] = {
val shape = new scala.collection.mutable.HashMap[String, Object]()
val answers = new ArrayBuffer[java.util.HashMap[String, Object]];
result.answers.foreach(ans => {
val amap = new java.util.HashMap[String, Object]()
amap.put("id", ans.id: java.lang.Integer)
amap.put("key", ans.key)
amap.put("num_votes", ans.numVotes: java.lang.Integer)
answers += amap
})
val gson = new Gson()
shape += "result" -> gson.toJson(answers.toArray)
val display = Array(0, 0, 200, 200)
shape += "points" -> display
shape.toMap
}
def handleShowPollResultRequest(msg: ShowPollResultRequest) {
pollModel.getSimplePollResult(msg.pollId) match {
case Some(poll) => {
pollModel.showPollResult(poll.id)
outGW.send(new PollShowResultMessage(mProps.meetingID, mProps.recorded, msg.requesterId, msg.pollId, poll))
val shape = pollResultToWhiteboardShape(poll, msg)
for {
page <- presModel.getCurrentPage()
annotation = new AnnotationVO(poll.id, WhiteboardKeyUtil.DRAW_END_STATUS, WhiteboardKeyUtil.POLL_RESULT_TYPE, shape, page.id)
} this.context.self ! new SendWhiteboardAnnotationRequest(mProps.meetingID, msg.requesterId, annotation)
// outGW.send(new PollShowResultMessage(mProps.meetingID, mProps.recorded, msg.requesterId, msg.pollId, poll))
}
case None => {
val result = new RequestResult(StatusCodes.NOT_FOUND, Some(Array(ErrorCodes.RESOURCE_NOT_FOUND)))

View File

@ -2,7 +2,7 @@ package org.bigbluebutton.core.apps
import scala.collection.mutable.ArrayBuffer
case class AnnotationVO(id: String, status: String, shapeType: String, shape: scala.collection.immutable.Map[String, Object], wbId: String)
case class AnnotationVO(id: String, status: String, shapeType: String, shape: scala.collection.immutable.Map[String, Any], wbId: String)
class WhiteboardModel {
private var _whiteboards = new scala.collection.immutable.HashMap[String, Whiteboard]()

View File

@ -20,7 +20,7 @@ object UsersMessageToJsonConverter {
wuser += "presenter" -> user.presenter
wuser += "has_stream" -> user.hasStream
wuser += "locked" -> user.locked
wuser += "webcam_stream" -> user.webcamStreams
wuser += "webcam_stream" -> user.webcamStreams.toArray
wuser += "phone_user" -> user.phoneUser
wuser += "listenOnly" -> user.listenOnly

View File

@ -53,7 +53,13 @@ class WhiteboardEventRedisRecorder(recorder: RecorderApplication) extends OutMes
event.setPresentation(getPresentationId(msg.whiteboardId))
event.setPageNumber(getPageNum(msg.whiteboardId))
event.setWhiteboardId(msg.whiteboardId)
event.addAnnotation(mapAsJavaMap(msg.shape.shape))
// FIXME: Need to fix recording of wb event (ralam june 29, 2015)
//val ann: java.util.Map[String, Any] = mapAsJavaMap(msg.shape.shape)
// val ann: java.util.Map[String, Object] = mapAsJavaMap(msg.shape.shape)
// val ann2: java.util.Map[String, Object] = mapAsJavaMap(ann)
// event.addAnnotation(mapAsJavaMap(ann))
recorder.record(msg.meetingID, event)
} else {
val event = new AddShapeWhiteboardRecordEvent()
@ -62,7 +68,8 @@ class WhiteboardEventRedisRecorder(recorder: RecorderApplication) extends OutMes
event.setPresentation(getPresentationId(msg.whiteboardId))
event.setPageNumber(getPageNum(msg.whiteboardId))
event.setWhiteboardId(msg.whiteboardId);
event.addAnnotation(mapAsJavaMap(msg.shape.shape))
// FIXME: Need to fix recording of wb event (ralam june 29, 2015)
// event.addAnnotation(mapAsJavaMap(msg.shape.shape))
recorder.record(msg.meetingID, event)
}
}

View File

@ -200,6 +200,8 @@ public class Util {
}
public Map<String, Object> extractAnnotation(JsonObject annotationElement) {
//NON-TEXT SHAPE
if (annotationElement.has(Constants.ID)

View File

@ -70,15 +70,13 @@ public class WhiteboardClientMessageSender {
}
}
private void processSendWhiteboardAnnotationReplyMessage(
SendWhiteboardAnnotationReplyMessage msg) {
private void processSendWhiteboardAnnotationReplyMessage(SendWhiteboardAnnotationReplyMessage msg) {
Map<String, Object> args = new HashMap<String, Object>();
args.put("whiteboardId", msg.whiteboardId);
Map<String, Object> shape = new HashMap<String, Object>();
System.out.println("\n\n"+msg.shape.toString() +"\n\n");
shape.put("id", msg.shape.get("id"));
shape.put("type", msg.shape.get("type"));
shape.put("status", msg.shape.get("status"));
@ -90,9 +88,6 @@ public class WhiteboardClientMessageSender {
Gson gson = new Gson();
message.put("msg", gson.toJson(args));
System.out.println("RedisPubSubMessageHandler - processSendWhiteboardAnnotationReplyMessage \n"
+ message.get("msg").toString() + "\n");
//broadcast message
BroadcastClientMessage b = new BroadcastClientMessage(msg.meetingId, "WhiteboardNewAnnotationCommand", message);
service.sendMessage(b);