Search in sources :

Example 11 with OpenMeetingsRoom

use of org.olat.modules.openmeetings.model.OpenMeetingsRoom in project openolat by klemens.

the class OpenMeetingsDAOTest method testGetReferences.

@Test
public void testGetReferences() {
    OLATResourceable ores = OresHelper.createOLATResourceableInstance(UUID.randomUUID().toString(), 1l);
    OpenMeetingsRoom room = new OpenMeetingsRoom();
    room.setRoomId(123l);
    OpenMeetingsRoomReference ref = openMeetingsDAO.createReference(null, ores, "hello", room);
    dbInstance.commitAndCloseSession();
    List<OpenMeetingsRoomReference> refs = openMeetingsDAO.getReferences();
    Assert.assertNotNull(refs);
    Assert.assertFalse(refs.isEmpty());
    Assert.assertTrue(refs.contains(ref));
}
Also used : OpenMeetingsRoom(org.olat.modules.openmeetings.model.OpenMeetingsRoom) OLATResourceable(org.olat.core.id.OLATResourceable) OpenMeetingsRoomReference(org.olat.modules.openmeetings.model.OpenMeetingsRoomReference) Test(org.junit.Test)

Example 12 with OpenMeetingsRoom

use of org.olat.modules.openmeetings.model.OpenMeetingsRoom in project openolat by klemens.

the class OpenMeetingsManagerImpl method deleteGroupDataFor.

@Override
public boolean deleteGroupDataFor(BusinessGroup group) {
    boolean allOk = true;
    OpenMeetingsRoom room = getLocalRoom(group, null, null);
    if (room != null) {
        allOk &= deleteRoom(room);
    }
    return allOk;
}
Also used : OpenMeetingsRoom(org.olat.modules.openmeetings.model.OpenMeetingsRoom)

Example 13 with OpenMeetingsRoom

use of org.olat.modules.openmeetings.model.OpenMeetingsRoom in project openolat by klemens.

the class OpenMeetingsManagerImpl method getRoom.

@Override
public OpenMeetingsRoom getRoom(BusinessGroup group, OLATResourceable ores, String subIdentifier) throws OpenMeetingsException {
    OpenMeetingsRoomReference prop = openMeetingsDao.getReference(group, ores, subIdentifier);
    if (prop == null) {
        return null;
    }
    Long roomId = prop.getRoomId();
    if (roomId != null && roomId.longValue() > 0) {
        try {
            String sessionId = adminLogin();
            OpenMeetingsRoom room = openMeetingsDao.deserializeRoom(prop.getConfig());
            getRoomById(sessionId, room, roomId.longValue());
            return room;
        } catch (OpenMeetingsException e) {
            throw e;
        } catch (Exception e) {
            log.error("", e);
            throw translateException(e, 0);
        }
    }
    return null;
}
Also used : OpenMeetingsRoom(org.olat.modules.openmeetings.model.OpenMeetingsRoom) OpenMeetingsRoomReference(org.olat.modules.openmeetings.model.OpenMeetingsRoomReference) ConnectException(java.net.ConnectException)

Example 14 with OpenMeetingsRoom

use of org.olat.modules.openmeetings.model.OpenMeetingsRoom in project openolat by klemens.

the class OpenMeetingsManagerImpl method getLocalRoom.

@Override
public OpenMeetingsRoom getLocalRoom(BusinessGroup group, OLATResourceable ores, String subIdentifier) {
    OpenMeetingsRoomReference ref = openMeetingsDao.getReference(group, ores, subIdentifier);
    if (ref == null) {
        return null;
    }
    OpenMeetingsRoom room = openMeetingsDao.deserializeRoom(ref.getConfig());
    room.setReference(ref);
    return room;
}
Also used : OpenMeetingsRoom(org.olat.modules.openmeetings.model.OpenMeetingsRoom) OpenMeetingsRoomReference(org.olat.modules.openmeetings.model.OpenMeetingsRoomReference)

Example 15 with OpenMeetingsRoom

use of org.olat.modules.openmeetings.model.OpenMeetingsRoom in project openolat by klemens.

the class OpenMeetingsManagerImpl method getOpenOLATRooms.

@Override
public List<OpenMeetingsRoom> getOpenOLATRooms() {
    try {
        String adminSID = adminLogin();
        RoomServicePortType roomWs = getRoomWebService();
        GetRoomsWithCurrentUsersByListAndType getRooms = new GetRoomsWithCurrentUsersByListAndType();
        getRooms.setAsc(true);
        getRooms.setExternalRoomType(getOpenOLATExternalType());
        getRooms.setOrderby("name");
        getRooms.setStart(0);
        getRooms.setMax(2000);
        getRooms.setSID(adminSID);
        Map<Long, RoomReturnInfo> realRooms = new HashMap<Long, RoomReturnInfo>();
        // get rooms on openmeetings
        List<RoomReturn> roomsRet = roomWs.getRoomsWithCurrentUsersByListAndType(adminSID, 0, 2000, "name", true, getOpenOLATExternalType());
        if (roomsRet != null) {
            for (RoomReturn roomRet : roomsRet) {
                RoomReturnInfo info = new RoomReturnInfo();
                info.setName(roomRet.getName());
                info.setRoomId(roomRet.getRoomId());
                int numOfUsers = 0;
                if (roomRet.getRoomUser() != null) {
                    for (RoomUser user : roomRet.getRoomUser()) {
                        if (user != null) {
                            numOfUsers++;
                        }
                    }
                }
                info.setNumOfUsers(numOfUsers);
                realRooms.put(new Long(roomRet.getRoomId()), info);
            }
        }
        // get properties saved
        List<OpenMeetingsRoomReference> props = openMeetingsDao.getReferences();
        Map<Long, String> roomIdToResources = getResourceNames(props);
        List<OpenMeetingsRoom> rooms = new ArrayList<OpenMeetingsRoom>();
        for (OpenMeetingsRoomReference prop : props) {
            Long roomId = new Long(prop.getRoomId());
            RoomReturnInfo infos = realRooms.get(roomId);
            if (infos != null) {
                OpenMeetingsRoom room = openMeetingsDao.deserializeRoom(prop.getConfig());
                room.setReference(prop);
                room.setName(infos.getName());
                room.setNumOfUsers(infos.getNumOfUsers());
                String resourceName = roomIdToResources.get(roomId);
                if (resourceName != null) {
                    room.setResourceName(resourceName);
                }
                rooms.add(room);
            }
        }
        return rooms;
    } catch (Exception e) {
        log.error("", e);
        return null;
    }
}
Also used : RoomUser(org.apache.openmeetings.axis.services.xsd.RoomUser) OpenMeetingsRoom(org.olat.modules.openmeetings.model.OpenMeetingsRoom) GetRoomsWithCurrentUsersByListAndType(org.apache.openmeetings.axis.services.GetRoomsWithCurrentUsersByListAndType) RoomReturn(org.apache.openmeetings.axis.services.xsd.RoomReturn) HashMap(java.util.HashMap) OpenMeetingsRoomReference(org.olat.modules.openmeetings.model.OpenMeetingsRoomReference) ArrayList(java.util.ArrayList) ConnectException(java.net.ConnectException) RoomServicePortType(org.apache.openmeetings.axis.services.RoomServicePortType) RoomReturnInfo(org.olat.modules.openmeetings.model.RoomReturnInfo)

Aggregations

OpenMeetingsRoom (org.olat.modules.openmeetings.model.OpenMeetingsRoom)28 OpenMeetingsRoomReference (org.olat.modules.openmeetings.model.OpenMeetingsRoomReference)12 ConnectException (java.net.ConnectException)6 Test (org.junit.Test)6 OLATResourceable (org.olat.core.id.OLATResourceable)6 RoomServicePortType (org.apache.openmeetings.axis.services.RoomServicePortType)4 ModuleConfiguration (org.olat.modules.ModuleConfiguration)4 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 GetRoomsWithCurrentUsersByListAndType (org.apache.openmeetings.axis.services.GetRoomsWithCurrentUsersByListAndType)2 RoomReturn (org.apache.openmeetings.axis.services.xsd.RoomReturn)2 RoomUser (org.apache.openmeetings.axis.services.xsd.RoomUser)2 Room (org.apache.openmeetings.persistence.beans.room.xsd.Room)2 TableEvent (org.olat.core.gui.components.table.TableEvent)2 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)2 Condition (org.olat.course.condition.Condition)2 OpenMeetingsModule (org.olat.modules.openmeetings.OpenMeetingsModule)2 OpenMeetingsException (org.olat.modules.openmeetings.manager.OpenMeetingsException)2 OpenMeetingsManager (org.olat.modules.openmeetings.manager.OpenMeetingsManager)2 RoomReturnInfo (org.olat.modules.openmeetings.model.RoomReturnInfo)2