use of org.apache.openmeetings.db.dto.room.Whiteboards in project openmeetings by apache.
the class WbPanel method internalWbLoad.
@Override
void internalWbLoad(StringBuilder sb) {
Long langId = rp.getClient().getUser().getLanguageId();
if (!wbm.contains(roomId) && rp.getRoom().getFiles() != null && !rp.getRoom().getFiles().isEmpty()) {
if (wbm.tryLock(roomId)) {
try {
TreeMap<Long, List<BaseFileItem>> files = new TreeMap<>();
for (RoomFile rf : rp.getRoom().getFiles()) {
List<BaseFileItem> bfl = files.get(rf.getWbIdx());
if (bfl == null) {
files.put(rf.getWbIdx(), new ArrayList<>());
bfl = files.get(rf.getWbIdx());
}
bfl.add(rf.getFile());
}
Whiteboards _wbs = wbm.get(roomId, langId);
for (Map.Entry<Long, List<BaseFileItem>> e : files.entrySet()) {
Whiteboard wb = wbm.add(roomId, langId);
_wbs.setActiveWb(wb.getId());
for (BaseFileItem fi : e.getValue()) {
sendFileToWb(fi, false);
}
}
} finally {
wbm.unlock(roomId);
}
}
}
Whiteboards wbs = wbm.get(roomId, langId);
loadWhiteboards(sb, rp.getClient(), wbs, wbm.list(roomId));
JSONObject wbj = getWbJson(wbs.getActiveWb());
sb.append("WbArea.activateWb(").append(wbj).append(");");
Whiteboard wb = wbs.get(wbs.getActiveWb());
if (wb != null) {
sb.append("WbArea.setSlide(").append(wbj.put(ATTR_SLIDE, wb.getSlide())).append(");");
}
sb.append("WbArea.loadVideos();");
}
use of org.apache.openmeetings.db.dto.room.Whiteboards in project openmeetings by apache.
the class CleanupJob method cleanRoomFiles.
public void cleanRoomFiles() {
log.trace("CleanupJob.cleanRoomFiles");
final long now = System.currentTimeMillis();
if (!isInitComplete()) {
return;
}
try {
File[] folders = getStreamsDir().listFiles(File::isDirectory);
if (folders == null) {
return;
}
for (File folder : folders) {
Long roomId = null;
if (NumberUtils.isCreatable(folder.getName())) {
roomId = Long.valueOf(folder.getName());
Whiteboards wbList = wbManager.get(roomId);
for (Map.Entry<Long, Whiteboard> e : wbList.getWhiteboards().entrySet()) {
if (!e.getValue().isEmpty()) {
roomId = null;
break;
}
}
}
if (roomId != null && streamClientManager.list(roomId).isEmpty()) {
File[] files = folder.listFiles(fi -> fi.isFile() && fi.lastModified() + roomFilesTtl < now);
if (files != null && files.length > 0) {
log.debug("Room files are too old and no users in the room: {}", roomId);
FileUtils.deleteDirectory(folder);
}
}
}
} catch (Exception e) {
log.error("Unexpected exception while processing tests setup videous.", e);
}
}
use of org.apache.openmeetings.db.dto.room.Whiteboards in project openmeetings by apache.
the class WhiteboardManager method clear.
public Whiteboard clear(long roomId, Long wbId) {
Whiteboards wbs = get(roomId);
Whiteboard wb = wbs.get(wbId);
if (wb != null) {
wb.clear();
update(wbs);
}
return wb;
}
use of org.apache.openmeetings.db.dto.room.Whiteboards in project openmeetings by apache.
the class WhiteboardManager method remove.
public Whiteboard remove(long roomId, Long wbId) {
Whiteboards wbs = get(roomId);
Whiteboard wb = wbs.getWhiteboards().remove(wbId);
update(wbs);
return wb;
}
use of org.apache.openmeetings.db.dto.room.Whiteboards in project openmeetings by apache.
the class WhiteboardManager method get.
public Whiteboards get(Long roomId, Long langId) {
if (roomId == null) {
return null;
}
Whiteboards wbs = onlineWbs.get(roomId);
if (wbs == null) {
wbs = new Whiteboards(roomId);
Whiteboard wb = add(wbs, langId);
wbs.setActiveWb(wb.getId());
update(wbs);
}
return wbs;
}
Aggregations