Search in sources :

Example 1 with OpenMeetingsRoomReference

use of org.olat.modules.openmeetings.model.OpenMeetingsRoomReference in project OpenOLAT by OpenOLAT.

the class OpenMeetingsDAO method createReference.

public OpenMeetingsRoomReference createReference(final BusinessGroup group, final OLATResourceable courseResource, String subIdentifier, OpenMeetingsRoom room) {
    String serialized = serializeRoom(room);
    OpenMeetingsRoomReference ref = new OpenMeetingsRoomReference();
    ref.setLastModified(new Date());
    ref.setRoomId(room.getRoomId());
    ref.setConfig(serialized);
    ref.setGroup(group);
    if (courseResource != null) {
        ref.setResourceTypeName(courseResource.getResourceableTypeName());
        ref.setResourceTypeId(courseResource.getResourceableId());
    }
    ref.setSubIdentifier(subIdentifier);
    dbInstance.getCurrentEntityManager().persist(ref);
    return ref;
}
Also used : OpenMeetingsRoomReference(org.olat.modules.openmeetings.model.OpenMeetingsRoomReference) Date(java.util.Date)

Example 2 with OpenMeetingsRoomReference

use of org.olat.modules.openmeetings.model.OpenMeetingsRoomReference in project OpenOLAT by OpenOLAT.

the class OpenMeetingsDAO method updateReference.

public OpenMeetingsRoomReference updateReference(BusinessGroup group, OLATResourceable courseResource, String subIdentifier, OpenMeetingsRoom room) {
    OpenMeetingsRoomReference property = getReference(group, courseResource, subIdentifier);
    if (property == null) {
        property = createReference(group, courseResource, subIdentifier, room);
    } else {
        String serialized = serializeRoom(room);
        property.setLastModified(new Date());
        property.setConfig(serialized);
        property = dbInstance.getCurrentEntityManager().merge(property);
    }
    return property;
}
Also used : OpenMeetingsRoomReference(org.olat.modules.openmeetings.model.OpenMeetingsRoomReference) Date(java.util.Date)

Example 3 with OpenMeetingsRoomReference

use of org.olat.modules.openmeetings.model.OpenMeetingsRoomReference in project OpenOLAT by OpenOLAT.

the class OpenMeetingsManagerImpl method getResourceNames.

private Map<Long, String> getResourceNames(List<OpenMeetingsRoomReference> properties) {
    Map<Long, String> roomIdToResourceName = new HashMap<Long, String>();
    Map<Long, List<Long>> resourceIdToRoomIds = new HashMap<Long, List<Long>>();
    for (OpenMeetingsRoomReference prop : properties) {
        long roomId = prop.getRoomId();
        if (prop.getGroup() != null) {
            roomIdToResourceName.put(roomId, prop.getGroup().getName());
        } else if ("CourseModule".equals(prop.getResourceTypeName())) {
            if (!resourceIdToRoomIds.containsKey(prop.getResourceTypeId())) {
                resourceIdToRoomIds.put(prop.getResourceTypeId(), new ArrayList<Long>());
            }
            resourceIdToRoomIds.get(prop.getResourceTypeId()).add(roomId);
        }
    }
    if (!resourceIdToRoomIds.isEmpty()) {
        List<RepositoryEntryShortImpl> shortRepos = repositoryManager.loadRepositoryEntryShortsByResource(resourceIdToRoomIds.keySet(), "CourseModule");
        for (RepositoryEntryShortImpl repoEntry : shortRepos) {
            List<Long> roomIds = resourceIdToRoomIds.get(repoEntry.getOlatResource().getResourceableId());
            for (Long roomId : roomIds) {
                roomIdToResourceName.put(roomId, repoEntry.getDisplayname());
            }
        }
    }
    return roomIdToResourceName;
}
Also used : HashMap(java.util.HashMap) OpenMeetingsRoomReference(org.olat.modules.openmeetings.model.OpenMeetingsRoomReference) RepositoryEntryShortImpl(org.olat.repository.model.RepositoryEntryShortImpl) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List)

Example 4 with OpenMeetingsRoomReference

use of org.olat.modules.openmeetings.model.OpenMeetingsRoomReference in project OpenOLAT by OpenOLAT.

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 5 with OpenMeetingsRoomReference

use of org.olat.modules.openmeetings.model.OpenMeetingsRoomReference in project OpenOLAT by OpenOLAT.

the class OpenMeetingsAdminRoomsController method openResource.

protected void openResource(UserRequest ureq, OpenMeetingsRoom room) {
    OpenMeetingsRoomReference prop = room.getReference();
    if (prop != null) {
        String url;
        if (prop.getGroup() != null) {
            url = "[BusinessGroup:" + prop.getGroup().getKey() + "]";
        } else {
            OLATResourceable ores = OresHelper.createOLATResourceableInstance(prop.getResourceTypeName(), prop.getResourceTypeId());
            RepositoryEntry re = RepositoryManager.getInstance().lookupRepositoryEntry(ores, false);
            if (re != null) {
                url = "[RepositoryEntry:" + re.getKey() + "]";
                if (StringHelper.containsNonWhitespace(prop.getSubIdentifier()) && "CourseModule".equals(ores.getResourceableTypeName())) {
                    url += "[CourseNode:" + prop.getSubIdentifier() + "]";
                }
            } else {
                showWarning("resource.dont.exist");
                return;
            }
        }
        BusinessControl bc = BusinessControlFactory.getInstance().createFromString(url);
        WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(bc, getWindowControl());
        NewControllerFactory.getInstance().launch(ureq, bwControl);
    }
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) OpenMeetingsRoomReference(org.olat.modules.openmeetings.model.OpenMeetingsRoomReference) BusinessControl(org.olat.core.id.context.BusinessControl) RepositoryEntry(org.olat.repository.RepositoryEntry) WindowControl(org.olat.core.gui.control.WindowControl)

Aggregations

OpenMeetingsRoomReference (org.olat.modules.openmeetings.model.OpenMeetingsRoomReference)24 OpenMeetingsRoom (org.olat.modules.openmeetings.model.OpenMeetingsRoom)12 OLATResourceable (org.olat.core.id.OLATResourceable)8 ConnectException (java.net.ConnectException)6 Test (org.junit.Test)6 ArrayList (java.util.ArrayList)4 Date (java.util.Date)4 HashMap (java.util.HashMap)4 RoomServicePortType (org.apache.openmeetings.axis.services.RoomServicePortType)4 List (java.util.List)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 WindowControl (org.olat.core.gui.control.WindowControl)2 BusinessControl (org.olat.core.id.context.BusinessControl)2 RoomReturnInfo (org.olat.modules.openmeetings.model.RoomReturnInfo)2 RepositoryEntry (org.olat.repository.RepositoryEntry)2 RepositoryEntryShortImpl (org.olat.repository.model.RepositoryEntryShortImpl)2