use of org.apache.openmeetings.db.entity.file.FileItem in project openmeetings by apache.
the class WbPanel method saveWb.
public String saveWb(Long roomId, Long wbId, String name) {
Whiteboard wb = wbm.get(roomId).get(wbId);
FileItem f = new FileItem();
f.setType(BaseFileItem.Type.WmlFile);
f.setRoomId(roomId);
f.setHash(UUID.randomUUID().toString());
f.setName(name);
f = fileDao.update(f);
return wb.save(f.getFile().toPath());
}
use of org.apache.openmeetings.db.entity.file.FileItem in project openmeetings by apache.
the class BackupExport method exportFile.
/*
* ##################### File-Explorer
*/
private void exportFile(ZipOutputStream zos, ProgressHolder progressHolder) throws Exception {
List<FileItem> list = fileItemDao.get();
Registry registry = new Registry();
Strategy strategy = new RegistryStrategy(registry);
Serializer serializer = new Persister(strategy);
bindDate(registry, list);
writeList(serializer, zos, "fileExplorerItems.xml", "fileExplorerItems", list);
progressHolder.setProgress(65);
}
use of org.apache.openmeetings.db.entity.file.FileItem in project openmeetings by apache.
the class FileWebService method delete.
/**
* deletes files or folders based on it id
*
* @param sid
* The SID of the User. This SID must be marked as logged in
* @param id
* the id of the file or folder
* @return {@link ServiceResult} with result type
*/
@DELETE
@Path("/{id}")
public ServiceResult delete(@QueryParam("sid") @WebParam(name = "sid") String sid, @PathParam("id") @WebParam(name = "id") Long id) {
FileItem f = fileDao.get(id);
return performCall(sid, sd -> {
Long userId = sd.getUserId();
Set<Right> rights = getRights(userId);
return AuthLevelUtil.hasWebServiceLevel(rights) || (AuthLevelUtil.hasUserLevel(rights) && userId.equals(f.getOwnerId()));
}, sd -> {
if (f == null) {
return new ServiceResult("Bad id", Type.ERROR);
}
fileDao.delete(f);
return new ServiceResult("Deleted", Type.SUCCESS);
});
}
use of org.apache.openmeetings.db.entity.file.FileItem in project openmeetings by apache.
the class FileWebService method deleteExternal.
/**
* deletes a file by its external Id and type
*
* @param sid
* The SID of the User. This SID must be marked as logged in
* @param externalId
* the od of the file or folder
* @param externalType
* the externalType
* @return {@link ServiceResult} with result type
*/
@DELETE
@Path("/{externaltype}/{externalid}")
public ServiceResult deleteExternal(@WebParam(name = "sid") @QueryParam("sid") String sid, @WebParam(name = "externaltype") @PathParam("externaltype") String externalType, @WebParam(name = "externalid") @PathParam("externalid") String externalId) {
return performCall(sid, User.Right.Soap, sd -> {
FileItem f = fileDao.get(externalId, externalType);
fileDao.delete(f);
return new ServiceResult("Deleted", Type.SUCCESS);
});
}
use of org.apache.openmeetings.db.entity.file.FileItem in project openmeetings by apache.
the class FileWebService method getRoom.
/**
* Get a File Explorer Object by a given Room
*
* @param sid
* The SID of the User. This SID must be marked as logged in
* @param roomId
* Room Id
* @return - File Explorer Object by a given Room
*/
@WebMethod
@GET
@Path("/room/{id}")
public FileExplorerObject getRoom(@WebParam(name = "sid") @QueryParam("sid") String sid, @WebParam(name = "id") @PathParam("id") long roomId) {
log.debug("getRoom::roomId {}", roomId);
return performCall(sid, User.Right.Room, sd -> {
FileExplorerObject fileExplorerObject = new FileExplorerObject();
// Home File List
List<FileItem> fList = fileDao.getByOwner(sd.getUserId());
fileExplorerObject.setUser(fList, fileDao.getSize(fList));
// Public File List
List<FileItem> rList = fileDao.getByRoom(roomId);
fileExplorerObject.setRoom(rList, fileDao.getSize(rList));
return fileExplorerObject;
});
}
Aggregations