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