Search in sources :

Example 1 with FileSystemItemManager

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

the class SharedSyncRootParentFactory 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 SharedSyncRootParentFolderItem(getName(), principal, topLevelFolder.getId(), topLevelFolder.getPath(), folderName);
}
Also used : FileSystemItemManager(org.nuxeo.drive.service.FileSystemItemManager) SharedSyncRootParentFolderItem(org.nuxeo.drive.hierarchy.permission.adapter.SharedSyncRootParentFolderItem) FolderItem(org.nuxeo.drive.adapter.FolderItem) NuxeoException(org.nuxeo.ecm.core.api.NuxeoException) SharedSyncRootParentFolderItem(org.nuxeo.drive.hierarchy.permission.adapter.SharedSyncRootParentFolderItem)

Example 2 with FileSystemItemManager

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

the class DefaultSyncRootFolderItemFactory method getParentItem.

/*------------------ AbstractSyncRootFolderItemFactory ------------------*/
@Override
protected FolderItem getParentItem(DocumentModel doc) {
    FileSystemItemManager fileSystemItemManager = Framework.getService(FileSystemItemManager.class);
    Principal principal = doc.getCoreSession().getPrincipal();
    return fileSystemItemManager.getTopLevelFolder(principal);
}
Also used : FileSystemItemManager(org.nuxeo.drive.service.FileSystemItemManager) Principal(java.security.Principal)

Example 3 with FileSystemItemManager

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

the class NuxeoDriveCreateFile method run.

@OperationMethod
public Blob run(Blob blob) throws ParseException, IOException {
    FileSystemItemManager fileSystemItemManager = Framework.getService(FileSystemItemManager.class);
    // correctly if there is non ascii characters in it.
    if (StringUtils.isNotBlank(name)) {
        blob.setFilename(name);
    }
    NuxeoDriveOperationHelper.normalizeMimeTypeAndEncoding(blob);
    FileItem fileItem = fileSystemItemManager.createFile(parentId, blob, ctx.getPrincipal(), overwrite);
    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 4 with FileSystemItemManager

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

the class NuxeoDriveRename method run.

@OperationMethod
public Blob run() throws InvalidOperationException, IOException {
    FileSystemItemManager fileSystemItemManager = Framework.getService(FileSystemItemManager.class);
    FileSystemItem fsItem;
    try {
        fsItem = fileSystemItemManager.rename(id, name, 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 5 with FileSystemItemManager

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

the class NuxeoDriveGetTopLevelFolder method run.

@OperationMethod
public Blob run() throws IOException {
    FileSystemItemManager fileSystemItemManager = Framework.getService(FileSystemItemManager.class);
    FolderItem topLevelFolder = fileSystemItemManager.getTopLevelFolder(ctx.getPrincipal());
    return Blobs.createJSONBlobFromValue(topLevelFolder);
}
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