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;
}
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;
}
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;
}
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;
}
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);
}
}
Aggregations