use of org.apache.openmeetings.db.dto.room.RoomDTO in project openmeetings by apache.
the class RoomWebService method getExternal.
/**
* Checks if a room with this exteralRoomId + externalRoomType does exist,
* if yes it returns the room id if not, it will create the room and then
* return the room id of the newly created room
*
* @param sid
* The SID of the User. This SID must be marked as Loggedin
* @param type
* type of the room
* @param externalType
* you can specify your system-name or type of room here, for
* example "moodle"
* @param externalId
* your external room id may set here
* @param room
* details of the room to be created if not found
*
* @return - id of the room or error code
*/
@WebMethod
@GET
@Path("/{type}/{externaltype}/{externaliId}")
public RoomDTO getExternal(@WebParam(name = "sid") @QueryParam("sid") String sid, @PathParam("type") @WebParam(name = "type") String type, @PathParam("externaltype") @WebParam(name = "externaltype") String externalType, @PathParam("externalid") @WebParam(name = "externalid") String externalId, @WebParam(name = "room") @QueryParam("room") RoomDTO room) {
return performCall(sid, User.Right.Soap, sd -> {
Room r = roomDao.getExternal(Room.Type.valueOf(type), externalType, externalId);
if (r == null) {
if (room == null) {
return null;
} else {
r = room.get(fileDao);
r.setExternalType(externalType);
r.setExternalId(externalId);
r = updateRtoRoom(r, sd.getUserId());
return new RoomDTO(r);
}
} else {
return new RoomDTO(r);
}
});
}
use of org.apache.openmeetings.db.dto.room.RoomDTO in project openmeetings by apache.
the class RoomWebService method add.
/**
* Adds a new Room like through the Frontend
*
* @param sid
* The SID from getSession
* @param room
* room object
*
* @return - id of the user added or error code
*/
@WebMethod
@POST
@Path("/")
public RoomDTO add(@WebParam(name = "sid") @QueryParam("sid") String sid, @WebParam(name = "room") @FormParam("room") RoomDTO room) {
return performCall(sid, User.Right.Soap, sd -> {
Room r = room.get(fileDao);
r = updateRtoRoom(r, sd.getUserId());
return new RoomDTO(r);
});
}
use of org.apache.openmeetings.db.dto.room.RoomDTO in project openmeetings by apache.
the class AbstractWebServiceTest method createAndValidate.
protected static CallResult<RoomDTO> createAndValidate(String sid, RoomDTO r) {
if (sid == null) {
ServiceResult sr = login();
sid = sr.getMessage();
}
RoomDTO room = getClient(getRoomUrl()).query("sid", sid).type(APPLICATION_FORM_URLENCODED).post(new Form().param("room", r.toString()), RoomDTO.class);
assertNotNull("Valid room should be returned", room);
assertNotNull("Room ID should be not empty", room.getId());
RoomDTO room1 = getClient(getRoomUrl()).path(String.format("/%s", room.getId())).query("sid", sid).get(RoomDTO.class);
assertNotNull("Valid room should be returned", room1);
assertEquals("Room with same ID should be returned", room.getId(), room1.getId());
assertEquals("Room with same Name should be returned", r.getName(), room1.getName());
assertEquals("Room with same ExternalType should be returned", r.getExternalType(), room1.getExternalType());
assertEquals("Room with same ExternalId should be returned", r.getExternalId(), room1.getExternalId());
// TODO check other fields
return new CallResult<>(sid, room1);
}
use of org.apache.openmeetings.db.dto.room.RoomDTO in project openmeetings by apache.
the class TestRoomService method testCreate2.
@Test
public void testCreate2() {
Room.Type type = Room.Type.presentation;
String name = "Unit Test Ext Room2";
String comment = "Unit Test Ext Room Comments2";
RoomDTO r = new RoomDTO();
r.setType(type);
r.setName(name);
r.setComment(comment);
r.setCapacity(CAPACITY);
createAndValidate(r);
}
use of org.apache.openmeetings.db.dto.room.RoomDTO in project openmeetings by apache.
the class TestRoomService method testCreate1.
@Test
public void testCreate1() {
String extId = UUID.randomUUID().toString();
Room.Type type = Room.Type.presentation;
String name = "Unit Test Ext Room1";
String comment = "Unit Test Ext Room Comments1";
RoomDTO r = new RoomDTO();
r.setType(type);
r.setName(name);
r.setComment(comment);
r.setCapacity(CAPACITY);
r.setExternalType(UNIT_TEST_EXT_TYPE);
r.setExternalId(extId);
createAndValidate(r);
}
Aggregations