Package org.apache.openmeetings.persistence.beans.room

Examples of org.apache.openmeetings.persistence.beans.room.Client


      // Return Object
      RoomStatus roomStatus = new RoomStatus();

      IConnection current = Red5.getConnectionLocal();
      String streamid = current.getClient().getId();
      Client currentClient = sessionManager.getClientByStreamId(streamid, null);
      currentClient.setRoom_id(room_id);
      currentClient.setRoomEnter(new Date());
      currentClient.setOrganization_id(organization_id);

      currentClient.setUsercolor(colorObj);

      // Inject externalUserId if nothing is set yet
      if (currentClient.getExternalUserId() == null) {
        if (currentClient.getUser_id() != null) {
          User us = usersDao.get(currentClient.getUser_id());
          if (us != null) {
            currentClient.setExternalUserId(us.getExternalUserId());
            currentClient.setExternalUserType(us.getExternalUserType());
          }
        }
      }

      // This can be set without checking for Moderation Flag
      currentClient.setIsSuperModerator(isSuperModerator);

      this.sessionManager.updateClientByStreamId(streamid,
          currentClient, true, null);

            Room room = roomDao.get(room_id);
            if (room.getShowMicrophoneStatus()) {
              currentClient.setCanGiveAudio(true);
            }

      // Log the User
      conferenceLogDao.addConferenceLog("roomEnter",
          currentClient.getUser_id(), streamid, room_id,
          currentClient.getUserip(), "",
          currentClient.getExternalUserId(),
          currentClient.getExternalUserType(),
          currentClient.getMail(), currentClient.getFirstname(),
          currentClient.getLastname());
     
      // Check for Moderation LogicalRoom ENTER
      List<Client> clientListRoom = sessionManager.getClientListByRoom(room_id);

      // appointed meeting or moderated Room? => Check Max Users first
      if (room.getNumberOfPartizipants() != null
          && clientListRoom.size() > room.getNumberOfPartizipants()) {
        roomStatus.setRoomFull(true);
        return roomStatus;
      }

      // default logic for non regular rooms
      if (room.getAppointment() == null || room.getAppointment() == false) {

        if (room.getIsModeratedRoom()) {

          // if this is a Moderated Room then the Room can be only
          // locked off by the Moderator Bit
          // List<RoomClient> clientModeratorListRoom =
          // this.sessionManager.getCurrentModeratorByRoom(room_id);

          // If there is no Moderator yet we have to check if the
          // current User has the Bit set to true to
          // become one, otherwise he won't get Moderation and has to
          // wait
          if (becomeModerator) {
            currentClient.setIsMod(true);

            // There is a need to send an extra Event here, cause at
            // this moment there could be
            // already somebody in the Room waiting

            // Update the Client List
            this.sessionManager.updateClientByStreamId(streamid,
                currentClient, false, null);

            List<Client> modRoomList = this.sessionManager
                .getCurrentModeratorByRoom(currentClient.getRoom_id());
           
            //Sync message to everybody
            syncMessageToCurrentScope("setNewModeratorByList", modRoomList, false);

          } else {
            // The current User is not a Teacher/Admin or whatever
            // Role that should get the
            // Moderation
            currentClient.setIsMod(false);
          }

        } else {

          // If this is a normal Room Moderator rules : first come,
          // first draw ;-)
          log.debug("setRoomValues : Room"
              + room_id
              + " not appointed! Moderator rules : first come, first draw ;-)");
          if (clientListRoom.size() == 1) {
            log.debug("Room is empty so set this user to be moderation role");
            currentClient.setIsMod(true);
          } else {
            log.debug("Room is already somebody so set this user not to be moderation role");

            if (becomeModerator) {
              currentClient.setIsMod(true);

              // Update the Client List
              this.sessionManager.updateClientByStreamId(
                  streamid, currentClient, false, null);

              List<Client> modRoomList = this.sessionManager
                  .getCurrentModeratorByRoom(currentClient
                      .getRoom_id());

              // There is a need to send an extra Event here,
              // cause at this moment there could be
              // already somebody in the Room waiting -swagner check this comment, 20.01.2012
             
              //Sync message to everybody
              syncMessageToCurrentScope("setNewModeratorByList", modRoomList, false);

            } else {
              // The current User is not a Teacher/Admin or
              // whatever Role that should get the Moderation
              currentClient.setIsMod(false);
            }

          }

        }

        // Update the Client List
        this.sessionManager.updateClientByStreamId(streamid,
            currentClient, false, null);

      } else {

        // If this is an Appointment then the Moderator will be set to
        // the Invitor

        Appointment ment = appointmentLogic
            .getAppointmentByRoom(room_id);

        List<MeetingMember> members = meetingMemberDao
            .getMeetingMemberByAppointmentId(ment
                .getAppointmentId());

        Long userIdInRoomClient = currentClient.getUser_id();

        boolean found = false;
        boolean moderator_set = false;

        // Check if current user is set to moderator
        for (int i = 0; i < members.size(); i++) {
          MeetingMember member = members.get(i);

          // only persistent users can schedule a meeting
          // user-id is only set for registered users
          if (member.getUserid() != null) {
            log.debug("checking user " + member.getFirstname()
                + " for moderator role - ID : "
                + member.getUserid().getUser_id());

            if (member.getUserid().getUser_id()
                .equals(userIdInRoomClient)) {
              found = true;

              if (member.getInvitor()) {
                log.debug("User "
                    + userIdInRoomClient
                    + " is moderator due to flag in MeetingMember record");
                currentClient.setIsMod(true);

                // Update the Client List
                this.sessionManager.updateClientByStreamId(
                    streamid, currentClient, false, null);

                List<Client> modRoomList = this.sessionManager
                    .getCurrentModeratorByRoom(currentClient
                        .getRoom_id());

                // There is a need to send an extra Event here, cause at this moment
                // there could be already somebody in the Room waiting

                //Sync message to everybody
                syncMessageToCurrentScope("setNewModeratorByList", modRoomList, false);

                moderator_set = true;
                this.sessionManager.updateClientByStreamId(
                    streamid, currentClient, false, null);
                break;
              } else {
                log.debug("User "
                    + userIdInRoomClient
                    + " is NOT moderator due to flag in MeetingMember record");
                currentClient.setIsMod(false);
                this.sessionManager.updateClientByStreamId(
                    streamid, currentClient, false, null);
                break;
              }
            } else {
              if (member.getInvitor())
                moderator_set = true;
            }
          } else {
            if (member.getInvitor())
              moderator_set = true;
          }

        }

        if (!found) {
          log.debug("User "
              + userIdInRoomClient
              + " could not be found as MeetingMember -> definitely no moderator");
          currentClient.setIsMod(false);
          this.sessionManager.updateClientByStreamId(streamid,
              currentClient, false, null);
        } else {
          // if current user is part of the member list, but moderator
          // couldn't be retrieved : first come, first draw!
          if (clientListRoom.size() == 1 && moderator_set == false) {
            log.debug("");
            currentClient.setIsMod(true);

            // Update the Client List
            this.sessionManager.updateClientByStreamId(streamid,
                currentClient, false, null);

            List<Client> modRoomList = this.sessionManager
                .getCurrentModeratorByRoom(currentClient
                    .getRoom_id());

            // There is a need to send an extra Event here, cause at
            // this moment there could be
            // already somebody in the Room waiting
View Full Code Here


      String picture_uri) {
    try {
      log.debug("-----------  setUsernameReconnect");
      IConnection current = Red5.getConnectionLocal();
      String streamid = current.getClient().getId();
      Client currentClient = this.sessionManager
          .getClientByStreamId(streamid, null);

      currentClient.setUsername(username);
      currentClient.setUser_id(userId);
      SessionVariablesUtil.setUserId(current.getClient(), userId);
      currentClient.setPicture_uri(picture_uri);
      currentClient.setUserObject(userId, username, firstname, lastname);

      // Update Session Data
      sessiondataDao.updateUserWithoutSession(SID, userId);

      // only fill this value from User-Record
      // cause invited users have no associated User, so
      // you cannot set the firstname,lastname from the UserRecord
      if (userId != null) {
        User us = usersDao.get(userId);
       
        if (us != null) {
          currentClient.setExternalUserId(us.getExternalUserId());
          currentClient.setExternalUserType(us.getExternalUserType());
        }
        if (us != null && us.getPictureuri() != null) {
          // set Picture-URI
          currentClient.setPicture_uri(us.getPictureuri());
        }
      }
      this.sessionManager.updateClientByStreamId(streamid,
          currentClient, false, null);
      return currentClient;
View Full Code Here

      Long userId, String username, String firstname, String lastname) {
    try {
      log.debug("-----------  setUsernameAndSession");
      IConnection current = Red5.getConnectionLocal();
      String streamid = current.getClient().getId();
      Client currentClient = this.sessionManager
          .getClientByStreamId(streamid, null);

      currentClient.setUsername(username);
      currentClient.setUser_id(userId);
      SessionVariablesUtil.setUserId(current.getClient(), userId);
      currentClient.setUserObject(userId, username, firstname, lastname);

      // Update Session Data
      log.debug("UDPATE SESSION " + SID + ", " + userId);
      sessiondataDao.updateUserWithoutSession(SID, userId);

      User user = userManager.getUserById(userId);

      if (user != null) {
        currentClient.setExternalUserId(user.getExternalUserId());
        currentClient.setExternalUserType(user.getExternalUserType());
      }

      // only fill this value from User-Record
      // cause invited users have non
      // you cannot set the firstname,lastname from the UserRecord
      User us = usersDao.get(userId);
      if (us != null && us.getPictureuri() != null) {
        // set Picture-URI
        currentClient.setPicture_uri(us.getPictureuri());
      }
      this.sessionManager.updateClientByStreamId(streamid,
          currentClient, false, null);
      return currentClient;
    } catch (Exception err) {
View Full Code Here

  }

  public synchronized List<Client> getCurrentModeratorList() {
    try {
      IConnection current = Red5.getConnectionLocal();
      Client currentClient = this.sessionManager
          .getClientByStreamId(current.getClient().getId(), null);
      Long room_id = currentClient.getRoom_id();
      return this.sessionManager.getCurrentModeratorByRoom(room_id);
    } catch (Exception err) {
      log.error("[getCurrentModerator]", err);
    }
    return null;
View Full Code Here

        i++;
      }

      // Check if this User is the Mod:
      IConnection current = Red5.getConnectionLocal();
      Client currentClient = this.sessionManager
          .getClientByStreamId(current.getClient().getId(), null);

      if (currentClient == null) {
        return;
      }

      Long room_id = currentClient.getRoom_id();

      // log.debug("***** sendVars: " + whiteboardObj);

      // Store event in list
      String action = whiteboardObj.get(2).toString();
View Full Code Here

  public synchronized int sendVarsModeratorGeneral(Object vars) {
    log.debug("*..*sendVars: " + vars);
    try {
      IConnection current = Red5.getConnectionLocal();
      Client currentClient = this.sessionManager
          .getClientByStreamId(current.getClient().getId(), null);
      // Long room_id = currentClient.getRoom_id();

      log.debug("***** id: " + currentClient.getStreamid());

      boolean ismod = currentClient.getIsMod();

      if (ismod) {
        log.debug("CurrentScope :" + current.getScope().getName());
        // Send to all Clients of the same Scope
        Collection<Set<IConnection>> conCollection = current.getScope()
View Full Code Here

  public Long getNewWhiteboardId() {
    try {

      IConnection current = Red5.getConnectionLocal();
      String streamid = current.getClient().getId();
      Client currentClient = this.sessionManager
          .getClientByStreamId(streamid, null);
      Long room_id = currentClient.getRoom_id();

      Long whiteBoardId = this.whiteBoardObjectListManagerById
          .getNewWhiteboardId(room_id);

      return whiteBoardId;
View Full Code Here

   * @return 1 in case of success, -1 otherwise
   */
  public synchronized int sendMessageWithClientWithSyncObject(Object newMessage, boolean sync) {
    try {
      IConnection current = Red5.getConnectionLocal();
      Client currentClient = this.sessionManager
          .getClientByStreamId(current.getClient().getId(), null);

      HashMap<String, Object> hsm = new HashMap<String, Object>();
      hsm.put("client", currentClient);
      hsm.put("message", newMessage);
View Full Code Here

   */
  public synchronized int sendMessageWithClientById(Object newMessage,
      String clientId) {
    try {
      IConnection current = Red5.getConnectionLocal();
      Client currentClient = this.sessionManager
          .getClientByStreamId(current.getClient().getId(), null);

      HashMap<String, Object> hsm = new HashMap<String, Object>();
      hsm.put("client", currentClient);
      hsm.put("message", newMessage);
View Full Code Here

  public Boolean deleteWhiteboard(Long whiteBoardId) {
    try {
      IConnection current = Red5.getConnectionLocal();
      String streamid = current.getClient().getId();
      Client currentClient = this.sessionManager
          .getClientByStreamId(streamid, null);
      Long room_id = currentClient.getRoom_id();

      WhiteboardObjectList whiteboardObjectList = this.whiteBoardObjectListManagerById
          .getWhiteBoardObjectListByRoomId(room_id);

      for (Iterator<Long> iter = whiteboardObjectList
View Full Code Here

TOP

Related Classes of org.apache.openmeetings.persistence.beans.room.Client

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.