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