Package org.apache.openmeetings.db.entity.room

Examples of org.apache.openmeetings.db.entity.room.RoomModerator


        // We need to reset ids as openJPA reject to store them otherwise
        r.setRooms_id(null);
        if (r.getModerators() != null) {
          for (Iterator<RoomModerator> i = r.getModerators().iterator(); i.hasNext();) {
            RoomModerator rm = i.next();
            if (rm.getUser().getUser_id() == null) {
              i.remove();
            }
          }
        }
        r = roomDao.update(r, null);
View Full Code Here


        // We need to reset ids as openJPA reject to store them otherwise
        r.setRooms_id(null);
        if (r.getModerators() != null) {
          for (Iterator<RoomModerator> i = r.getModerators().iterator(); i.hasNext();) {
            RoomModerator rm = i.next();
            if (rm.getUser().getUser_id() == null) {
              i.remove();
            }
          }
        }
        r = roomDao.update(r, null);
View Full Code Here

   * @return
   */
  public Long addRoomModeratorByUserId(User us, Boolean isSuperModerator,
      Long roomId) {
    try {
      RoomModerator rModerator = new RoomModerator();
      rModerator.setUser(us);
      rModerator.setIsSuperModerator(isSuperModerator);
      rModerator.setStarttime(new Date());
      rModerator.setDeleted(false);
      rModerator.setRoomId(roomId);
      rModerator = em.merge(rModerator);
      long rModeratorId = rModerator.getRoomModeratorsId();
      return rModeratorId;
    } catch (Exception ex2) {
      log.error("[addRoomModeratorByUserId] ", ex2);
    }
    return null;
View Full Code Here

   */
  public RoomModerator getRoomModeratorById(Long roomModeratorsId) {
    try {
      TypedQuery<RoomModerator> query = em.createNamedQuery("getRoomModeratorById", RoomModerator.class);
      query.setParameter("roomModeratorsId", roomModeratorsId);
      RoomModerator roomModerators = null;
      try {
        roomModerators = query.getSingleResult();
      } catch (NoResultException ex) {
      }
      return roomModerators;
View Full Code Here

   *
   * @param roomModeratorsId
   */
  public void removeRoomModeratorByUserId(Long roomModeratorsId) {
    try {
      RoomModerator rModerator = this
          .getRoomModeratorById(roomModeratorsId);

      if (rModerator == null) {
        return;
      }

      rModerator.setUpdatetime(new Date());
      rModerator.setDeleted(true);

      if (rModerator.getRoomModeratorsId() == 0) {
        em.persist(rModerator);
      } else {
        if (!em.contains(rModerator)) {
          em.merge(rModerator);
        }
View Full Code Here

  }

  public void updateRoomModeratorByUserId(Long roomModeratorsId,
      Boolean isSuperModerator) {
    try {
      RoomModerator rModerator = this
          .getRoomModeratorById(roomModeratorsId);

      if (rModerator == null) {
        return;
      }

      rModerator.setIsSuperModerator(isSuperModerator);
      rModerator.setUpdatetime(new Date());

      if (rModerator.getRoomModeratorsId() == 0) {
        em.persist(rModerator);
      } else {
        if (!em.contains(rModerator)) {
          em.merge(rModerator);
        }
View Full Code Here

    moderators =  new ListView<RoomModerator>("moderators", moderatorsInRoom) {
      private static final long serialVersionUID = -7935197812421549677L;

      @Override
      protected void populateItem(final ListItem<RoomModerator> item) {
        final RoomModerator moderator = item.getModelObject();
        item.add(new Label("isSuperModerator", "" + moderator.getIsSuperModerator()))
          .add(new Label("userId", "" + moderator.getUser().getUser_id()))
          .add(new Label("uName", "" + moderator.getUser().getFirstname() + " " + moderator.getUser().getLastname()))
          .add(new Label("email", ""+ moderator.getUser().getAdresses().getEmail()))
          .add(new WebMarkupContainer("delete").add(new AjaxEventBehavior("onclick"){
          private static final long serialVersionUID = 1L;

          @Override
          protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
            super.updateAjaxAttributes(attributes);
            attributes.getAjaxCallListeners().add(new ConfirmCallListener(833L));
          }
         
          @Override
          protected void onEvent(AjaxRequestTarget target) {
            Application.getBean(RoomModeratorsDao.class).removeRoomModeratorByUserId(moderator.getRoomModeratorsId());
            updateModerators(target);
          }
        }));

        item.add(AttributeModifier.replace("class", (item.getIndex() % 2 == 1) ? "even" : "odd"));
View Full Code Here

          found = true;
          break;
        }
      }
      if (!found) {
        RoomModerator rModerator = new RoomModerator();
        rModerator.setUser(u);
        rModerator.setIsSuperModerator(false);
        rModerator.setStarttime(new Date());
        rModerator.setDeleted(false);
        rModerator.setRoomId(roomId);
        moderatorsInRoom.add(rModerator);
        moderatorsDao.addRoomModeratorByUserId(u, false, roomId);
      }
    }
    updateModerators(target);
View Full Code Here

              found = true;
              break;
            }
          }
          if (!found) {
            RoomModerator rm = new RoomModerator();
            rm.setRoomId(r.getRooms_id());
            rm.setUser(u);
            r.getModerators().add(0, rm);
            moderator2add.setObject(null);
            target.add(moderatorContainer, moderatorChoice);
          }
        }
      }
    }).setOutputMarkupId(true));
    add(moderatorContainer.add(new ListView<RoomModerator>("moderators") {
      private static final long serialVersionUID = 1L;

      @Override
      protected void populateItem(final ListItem<RoomModerator> item) {
        RoomModerator moderator = item.getModelObject();
        Label name = new Label("uName", moderator.getUser().getFirstname() + " " + moderator.getUser().getLastname());
        if (moderator.getRoomModeratorsId() == 0) {
          name.add(AttributeAppender.append("class", "newItem"));
        }
        item.add(new CheckBox("isSuperModerator", new PropertyModel<Boolean>(moderator, "isSuperModerator")))
          .add(new Label("userId", "" + moderator.getUser().getUser_id()))
          .add(name)
          .add(new Label("email", moderator.getUser().getAdresses().getEmail()))
          .add(new WebMarkupContainer("delete").add(new AjaxEventBehavior("onclick"){
            private static final long serialVersionUID = 1L;
 
            @Override
            protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
View Full Code Here

    for (Map<String, Object> roomModeratorObj : list) {
      Long roomModeratorsId = roomModeratorObj.containsKey("roomModeratorsId") ? Long.parseLong(roomModeratorObj.get("roomModeratorsId").toString()) : null;
      Long userId = Long.parseLong(roomModeratorObj.get("userId").toString());
      Boolean isSuperModerator = Boolean.parseBoolean(roomModeratorObj.get("isSuperModerator").toString());

      RoomModerator rm = new RoomModerator();
      rm.setRoomModeratorsId(roomModeratorsId);
      rm.setRoomId(roomId);
      rm.setUser(usersDao.get(userId));
      rm.setIsSuperModerator(isSuperModerator);
     
      result.add(rm);
    }
    return result;
    }
View Full Code Here

TOP

Related Classes of org.apache.openmeetings.db.entity.room.RoomModerator

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.