@Override public void close() throws IOException { shutdown(); } }
@Override public void storeVisualization(RunningVisualization visualization) { CouchDbClient couchDbClient = couchDbClientSupplier.get(); couchDbClient.save(visualization); couchDbClient.shutdown(); }
@Override public void storeVirtualSensor(String username, VirtualSensor virtualSensor) { CouchDbClient couchDbClient = couchDbClientSupplier.get(); couchDbClient.save(virtualSensor); couchDbClient.shutdown(); }
public T execute() { CouchDbClient couchDbClient = couchDbClientSupplier.get(); T result = executeCommand(couchDbClient); couchDbClient.shutdown(); return result; } }
@GET @Produces(MediaType.APPLICATION_JSON) @GsonWithIds @Override public Response getAllData(@PathParam("table") String table) { CouchDbClient couchDbClient = Utils.getCoucbDbClient(table); List<JsonObject> result = couchDbClient.view("_all_docs").includeDocs(true).query(JsonObject.class); String json = new Gson().toJson(result); couchDbClient.shutdown(); return Response.ok(json).build(); } }
@Override public List<VirtualSensor> getVirtualSensors(String username) { CouchDbClient couchDbClient = couchDbClientSupplier.get(); List<VirtualSensor> virtualSensors = couchDbClient.view("_all_docs") .includeDocs(true) .query(VirtualSensor.class); couchDbClient.shutdown(); return virtualSensors; }
@Override public void deleteVisualization(String pipelineId) { try { CouchDbClient couchDbClient = couchDbClientSupplier.get(); List<RunningVisualization> currentVisualizations = getRunningVisualizations(); for (RunningVisualization viz : currentVisualizations) { if (viz.getPipelineId() != null) { if (viz.getPipelineId().equals(pipelineId)) couchDbClient.remove(viz); } } couchDbClient.shutdown(); } catch (NoDocumentException e) { e.printStackTrace(); } } }
public void removeSepaFromFavorites(String username, String elementId) { CouchDbClient dbClient = Utils.getCouchDbUserClient(); if (!checkUser(username)) return; User user = userStorage.getUser(username); user.removePreferredSepa(elementId); dbClient.update(user); dbClient.shutdown(); }
public void removeSourceFromFavorites(String username, String elementId) { CouchDbClient dbClient = Utils.getCouchDbUserClient(); if (!checkUser(username)) return; User user = userStorage.getUser(username); user.removePreferredSource(elementId); dbClient.update(user); dbClient.shutdown(); }
public void removeActionFromFavorites(String username, String elementId) { CouchDbClient dbClient = Utils.getCouchDbUserClient(); if (!checkUser(username)) return; User user = userStorage.getUser(username); user.removePreferredAction(elementId); dbClient.update(user); dbClient.shutdown(); }
public void removeActionFromFavorites(String username, String elementId) { CouchDbClient dbClient = Utils.getCouchDbUserClient(); if (!checkUser(username)) return; User user = userStorage.getUser(username); user.removePreferredAction(elementId); dbClient.update(user); dbClient.shutdown(); }
public void removeSepaFromFavorites(String username, String elementId) { CouchDbClient dbClient = Utils.getCouchDbUserClient(); if (!checkUser(username)) return; User user = userStorage.getUser(username); user.removePreferredSepa(elementId); dbClient.update(user); dbClient.shutdown(); }
public void removeSourceFromFavorites(String username, String elementId) { CouchDbClient dbClient = Utils.getCouchDbUserClient(); if (!checkUser(username)) return; User user = userStorage.getUser(username); user.removePreferredSource(elementId); dbClient.update(user); dbClient.shutdown(); }