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