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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations