Search in sources :

Example 11 with Whiteboard

use of org.apache.openmeetings.db.dto.room.Whiteboard in project openmeetings by apache.

the class WbPanel method clearAll.

private void clearAll(Long roomId, long wbId) {
    Whiteboard wb = wbm.get(roomId).get(wbId);
    if (wb == null) {
        return;
    }
    JSONArray arr = getArray(wb.toJson(), null);
    if (arr.length() != 0) {
        addUndo(wb.getId(), new UndoObject(UndoObject.Type.remove, arr));
    }
    wb = wbm.clear(roomId, wbId);
    sendWbAll(WbAction.clearAll, new JSONObject().put("wbId", wbId));
    sendWbAll(WbAction.setSize, getAddWbJson(wb));
}
Also used : JSONObject(com.github.openjson.JSONObject) JSONArray(com.github.openjson.JSONArray) Whiteboard(org.apache.openmeetings.db.dto.room.Whiteboard)

Example 12 with Whiteboard

use of org.apache.openmeetings.db.dto.room.Whiteboard 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);
    }
}
Also used : Whiteboards(org.apache.openmeetings.db.dto.room.Whiteboards) File(java.io.File) Map(java.util.Map) Whiteboard(org.apache.openmeetings.db.dto.room.Whiteboard)

Example 13 with Whiteboard

use of org.apache.openmeetings.db.dto.room.Whiteboard 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;
}
Also used : Whiteboards(org.apache.openmeetings.db.dto.room.Whiteboards) Whiteboard(org.apache.openmeetings.db.dto.room.Whiteboard)

Example 14 with Whiteboard

use of org.apache.openmeetings.db.dto.room.Whiteboard 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;
}
Also used : Whiteboards(org.apache.openmeetings.db.dto.room.Whiteboards) Whiteboard(org.apache.openmeetings.db.dto.room.Whiteboard)

Example 15 with Whiteboard

use of org.apache.openmeetings.db.dto.room.Whiteboard 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;
}
Also used : Whiteboards(org.apache.openmeetings.db.dto.room.Whiteboards) Whiteboard(org.apache.openmeetings.db.dto.room.Whiteboard)

Aggregations

Whiteboard (org.apache.openmeetings.db.dto.room.Whiteboard)16 Whiteboards (org.apache.openmeetings.db.dto.room.Whiteboards)8 JSONObject (com.github.openjson.JSONObject)7 JSONArray (com.github.openjson.JSONArray)4 Client (org.apache.openmeetings.db.entity.basic.Client)4 File (java.io.File)3 ArrayList (java.util.ArrayList)3 List (java.util.List)3 Map (java.util.Map)3 BaseFileItem (org.apache.openmeetings.db.entity.file.BaseFileItem)3 FileItem (org.apache.openmeetings.db.entity.file.FileItem)3 BufferedImage (java.awt.image.BufferedImage)2 ByteArrayInputStream (java.io.ByteArrayInputStream)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 IOException (java.io.IOException)2 HashMap (java.util.HashMap)2 LinkedList (java.util.LinkedList)2 Entry (java.util.Map.Entry)2 TreeMap (java.util.TreeMap)2 Room (org.apache.openmeetings.db.entity.room.Room)2