Search in sources :

Example 1 with FileItem

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

the class FileItemDao method rename.

/**
 * @param id - id of file item to rename
 * @param name - new name
 *
 * @return renamed item
 */
public FileItem rename(Long id, String name) {
    log.debug("rename started");
    FileItem f = get(id);
    if (f == null) {
        return null;
    }
    f.setName(name);
    return update(f);
}
Also used : FileItem(org.apache.openmeetings.db.entity.file.FileItem) BaseFileItem(org.apache.openmeetings.db.entity.file.BaseFileItem)

Example 2 with FileItem

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

the class FileItemDTO method get.

public FileItem get() {
    FileItem f = new FileItem();
    f.setId(id);
    f.setName(name);
    f.setHash(hash);
    f.setParentId(parentId != null && parentId > 0 ? parentId : null);
    f.setRoomId(roomId != null && roomId > 0 ? roomId : null);
    f.setRoomId(groupId != null && groupId > 0 ? groupId : null);
    f.setOwnerId(ownerId != null && ownerId > 0 ? ownerId : null);
    f.setSize(size);
    f.setExternalId(externalId);
    f.setExternalType(externalType);
    f.setType(type);
    f.setWidth(width);
    f.setHeight(height);
    return f;
}
Also used : FileItem(org.apache.openmeetings.db.entity.file.FileItem)

Example 3 with FileItem

use of org.apache.openmeetings.db.entity.file.FileItem 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 4 with FileItem

use of org.apache.openmeetings.db.entity.file.FileItem 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 5 with FileItem

use of org.apache.openmeetings.db.entity.file.FileItem 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)

Aggregations

FileItem (org.apache.openmeetings.db.entity.file.FileItem)20 BaseFileItem (org.apache.openmeetings.db.entity.file.BaseFileItem)12 Path (javax.ws.rs.Path)4 ArrayList (java.util.ArrayList)3 Whiteboard (org.apache.openmeetings.db.dto.room.Whiteboard)3 Recording (org.apache.openmeetings.db.entity.record.Recording)3 ProcessResultList (org.apache.openmeetings.util.process.ProcessResultList)3 Serializer (org.simpleframework.xml.Serializer)3 Registry (org.simpleframework.xml.convert.Registry)3 RegistryStrategy (org.simpleframework.xml.convert.RegistryStrategy)3 Persister (org.simpleframework.xml.core.Persister)3 Strategy (org.simpleframework.xml.strategy.Strategy)3 File (java.io.File)2 WebMethod (javax.jws.WebMethod)2 DELETE (javax.ws.rs.DELETE)2 ServiceResult (org.apache.openmeetings.db.dto.basic.ServiceResult)2 FileItemDTO (org.apache.openmeetings.db.dto.file.FileItemDTO)2 RegistryMatcher (org.simpleframework.xml.transform.RegistryMatcher)2 JSONObject (com.github.openjson.JSONObject)1 FileInputStream (java.io.FileInputStream)1