Search in sources :

Example 6 with BaseFileItem

use of org.apache.openmeetings.db.entity.file.BaseFileItem in project openmeetings by apache.

the class FileTreePanel method createFolder.

public void createFolder(AjaxRequestTarget target, String name) {
    BaseFileItem p = lastSelected;
    boolean isRecording = p instanceof Recording;
    BaseFileItem f = isRecording ? new Recording() : new FileItem();
    f.setName(name);
    f.setHash(UUID.randomUUID().toString());
    f.setInsertedBy(getUserId());
    f.setInserted(new Date());
    f.setType(Type.Folder);
    f.setOwnerId(p.getOwnerId());
    f.setGroupId(p.getGroupId());
    f.setRoomId(p.getRoomId());
    f.setParentId(Type.Folder == p.getType() ? p.getId() : null);
    if (isRecording) {
        recDao.update((Recording) f);
    } else {
        fileDao.update((FileItem) f);
    }
    update(target);
}
Also used : BaseFileItem(org.apache.openmeetings.db.entity.file.BaseFileItem) FileItem(org.apache.openmeetings.db.entity.file.FileItem) BaseFileItem(org.apache.openmeetings.db.entity.file.BaseFileItem) Recording(org.apache.openmeetings.db.entity.record.Recording) Date(java.util.Date)

Example 7 with BaseFileItem

use of org.apache.openmeetings.db.entity.file.BaseFileItem in project openmeetings by apache.

the class OmTreeProvider method getByParent.

public List<BaseFileItem> getByParent(BaseFileItem node, Long id) {
    List<BaseFileItem> list = new ArrayList<>();
    if (node instanceof Recording) {
        Recording rec = (Recording) node;
        List<Recording> _list;
        if (id == null) {
            if (node.getOwnerId() == null) {
                _list = recDao.getRootByPublic(rec.getGroupId());
            } else {
                _list = recDao.getRootByOwner(node.getOwnerId());
            }
        } else {
            _list = recDao.getByParent(id);
        }
        list.addAll(_list);
    } else {
        List<FileItem> _list;
        if (id == null) {
            if (node.getRoomId() != null) {
                _list = fileDao.getByRoom(node.getRoomId());
            } else if (node.getGroupId() != null) {
                _list = fileDao.getByGroup(node.getGroupId(), roomId == null ? VIDEO_TYPES : null);
            } else {
                _list = fileDao.getByOwner(node.getOwnerId());
            }
        } else {
            _list = fileDao.getByParent(id, roomId == null ? VIDEO_TYPES : null);
        }
        list.addAll(_list);
    }
    if (node.isReadOnly()) {
        for (BaseFileItem f : list) {
            f.setReadOnly(true);
        }
    }
    return list;
}
Also used : BaseFileItem(org.apache.openmeetings.db.entity.file.BaseFileItem) FileItem(org.apache.openmeetings.db.entity.file.FileItem) BaseFileItem(org.apache.openmeetings.db.entity.file.BaseFileItem) ArrayList(java.util.ArrayList) Recording(org.apache.openmeetings.db.entity.record.Recording)

Example 8 with BaseFileItem

use of org.apache.openmeetings.db.entity.file.BaseFileItem in project openmeetings by apache.

the class OmTreeProvider method createRoot.

static BaseFileItem createRoot(String name, String hash, boolean rec) {
    BaseFileItem f = rec ? new Recording() : new FileItem();
    f.setType(Type.Folder);
    f.setName(name);
    f.setHash(hash);
    return f;
}
Also used : BaseFileItem(org.apache.openmeetings.db.entity.file.BaseFileItem) FileItem(org.apache.openmeetings.db.entity.file.FileItem) BaseFileItem(org.apache.openmeetings.db.entity.file.BaseFileItem) Recording(org.apache.openmeetings.db.entity.record.Recording)

Example 9 with BaseFileItem

use of org.apache.openmeetings.db.entity.file.BaseFileItem in project openmeetings by apache.

the class ConvertingErrorsDialog method onOpen.

@Override
protected void onOpen(IPartialPageRequestHandler handler) {
    BaseFileItem f = getModelObject();
    setTitle(handler, Model.of(getString(f.getType() == BaseFileItem.Type.Recording ? "887" : "convert.errors.file")));
    List<FileItemLog> logs = fileLogDao.get(f);
    if (f.getHash() == null) {
        message.setVisible(true);
        message.setDefaultModelObject(getString("888"));
    } else if (!f.exists()) {
        message.setVisible(true);
        message.setDefaultModelObject(getString(f.getType() == BaseFileItem.Type.Recording ? "1595" : "convert.errors.file.missing"));
    } else {
        message.setVisible(false);
    }
    if (!logs.isEmpty()) {
        logView.setVisible(false);
        logView.setList(logs).setVisible(true);
    }
    handler.add(container);
    super.onOpen(handler);
}
Also used : BaseFileItem(org.apache.openmeetings.db.entity.file.BaseFileItem) FileItemLog(org.apache.openmeetings.db.entity.file.FileItemLog)

Example 10 with BaseFileItem

use of org.apache.openmeetings.db.entity.file.BaseFileItem in project openmeetings by apache.

the class RecordingsPanel method onInitialize.

@Override
protected void onInitialize() {
    final NameDialog addFolder = new NameDialog("addFolder", getString("712")) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onSubmit(AjaxRequestTarget target) {
            fileTree.createFolder(target, getModelObject());
        }
    };
    add(fileTree = new FileTreePanel("tree", null, addFolder, null) {

        private static final long serialVersionUID = 1L;

        @Override
        public void updateSizes() {
            RecordingContainerData sizeData = recDao.getContainerData(getUserId());
            if (sizeData != null) {
                homeSize.setObject(getHumanSize(sizeData.getUserHomeSize()));
                publicSize.setObject(getHumanSize(sizeData.getPublicFileSize()));
            }
        }

        @Override
        protected void update(AjaxRequestTarget target, BaseFileItem f) {
            video.update(target, f);
            info.update(target, f);
        }
    });
    add(video, info, addFolder);
    super.onInitialize();
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) BaseFileItem(org.apache.openmeetings.db.entity.file.BaseFileItem) NameDialog(org.apache.openmeetings.web.common.NameDialog) RecordingContainerData(org.apache.openmeetings.db.dto.record.RecordingContainerData) FileTreePanel(org.apache.openmeetings.web.common.tree.FileTreePanel)

Aggregations

BaseFileItem (org.apache.openmeetings.db.entity.file.BaseFileItem)18 FileItem (org.apache.openmeetings.db.entity.file.FileItem)7 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)7 ArrayList (java.util.ArrayList)6 RoomFile (org.apache.openmeetings.db.entity.room.RoomFile)4 JSONObject (com.github.openjson.JSONObject)3 File (java.io.File)3 List (java.util.List)3 Recording (org.apache.openmeetings.db.entity.record.Recording)3 JQueryBehavior (com.googlecode.wicket.jquery.core.JQueryBehavior)2 Droppable (com.googlecode.wicket.jquery.ui.interaction.droppable.Droppable)2 IOException (java.io.IOException)2 Arrays (java.util.Arrays)2 HashMap (java.util.HashMap)2 LinkedList (java.util.LinkedList)2 Map (java.util.Map)2 FileItemDao (org.apache.openmeetings.db.dao.file.FileItemDao)2 Whiteboard (org.apache.openmeetings.db.dto.room.Whiteboard)2 Client (org.apache.openmeetings.db.entity.basic.Client)2 Room (org.apache.openmeetings.db.entity.room.Room)2