use of org.nuxeo.drive.adapter.FileSystemItem in project nuxeo-drive-server by nuxeo.
the class FileSystemItemManagerImpl method move.
@Override
public FileSystemItem move(String srcId, String destId, Principal principal) {
FileSystemItem srcFsItem = getFileSystemItemById(srcId, principal);
if (srcFsItem == null) {
throw new NuxeoException(String.format("Cannot move file system item with id %s because it doesn't exist.", srcId));
}
FileSystemItem destFsItem = getFileSystemItemById(destId, principal);
if (destFsItem == null) {
throw new NuxeoException(String.format("Cannot move a file system item to file system item with id %s because it doesn't exist.", destId));
}
if (!(destFsItem instanceof FolderItem)) {
throw new NuxeoException(String.format("Cannot move a file system item to file system item with id %s because it is not a folder.", destId));
}
return srcFsItem.move((FolderItem) destFsItem);
}
use of org.nuxeo.drive.adapter.FileSystemItem in project nuxeo-drive-server by nuxeo.
the class FileSystemItemManagerImpl method scrollDescendants.
@Override
public ScrollFileSystemItemList scrollDescendants(String id, Principal principal, String scrollId, int batchSize, long keepAlive) {
FileSystemItem fileSystemItem = getFileSystemItemById(id, principal);
if (fileSystemItem == null) {
throw new NuxeoException(String.format("Cannot get the descendants of file system item with id %s because it doesn't exist.", id));
}
if (!(fileSystemItem instanceof FolderItem)) {
throw new NuxeoException(String.format("Cannot get the descendants of file system item with id %s because it is not a folder.", id));
}
FolderItem folderItem = (FolderItem) fileSystemItem;
return folderItem.scrollDescendants(scrollId, batchSize, keepAlive);
}
use of org.nuxeo.drive.adapter.FileSystemItem in project nuxeo-drive-server by nuxeo.
the class FileSystemItemManagerImpl method createFile.
@Override
public FileItem createFile(String parentId, Blob blob, Principal principal, boolean overwrite) {
FileSystemItem parentFsItem = getFileSystemItemById(parentId, principal);
if (parentFsItem == null) {
throw new NuxeoException(String.format("Cannot create a file in file system item with id %s because it doesn't exist.", parentId));
}
if (!(parentFsItem instanceof FolderItem)) {
throw new NuxeoException(String.format("Cannot create a file in file system item with id %s because it is not a folder but is: %s", parentId, parentFsItem));
}
FolderItem parentFolder = (FolderItem) parentFsItem;
return parentFolder.createFile(blob, overwrite);
}
use of org.nuxeo.drive.adapter.FileSystemItem in project nuxeo-drive-server by nuxeo.
the class FileSystemItemManagerImpl method getChildren.
@Override
public List<FileSystemItem> getChildren(String id, Principal principal) {
FileSystemItem fileSystemItem = getFileSystemItemById(id, principal);
if (fileSystemItem == null) {
throw new NuxeoException(String.format("Cannot get the children of file system item with id %s because it doesn't exist.", id));
}
if (!(fileSystemItem instanceof FolderItem)) {
throw new NuxeoException(String.format("Cannot get the children of file system item with id %s because it is not a folder.", id));
}
FolderItem folderItem = (FolderItem) fileSystemItem;
return folderItem.getChildren();
}
use of org.nuxeo.drive.adapter.FileSystemItem in project nuxeo-drive-server by nuxeo.
the class FileSystemItemManagerImpl method createFolder.
/*------------- Write operations ---------------*/
@Override
public FolderItem createFolder(String parentId, String name, Principal principal, boolean overwrite) {
FileSystemItem parentFsItem = getFileSystemItemById(parentId, principal);
if (parentFsItem == null) {
throw new NuxeoException(String.format("Cannot create a folder in file system item with id %s because it doesn't exist.", parentId));
}
if (!(parentFsItem instanceof FolderItem)) {
throw new NuxeoException(String.format("Cannot create a folder in file system item with id %s because it is not a folder but is: %s", parentId, parentFsItem));
}
FolderItem parentFolder = (FolderItem) parentFsItem;
return parentFolder.createFolder(name, overwrite);
}
Aggregations