protected static Blob jsonHelper(String status, String message, List<String> dependencies) { List<Map<String, Object>> result = new ArrayList<>(); Map<String, Object> resultJSON = new LinkedHashMap<>(); resultJSON.put("status", status); resultJSON.put("message", message); if (dependencies != null) { resultJSON.put("deps", dependencies); } result.add(resultJSON); try { return Blobs.createJSONBlobFromValue(result); } catch (IOException e) { throw new NuxeoException("Unable to create json response", e); } } }
@OperationMethod public Blob run(String nxql) throws IOException { checkAccess(); String commandId = submitBulkCommand(nxql, false); return Blobs.createJSONBlobFromValue(Collections.singletonMap("commandId", commandId)); }
return Blobs.createJSONBlobFromValue(result);
return Blobs.createJSONBlobFromValue(json);
@OperationMethod public Blob run() throws IOException { checkAccess(); esa.dropAndInitRepositoryIndex(session.getRepositoryName(), false); String commandId = submitBulkCommand("SELECT ecm:uuid FROM Document", true); log.warn(String.format("Submitted index command: %s to index the entire %s repository.", commandId, session.getRepositoryName())); return Blobs.createJSONBlobFromValue(Collections.singletonMap("commandId", commandId)); }
@OperationMethod public Blob run() throws IOException { List<Task> tasks = taskService.getCurrentTaskInstances(repo); if (tasks == null) { return null; } List<Map<String, Object>> rows = new ArrayList<>(); for (Task task : tasks) { DocumentModel doc = taskService.getTargetDocumentModel(task, repo); if (doc == null) { log.warn(String.format("User '%s' has a task of type '%s' on an " + "unexisting or invisible document", ctx.getPrincipal().getName(), task.getName())); continue; } DashBoardItem item = new DashBoardItemImpl(task, doc, null); Map<String, Object> obj = item.asMap(); rows.add(obj); } return Blobs.createJSONBlobFromValue(rows); }