- recieve create poll message on server

This commit is contained in:
Richard Alam 2013-06-20 20:55:58 +00:00
parent f741e677d3
commit 9c4a629a8c
3 changed files with 5 additions and 84 deletions

View File

@ -18,89 +18,16 @@
*/ */
package org.bigbluebutton.conference.service.poll; package org.bigbluebutton.conference.service.poll;
import org.apache.commons.lang.time.DateFormatUtils;
import org.bigbluebutton.conference.service.poll.PollApplication;
import org.bigbluebutton.conference.service.poll.Poll;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.red5.logging.Red5LoggerFactory; import org.red5.logging.Red5LoggerFactory;
import org.red5.server.api.so.ISharedObject;
import org.red5.server.api.Red5; public class PollService {
import redis.clients.jedis.Jedis;
public class PollService {
private static Logger log = Red5LoggerFactory.getLogger( PollService.class, "bigbluebutton" ); private static Logger log = Red5LoggerFactory.getLogger( PollService.class, "bigbluebutton" );
private PollApplication application;
private String LOGNAME = "[PollService]";
private Poll poll;
public void savePoll(ArrayList clientSidePoll){ public void createPoll(String msg){
String pollTime = DateFormatUtils.formatUTC(System.currentTimeMillis(), "MM/dd/yy HH:mm"); System.out.println("*** PollService:: create poll \n" + msg + "\n");
clientSidePoll.set(6, pollTime);
poll = new Poll(clientSidePoll);
application.savePoll(poll);
} }
public ArrayList publish(ArrayList clientSidePoll, String pollKey){
savePoll(clientSidePoll);
return getPoll(pollKey);
}
public void setPollApplication(PollApplication a) {
log.debug(LOGNAME + "Setting Poll Applications");
application = a;
}
public ArrayList getPoll(String pollKey)
{
Poll poll = application.getPoll(pollKey);
ArrayList values = new ArrayList();
values.add(poll.title);
values.add(poll.room);
values.add(poll.isMultiple);
values.add(poll.question);
values.add(poll.answers);
values.add(poll.votes);
values.add(poll.time);
values.add(poll.totalVotes);
values.add(poll.status);
values.add(poll.didNotVote);
values.add(poll.publishToWeb);
values.add(poll.webKey);
return values;
}
public ArrayList vote(String pollKey, ArrayList answerIDs, Boolean webVote)
{
application.vote(pollKey, answerIDs.toArray(), webVote);
return getPoll(pollKey);
}
public ArrayList titleList()
{
return application.titleList();
}
public void setStatus(String pollKey, Boolean status){
application.setStatus(pollKey, status);
}
public ArrayList generate(String pollKey){
ArrayList webInfo = new ArrayList();
webInfo = application.generate(pollKey);
return webInfo;
}
public void cutOffWebPoll(String pollKey){
application.cutOffWebPoll(pollKey);
}
} }

View File

@ -43,11 +43,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
</property> </property>
</bean> </bean>
<bean id="poll.service" <bean id="poll.service" class="org.bigbluebutton.conference.service.poll.PollService">
class="org.bigbluebutton.conference.service.poll.PollService">
<property name="pollApplication">
<ref local="pollApplication"/>
</property>
</bean> </bean>
<bean id="pollRoomsManager" <bean id="pollRoomsManager"

View File

@ -40,8 +40,6 @@ package org.bigbluebutton.modules.polling.service
{ {
var jsonMsg:String = JSON.stringify(poll.toMap()); var jsonMsg:String = JSON.stringify(poll.toMap());
var message:Object = new Object();
message["message"] = jsonMsg;
trace(LOG + "createPoll [" + jsonMsg + "]"); trace(LOG + "createPoll [" + jsonMsg + "]");
var _nc:ConnectionManager = BBB.initConnectionManager(); var _nc:ConnectionManager = BBB.initConnectionManager();
@ -52,7 +50,7 @@ package org.bigbluebutton.modules.polling.service
function(status:String):void { function(status:String):void {
LogUtil.error(status); LogUtil.error(status);
}, },
message jsonMsg
); );
} }
} }