Search in sources :

Example 1 with InvalidOperationException

use of org.nuxeo.ecm.automation.InvalidOperationException 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 2 with InvalidOperationException

use of org.nuxeo.ecm.automation.InvalidOperationException 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)

Aggregations

FileSystemItem (org.nuxeo.drive.adapter.FileSystemItem)2 FileSystemItemManager (org.nuxeo.drive.service.FileSystemItemManager)2 InvalidOperationException (org.nuxeo.ecm.automation.InvalidOperationException)2 OperationMethod (org.nuxeo.ecm.automation.core.annotations.OperationMethod)2