Search in sources :

Example 1 with RoomCountDTO

use of org.apache.openmeetings.db.dto.room.RoomCountDTO in project openmeetings by apache.

the class RoomWebService method counters.

/**
 * Returns current users for rooms ids
 *
 * @param sid - The SID of the User. This SID must be marked as Loggedin
 * @param ids - id of the room you need counters for
 * @return - current users for rooms ids
 */
@WebMethod
@GET
@Path("/counters")
public List<RoomCountDTO> counters(@WebParam(name = "sid") @QueryParam("sid") String sid, @WebParam(name = "id") @QueryParam("id") List<Long> ids) {
    return performCall(sid, User.Right.Soap, sd -> {
        List<RoomCountDTO> roomBeans = new ArrayList<>();
        List<Room> rooms = roomDao.get(ids);
        for (Room room : rooms) {
            RoomCountDTO rCountBean = new RoomCountDTO();
            rCountBean.setRoomId(room.getId());
            rCountBean.setRoomName(room.getName());
            rCountBean.setMaxUser(room.getCapacity());
            rCountBean.setRoomCount(clientManager.listByRoom(room.getId()).size());
            roomBeans.add(rCountBean);
        }
        return roomBeans;
    });
}
Also used : RoomCountDTO(org.apache.openmeetings.db.dto.room.RoomCountDTO) ArrayList(java.util.ArrayList) Room(org.apache.openmeetings.db.entity.room.Room) WebMethod(javax.jws.WebMethod) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET)

Aggregations

ArrayList (java.util.ArrayList)1 WebMethod (javax.jws.WebMethod)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 RoomCountDTO (org.apache.openmeetings.db.dto.room.RoomCountDTO)1 Room (org.apache.openmeetings.db.entity.room.Room)1