- organize data model

This commit is contained in:
Richard Alam 2014-02-14 14:50:00 -05:00
parent 2f9364cdc1
commit d922531288
11 changed files with 197 additions and 19 deletions

View File

@ -0,0 +1,9 @@
package org.bigbluebutton.core.connection.rtmp
{
public class MessageReceiver
{
public function MessageReceiver()
{
}
}
}

View File

@ -63,5 +63,9 @@ package org.bigbluebutton.core.model
customData = value;
return this;
}
public function build():Me {
return new Me(this);
}
}
}

View File

@ -11,8 +11,11 @@ package org.bigbluebutton.core.model
public var recorded:Boolean;
public var defaultLayout: String;
public function Meeting()
public var isRecording: Boolean = false;
public function Meeting(build: MeetingBuilder)
{
}
}
}

View File

@ -5,7 +5,7 @@ package org.bigbluebutton.core.model
internal var id: String;
internal var name: String;
internal var layout: String;
internal var voiceConference: String;
internal var voiceConf: String;
internal var externId: String;
public function MeetingBuilder(id: String, name: String) {
@ -13,19 +13,23 @@ package org.bigbluebutton.core.model
this.name = name;
}
public function withLayout(value: String):void {
public function withLayout(value: String):MeetingBuilder {
layout = value;
return this;
}
public function withVoiceConference(value: String):void {
voiceConference = value;
public function withVoiceConf(value: String):MeetingBuilder {
voiceConf = value;
return this;
}
public function withExternalId(value: String):void {
public function withExternalId(value: String):MeetingBuilder {
externId = value;
return this;
}
public function build():Meeting {
return new Meeting(this);
}
}
}

View File

@ -4,6 +4,8 @@ package org.bigbluebutton.core.model
{
private static var instance:MeetingModel = null;
private var _meeting: Meeting;
public function MeetingModel(enforcer: MeetingModelSingletonEnforcer)
{
if (enforcer == null){
@ -16,7 +18,19 @@ package org.bigbluebutton.core.model
instance = new MeetingModel(new MeetingModelSingletonEnforcer());
}
return instance;
}
}
public function set meeting(value: Meeting):void {
_meeting = value;
}
public function get meeting():Meeting {
return _meeting;
}
public function set recording(record: Boolean):void {
_meeting.isRecording = record;
}
}
}

View File

@ -6,9 +6,23 @@ package org.bigbluebutton.core.model
private var _name: String;
private var _externalId: String;
private var _token: String;
private var _me: Boolean = false;
public function User(builder: UserBuilder)
{
}
public function get id():String {
return _id;
}
public function copy():User {
return new UserBuilder(_id, _name)
.withAvatar(_avatarUrl)
.withExternalId(_.externId).withToken(_token)
.withLayout(_defaultLayout).withWelcome(_welcome)
.withDialNumber(_dialnumber).withRole(_role)
.withCustomData(_customData).build();
}
}
}

View File

@ -14,5 +14,38 @@ package org.bigbluebutton.core.model
public function UserBuilder()
{
}
public function withAvatar(value: String):void {
}
public function withExternalId(value: String):void {
}
public function withToken(value: String):void {
}
public function withLayout(value: String):void {
}
public function withWelcome(value: String):void {
}
public function withDialNumber(value: String):void {
}
public function withRole(value: String):void {
}
public function withCustomData(value: String):void {
}
public function build():User {
}
}
}

View File

@ -1,13 +1,15 @@
package org.bigbluebutton.core.model
{
import mx.collections.ArrayCollection;
public class UsersModel
{
private static var instance:UsersModel = null;
private var _me:Me;
public function UsersModel(enforcer: UsersModelSingletonEnforcer)
{
private var _users:ArrayCollection = new ArrayCollection();
public function UsersModel(enforcer: UsersModelSingletonEnforcer) {
if (enforcer == null){
throw new Error("There can only be 1 UsersModel instance");
}
@ -27,6 +29,53 @@ package org.bigbluebutton.core.model
public function get me():Me {
return _me;
}
public function add(user: User):void {
_users.addItem(user);
}
public function remove(userId: String):User {
var index:int = getIndex(userId);
if (index >= 0) {
return _users.removeItemAt(index);
}
return null;
}
public function getUser(userId:String):User {
var user:User;
for (var i:int = 0; i < _users.length; i++) {
user = _users.getItemAt(i) as User;
if (user.id == userId) {
return user;
}
}
return null;
}
private function getIndex(userId: String):int {
var user:User;
for (var i:int = 0; i < _users.length; i++) {
user = _users.getItemAt(i) as User;
if (user.id == userId) {
return i;
}
}
return -1;
}
private function get users():ArrayCollection {
var us:ArrayCollection = new ArrayCollection();
for (var i:int = 0; i < _users.length; i++) {
}
}
}
}

View File

@ -0,0 +1,48 @@
package org.bigbluebutton.core.model
{
public class UsersService
{
private static var instance:UsersService = null;
public function UsersService(enforcer: UsersServiceSingletonEnforcer) {
if (enforcer == null){
throw new Error("There can only be 1 UsersService instance");
}
}
public static function getInstance():UsersService{
if (instance == null){
instance = new UsersService(new UsersServiceSingletonEnforcer());
}
return instance;
}
public function userJoinedVoice(userId: String):void {
}
public function userLeftVoice(userId: String):void {
}
public function userJoined():void {
}
public function userLeft():void {
}
public function userMuted(userId: String, muted: Boolean):void {
}
public function userTalking(userId: String, talking: Boolean):void {
}
}
}
class UsersServiceSingletonEnforcer{}

View File

@ -109,18 +109,15 @@ package org.bigbluebutton.main.model.users
}
}
var builder:MeBuilder = new MeBuilder(user.internalUserId, user.username).withAvatar(user.avatarURL)
UsersModel.getInstance().me = new MeBuilder(user.internalUserId, user.username).withAvatar(user.avatarURL)
.withExternalId(user.externUserID).withToken(user.authToken)
.withLayout(user.defaultLayout).withWelcome(user.welcome)
.withDialNumber(user.dialnumber).withRole(user.role)
.withCustomData(user.customData);
var me:Me = new Me(builder);
UsersModel.getInstance().me = me;
var meetingBuilder:MeetingBuilder = new MeetingBuilder(user.conference, user.conferenceName)
.withLayout(user.defaultLayout).withVoiceConference(user.voiceBridge)
.withExternalId(user.externMeetingID)
.withCustomData(user.customData).build();
MeetingModel.getInstance().meeting = new MeetingBuilder(user.conference, user.conferenceName)
.withLayout(user.defaultLayout).withVoiceConf(user.voiceBridge)
.withExternalId(user.externMeetingID).build();
if (_resultListener != null) _resultListener(true, user);
}

View File

@ -28,6 +28,7 @@ package org.bigbluebutton.modules.users.services
import org.bigbluebutton.core.events.CoreEvent;
import org.bigbluebutton.core.events.VoiceConfEvent;
import org.bigbluebutton.core.managers.UserManager;
import org.bigbluebutton.core.model.MeetingModel;
import org.bigbluebutton.main.events.BBBEvent;
import org.bigbluebutton.main.events.MadePresenterEvent;
import org.bigbluebutton.main.events.PresenterStatusEvent;
@ -112,6 +113,8 @@ package org.bigbluebutton.modules.users.services
}
private function sendRecordingStatusUpdate(recording:Boolean):void {
MeetingModel.getInstance().recording = recording;
var e:BBBEvent = new BBBEvent(BBBEvent.CHANGE_RECORDING_STATUS);
e.payload.remote = true;
e.payload.recording = recording;