Skip to content

Commit

Permalink
store poll created
Browse files Browse the repository at this point in the history
  • Loading branch information
markoscalderon committed Jul 2, 2013
1 parent 9f0c185 commit 8199113
Show file tree
Hide file tree
Showing 4 changed files with 169 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
*
* This program is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 3.0 of the License, or (at your option) any later
* version.
*
* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
*
*/
package org.bigbluebutton.conference.service.recorder.polling;

import org.bigbluebutton.conference.service.recorder.RecordEvent;

public abstract class AbstractPollRecordEvent extends RecordEvent {

public AbstractPollRecordEvent() {
setModule("POLL");
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
*
* This program is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 3.0 of the License, or (at your option) any later
* version.
*
* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
*
*/
package org.bigbluebutton.conference.service.recorder.polling;


public class PollCreatedRecordEvent extends AbstractPollRecordEvent {
private static final String POLL_ID = "pollID";
private static final String TITLE = "title";
private static final String QUESTION = "question";
private static final String DATETIME = "datetime";
private static final String ANSWERS = "answers";

public PollCreatedRecordEvent() {
super();
setEvent("PollCreatedEvent");
}

public void setPollID(String pollID) {
eventMap.put(POLL_ID, pollID);
}

public void setTitle(String title) {
eventMap.put(TITLE, title);
}

public void setQuestion(String question) {
eventMap.put(QUESTION, question);
}

public void setDatetime(String datetime) {
eventMap.put(DATETIME, datetime);
}

public void setAnswers(String answers) {
eventMap.put(ANSWERS, answers);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
*
* This program is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 3.0 of the License, or (at your option) any later
* version.
*
* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
*
*/

package org.bigbluebutton.conference.service.recorder.polling;

import org.bigbluebutton.conference.service.poll.Poll;
import org.bigbluebutton.conference.service.poll.IPollRoomListener;
import org.bigbluebutton.conference.service.recorder.RecorderApplication;

public class PollEventRecorder implements IPollRoomListener{

private final RecorderApplication recorder;
private final String session;

String name = "RECORDER:POLL";

public PollEventRecorder(String session, RecorderApplication recorder){
this.recorder = recorder;
this.session = session;
}

@Override
public String getName(){
return name;
}

@Override
public void savePoll(Poll poll ){

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package org.bigbluebutton.core.apps.poll.redis

import org.bigbluebutton.conference.service.recorder.RecorderApplication
import org.bigbluebutton.core.api.OutMessageListener2
import org.bigbluebutton.core.api.IOutMessage
import org.bigbluebutton.core.apps.poll.messages._
import org.bigbluebutton.conference.service.recorder.polling.PollCreatedRecordEvent

class PollEventRedisRecorder(recorder: RecorderApplication) extends OutMessageListener2 {

def handleMessage(msg: IOutMessage) {
msg match {
/*case getPollsReplyOutMsg: GetPollsReplyOutMsg => handleGetPollsReplyOutMsg(getPollsReplyOutMsg)
case pollClearedOutMsg : PollClearedOutMsg => handlePollClearedOutMsg(pollClearedOutMsg)
case pollStartedOutMsg: PollStartedOutMsg => handlePollStartedOutMsg(pollStartedOutMsg)
case pollStoppedOutMsg: PollStoppedOutMsg => handlePollStoppedOutMsg(pollStoppedOutMsg)
case pollRemovedOutMsg: PollRemovedOutMsg => handlePollRemovedOutMsg(pollRemovedOutMsg)
case pollUpdatedOutMsg: PollUpdatedOutMsg => handlePollUpdatedOutMsg(pollUpdatedOutMsg)*/
case pollCreatedOutMsg: PollCreatedOutMsg => handlePollCreatedOutMsg(pollCreatedOutMsg)
case _ => // do nothing
}
}

def handlePollCreatedOutMsg(msg: PollCreatedOutMsg):Unit = {
if (msg.recorded) {
val ev = new PollCreatedRecordEvent();
ev.setPollID(msg.pollVO.id)
ev.setTitle(msg.pollVO.title)
ev.setQuestion(msg.pollVO.questions(0).question)
//ev.setDatetime(map.datetime)
// probably the answer will be stored as json
//ev.setAnswers("")
ev.setTimestamp(System.currentTimeMillis())
ev.setMeetingId(msg.meetingID)
recorder.record(msg.meetingID, ev)
}

}

}

0 comments on commit 8199113

Please sign in to comment.