use of org.nuxeo.ecm.automation.core.annotations.OperationMethod in project nuxeo-drive-server by nuxeo.
the class NuxeoDriveGetChildren method run.
@OperationMethod
public Blob run() throws IOException {
FileSystemItemManager fileSystemItemManager = Framework.getService(FileSystemItemManager.class);
List<FileSystemItem> children = fileSystemItemManager.getChildren(id, ctx.getPrincipal());
return Blobs.createJSONBlobFromValue(children);
}
use of org.nuxeo.ecm.automation.core.annotations.OperationMethod in project nuxeo-drive-server by nuxeo.
the class NuxeoDriveFileSystemItemExists method run.
@OperationMethod
public Blob run() throws IOException {
FileSystemItemManager fileSystemItemManager = Framework.getService(FileSystemItemManager.class);
boolean exists = fileSystemItemManager.exists(id, ctx.getPrincipal());
return Blobs.createJSONBlobFromValue(exists);
}
use of org.nuxeo.ecm.automation.core.annotations.OperationMethod in project nuxeo-drive-server by nuxeo.
the class NuxeoDriveGetChangeSummary method run.
@OperationMethod
public Blob run() throws IOException {
NuxeoDriveManager driveManager = Framework.getService(NuxeoDriveManager.class);
Map<String, Set<IdRef>> lastActiveRootRefs = RootDefinitionsHelper.parseRootDefinitions(lastSyncActiveRootDefinitions);
FileSystemChangeSummary docChangeSummary;
if (lastSyncDate >= 0) {
docChangeSummary = driveManager.getChangeSummary(ctx.getPrincipal(), lastActiveRootRefs, lastSyncDate);
} else {
docChangeSummary = driveManager.getChangeSummaryIntegerBounds(ctx.getPrincipal(), lastActiveRootRefs, lowerBound);
}
return Blobs.createJSONBlobFromValue(docChangeSummary);
}
use of org.nuxeo.ecm.automation.core.annotations.OperationMethod 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);
}
use of org.nuxeo.ecm.automation.core.annotations.OperationMethod in project nuxeo-drive-server by nuxeo.
the class NuxeoDriveCreateTestDocuments method run.
@OperationMethod
public Blob run(DocumentModel parent) throws Exception {
NuxeoDriveIntegrationTestsHelper.checkOperationAllowed();
FileManager fileManager = Framework.getService(FileManager.class);
for (int i = 0; i < number; i++) {
String name = String.format(namePattern, i);
Blob content = new StringBlob(String.format(contentPattern, i));
content.setFilename(name);
fileManager.createDocumentFromBlob(session, content, parent.getPathAsString(), false, name);
if (delay > 0) {
Thread.sleep(delay);
}
}
return new StringBlob(number.toString(), "text/plain");
}
Aggregations