use of org.apache.openmeetings.db.entity.room.Room in project openmeetings by apache.
the class TestRoomService method testCreateWithFiles2.
@Test
public void testCreateWithFiles2() throws IOException {
// lets create real file
CallResult<FileItemDTO> fileCall = createVerifiedFile(getDefaultProfilePicture(), "img.jpg", BaseFileItem.Type.Image);
Room.Type type = Room.Type.presentation;
String name = "Unit Test Ext Room4";
String comment = "Unit Test Ext Room Comments4";
RoomDTO r = new RoomDTO();
r.setType(type);
r.setName(name);
r.setComment(comment);
r.setCapacity(CAPACITY);
RoomFileDTO rf = new RoomFileDTO();
// not existent
rf.setFileId(fileCall.getObj().getId());
r.getFiles().add(rf);
CallResult<RoomDTO> res = createAndValidate(fileCall.getSid(), r);
assertFalse("Room files should NOT be empty", res.getObj().getFiles().isEmpty());
}
use of org.apache.openmeetings.db.entity.room.Room in project openmeetings by apache.
the class TestRoomService method testCreateWithFiles1.
@Test
public void testCreateWithFiles1() {
Room.Type type = Room.Type.presentation;
String name = "Unit Test Ext Room3";
String comment = "Unit Test Ext Room Comments3";
RoomDTO r = new RoomDTO();
r.setType(type);
r.setName(name);
r.setComment(comment);
r.setCapacity(CAPACITY);
RoomFileDTO rf = new RoomFileDTO();
// not existent
rf.setFileId(-666L);
r.getFiles().add(rf);
CallResult<RoomDTO> res = createAndValidate(r);
assertTrue("No room files should be added", res.getObj().getFiles().isEmpty());
}
use of org.apache.openmeetings.db.entity.room.Room in project openmeetings by apache.
the class GroupWebService method addRoom.
/**
* Adds a room to an group
*
* @param sid - The SID of the User. This SID must be marked as Loggedin
* @param id - Id of group that the room is being paired with
* @param roomid - Id of room to be added
*
* @return {@link ServiceResult} with result type
*/
@POST
@Path("/{id}/rooms/add/{roomid}")
public ServiceResult addRoom(@QueryParam("sid") @WebParam(name = "sid") String sid, @PathParam("id") @WebParam(name = "id") Long id, @PathParam("roomid") @WebParam(name = "roomid") Long roomid) {
return performCall(sid, User.Right.Soap, sd -> {
Room r = roomDao.get(roomid);
if (r != null) {
if (r.getGroups() == null) {
r.setGroups(new ArrayList<RoomGroup>());
}
boolean found = false;
for (RoomGroup ro : r.getGroups()) {
if (ro.getGroup().getId().equals(id)) {
found = true;
}
}
if (!found) {
r.getGroups().add(new RoomGroup(groupDao.get(id), r));
roomDao.update(r, sd.getUserId());
return new ServiceResult("Success", Type.SUCCESS);
}
}
return new ServiceResult("Not added", Type.ERROR);
});
}
use of org.apache.openmeetings.db.entity.room.Room in project openmeetings by apache.
the class RoomWebService method close.
/**
* Method to remotely close rooms. If a room is closed all users
* inside the room and all users that try to enter it will be redirected to
* the redirectURL that is defined in the Room-Object.
*
* Returns positive value if authentication was successful.
*
* @param sid
* The SID of the User. This SID must be marked as Loggedin
* @param id
* the room id
*
* @return - 1 in case of success, -2 otherwise
*/
@WebMethod
@GET
@Path("/close/{id}")
public ServiceResult close(@WebParam(name = "sid") @QueryParam("sid") String sid, @WebParam(name = "id") @PathParam("id") long id) {
return performCall(sid, User.Right.Soap, sd -> {
Long userId = sd.getUserId();
Room room = roomDao.get(id);
room.setClosed(true);
roomDao.update(room, userId);
WebSocketHelper.sendRoom(new RoomMessage(room.getId(), userDao.get(userId), RoomMessage.Type.roomClosed));
return new ServiceResult("Closed", Type.SUCCESS);
});
}
Aggregations