Search in sources :

Example 6 with FileSystemItemManager

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

the class NuxeoDriveGetChildren method run.

@OperationMethod
public Blob run() throws IOException {
    FileSystemItemManager fileSystemItemManager = Framework.getService(FileSystemItemManager.class);
    List<FileSystemItem> children = fileSystemItemManager.getChildren(id, 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 7 with FileSystemItemManager

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

the class NuxeoDriveFileSystemItemExists method run.

@OperationMethod
public Blob run() throws IOException {
    FileSystemItemManager fileSystemItemManager = Framework.getService(FileSystemItemManager.class);
    boolean exists = fileSystemItemManager.exists(id, ctx.getPrincipal());
    return Blobs.createJSONBlobFromValue(exists);
}
Also used : FileSystemItemManager(org.nuxeo.drive.service.FileSystemItemManager) OperationMethod(org.nuxeo.ecm.automation.core.annotations.OperationMethod)

Example 8 with FileSystemItemManager

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

the class UserWorkspaceSyncRootParentFactory method getVirtualFolderItem.

@Override
public FolderItem getVirtualFolderItem(Principal principal) {
    FileSystemItemManager fileSystemItemManager = Framework.getService(FileSystemItemManager.class);
    FolderItem topLevelFolder = fileSystemItemManager.getTopLevelFolder(principal);
    if (topLevelFolder == null) {
        throw new NuxeoException("Found no top level folder item. Please check your contribution to the following extension point: <extension target=\"org.nuxeo.drive.service.FileSystemItemAdapterService\" point=\"topLevelFolderItemFactory\">.");
    }
    return new UserWorkspaceSyncRootParentFolderItem(getName(), principal, topLevelFolder.getId(), topLevelFolder.getPath(), folderName);
}
Also used : FileSystemItemManager(org.nuxeo.drive.service.FileSystemItemManager) UserWorkspaceSyncRootParentFolderItem(org.nuxeo.drive.hierarchy.userworkspace.adapter.UserWorkspaceSyncRootParentFolderItem) FolderItem(org.nuxeo.drive.adapter.FolderItem) UserWorkspaceSyncRootParentFolderItem(org.nuxeo.drive.hierarchy.userworkspace.adapter.UserWorkspaceSyncRootParentFolderItem) NuxeoException(org.nuxeo.ecm.core.api.NuxeoException)

Example 9 with FileSystemItemManager

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

the class NuxeoDriveMove method run.

@OperationMethod
public Blob run() throws InvalidOperationException, IOException {
    FileSystemItemManager fileSystemItemManager = Framework.getService(FileSystemItemManager.class);
    FileSystemItem fsItem;
    try {
        fsItem = fileSystemItemManager.move(srcId, destId, ctx.getPrincipal());
    } catch (UnsupportedOperationException e) {
        throw new InvalidOperationException(e);
    }
    return Blobs.createJSONBlobFromValue(fsItem);
}
Also used : FileSystemItemManager(org.nuxeo.drive.service.FileSystemItemManager) FileSystemItem(org.nuxeo.drive.adapter.FileSystemItem) InvalidOperationException(org.nuxeo.ecm.automation.InvalidOperationException) OperationMethod(org.nuxeo.ecm.automation.core.annotations.OperationMethod)

Example 10 with FileSystemItemManager

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

the class NuxeoDriveCanMove method run.

@OperationMethod
public Blob run() throws IOException {
    boolean canMove = false;
    try {
        FileSystemItemManager fileSystemItemManager = Framework.getService(FileSystemItemManager.class);
        canMove = fileSystemItemManager.canMove(srcId, destId, ctx.getPrincipal());
    } catch (RootlessItemException e) {
        // active sync root: just return false in that case.
        if (log.isDebugEnabled()) {
            log.debug(String.format("Cannot move %s to %s: %s", srcId, destId, e.getMessage()), e);
        }
    }
    return Blobs.createJSONBlobFromValue(canMove);
}
Also used : FileSystemItemManager(org.nuxeo.drive.service.FileSystemItemManager) RootlessItemException(org.nuxeo.drive.adapter.RootlessItemException) 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