Search in sources :

Example 11 with OperationMethod

use of org.nuxeo.ecm.automation.core.annotations.OperationMethod in project nuxeo-drive-server by nuxeo.

the class NuxeoDriveSetVersioningOptions method run.

@OperationMethod
public void run() {
    NuxeoDriveIntegrationTestsHelper.checkOperationAllowed();
    FileSystemItemAdapterService fileSystemItemAdapterService = Framework.getService(FileSystemItemAdapterService.class);
    VersioningFileSystemItemFactory defaultFileSystemItemFactory = (VersioningFileSystemItemFactory) ((FileSystemItemAdapterServiceImpl) fileSystemItemAdapterService).getFileSystemItemFactory("defaultFileSystemItemFactory");
    if (delay != null) {
        defaultFileSystemItemFactory.setVersioningDelay(Double.parseDouble(delay));
    }
    if (option != null) {
        defaultFileSystemItemFactory.setVersioningOption(VersioningOption.valueOf(option));
    }
}
Also used : FileSystemItemAdapterService(org.nuxeo.drive.service.FileSystemItemAdapterService) VersioningFileSystemItemFactory(org.nuxeo.drive.service.VersioningFileSystemItemFactory) OperationMethod(org.nuxeo.ecm.automation.core.annotations.OperationMethod)

Example 12 with OperationMethod

use of org.nuxeo.ecm.automation.core.annotations.OperationMethod in project nuxeo-drive-server by nuxeo.

the class NuxeoDriveAddToLocallyEditedCollection method run.

@OperationMethod
public DocumentModel run(DocumentModel doc) {
    NuxeoDriveManager nuxeoDriveManager = Framework.getService(NuxeoDriveManager.class);
    nuxeoDriveManager.addToLocallyEditedCollection(session, doc);
    return doc;
}
Also used : NuxeoDriveManager(org.nuxeo.drive.service.NuxeoDriveManager) OperationMethod(org.nuxeo.ecm.automation.core.annotations.OperationMethod)

Example 13 with OperationMethod

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

Example 14 with OperationMethod

use of org.nuxeo.ecm.automation.core.annotations.OperationMethod 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 15 with OperationMethod

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

Aggregations

OperationMethod (org.nuxeo.ecm.automation.core.annotations.OperationMethod)20 FileSystemItemManager (org.nuxeo.drive.service.FileSystemItemManager)12 FileSystemItem (org.nuxeo.drive.adapter.FileSystemItem)5 NuxeoDriveManager (org.nuxeo.drive.service.NuxeoDriveManager)3 FileItem (org.nuxeo.drive.adapter.FileItem)2 FolderItem (org.nuxeo.drive.adapter.FolderItem)2 FileSystemItemAdapterService (org.nuxeo.drive.service.FileSystemItemAdapterService)2 InvalidOperationException (org.nuxeo.ecm.automation.InvalidOperationException)2 URL (java.net.URL)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Calendar (java.util.Calendar)1 Map (java.util.Map)1 Set (java.util.Set)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 RootlessItemException (org.nuxeo.drive.adapter.RootlessItemException)1 ScrollFileSystemItemList (org.nuxeo.drive.adapter.ScrollFileSystemItemList)1 FileSystemChangeSummary (org.nuxeo.drive.service.FileSystemChangeSummary)1 SynchronizationRoots (org.nuxeo.drive.service.SynchronizationRoots)1 VersioningFileSystemItemFactory (org.nuxeo.drive.service.VersioningFileSystemItemFactory)1 FileSystemItemAdapterServiceImpl (org.nuxeo.drive.service.impl.FileSystemItemAdapterServiceImpl)1