Search in sources :

Example 11 with FileSystemItemManager

use of org.nuxeo.drive.service.FileSystemItemManager in project nuxeo-drive-server by nuxeo.

the class NuxeoDriveScrollDescendants method run.

@OperationMethod
public Blob run() throws IOException {
    FileSystemItemManager fileSystemItemManager = Framework.getService(FileSystemItemManager.class);
    ScrollFileSystemItemList descendants = fileSystemItemManager.scrollDescendants(id, ctx.getPrincipal(), scrollId, batchSize, keepAlive);
    return writeJSONBlob(descendants);
}
Also used : ScrollFileSystemItemList(org.nuxeo.drive.adapter.ScrollFileSystemItemList) FileSystemItemManager(org.nuxeo.drive.service.FileSystemItemManager) OperationMethod(org.nuxeo.ecm.automation.core.annotations.OperationMethod)

Example 12 with FileSystemItemManager

use of org.nuxeo.drive.service.FileSystemItemManager in project nuxeo-drive-server by nuxeo.

the class NuxeoDriveUpdateFile method run.

@OperationMethod
public Blob run(Blob blob) throws ParseException, IOException {
    FileSystemItemManager fileSystemItemManager = Framework.getService(FileSystemItemManager.class);
    NuxeoDriveOperationHelper.normalizeMimeTypeAndEncoding(blob);
    FileItem fileItem;
    if (parentId == null) {
        fileItem = fileSystemItemManager.updateFile(id, blob, ctx.getPrincipal());
    } else {
        fileItem = fileSystemItemManager.updateFile(id, parentId, blob, ctx.getPrincipal());
    }
    return Blobs.createJSONBlobFromValue(fileItem);
}
Also used : FileItem(org.nuxeo.drive.adapter.FileItem) FileSystemItemManager(org.nuxeo.drive.service.FileSystemItemManager) OperationMethod(org.nuxeo.ecm.automation.core.annotations.OperationMethod)

Example 13 with FileSystemItemManager

use of org.nuxeo.drive.service.FileSystemItemManager in project nuxeo-drive-server by nuxeo.

the class NuxeoDriveGetFileSystemItem method run.

@OperationMethod
public Blob run() throws IOException {
    FileSystemItemManager fileSystemItemManager = Framework.getService(FileSystemItemManager.class);
    FileSystemItem fsItem;
    if (parentId == null) {
        fsItem = fileSystemItemManager.getFileSystemItemById(id, ctx.getPrincipal());
    } else {
        fsItem = fileSystemItemManager.getFileSystemItemById(id, parentId, ctx.getPrincipal());
    }
    return Blobs.createJSONBlobFromValue(fsItem);
}
Also used : FileSystemItemManager(org.nuxeo.drive.service.FileSystemItemManager) FileSystemItem(org.nuxeo.drive.adapter.FileSystemItem) OperationMethod(org.nuxeo.ecm.automation.core.annotations.OperationMethod)

Example 14 with FileSystemItemManager

use of org.nuxeo.drive.service.FileSystemItemManager in project nuxeo-drive-server by nuxeo.

the class NuxeoDriveGetTopLevelChildren method run.

@OperationMethod
public Blob run() throws IOException {
    FileSystemItemManager fileSystemItemManager = Framework.getService(FileSystemItemManager.class);
    List<FileSystemItem> children = fileSystemItemManager.getTopLevelChildren(ctx.getPrincipal());
    return Blobs.createJSONBlobFromValue(children);
}
Also used : FileSystemItemManager(org.nuxeo.drive.service.FileSystemItemManager) FileSystemItem(org.nuxeo.drive.adapter.FileSystemItem) OperationMethod(org.nuxeo.ecm.automation.core.annotations.OperationMethod)

Example 15 with FileSystemItemManager

use of org.nuxeo.drive.service.FileSystemItemManager in project nuxeo-drive-server by nuxeo.

the class NuxeoDriveCreateFolder method run.

@OperationMethod
public Blob run() throws IOException {
    FileSystemItemManager fileSystemItemManager = Framework.getService(FileSystemItemManager.class);
    FolderItem folderItem = fileSystemItemManager.createFolder(parentId, name, ctx.getPrincipal(), overwrite);
    return Blobs.createJSONBlobFromValue(folderItem);
}
Also used : FileSystemItemManager(org.nuxeo.drive.service.FileSystemItemManager) FolderItem(org.nuxeo.drive.adapter.FolderItem) OperationMethod(org.nuxeo.ecm.automation.core.annotations.OperationMethod)

Aggregations

FileSystemItemManager (org.nuxeo.drive.service.FileSystemItemManager)15 OperationMethod (org.nuxeo.ecm.automation.core.annotations.OperationMethod)12 FileSystemItem (org.nuxeo.drive.adapter.FileSystemItem)5 FolderItem (org.nuxeo.drive.adapter.FolderItem)4 FileItem (org.nuxeo.drive.adapter.FileItem)2 InvalidOperationException (org.nuxeo.ecm.automation.InvalidOperationException)2 NuxeoException (org.nuxeo.ecm.core.api.NuxeoException)2 Principal (java.security.Principal)1 RootlessItemException (org.nuxeo.drive.adapter.RootlessItemException)1 ScrollFileSystemItemList (org.nuxeo.drive.adapter.ScrollFileSystemItemList)1 SharedSyncRootParentFolderItem (org.nuxeo.drive.hierarchy.permission.adapter.SharedSyncRootParentFolderItem)1 UserWorkspaceSyncRootParentFolderItem (org.nuxeo.drive.hierarchy.userworkspace.adapter.UserWorkspaceSyncRootParentFolderItem)1