protected void delBranchDb(String branchType, Map<String, Object> data) throws Exception { String className = branchType.substring(0, 1).toUpperCase() + branchType.substring(1); OrientGraph graph = ServiceLocator.getInstance().getGraph(); try{ graph.begin(); OrientVertex branch = getBranchByHostId(graph, branchType, (String)data.get("host"), (String)data.get("categoryId")); if(branch != null) { graph.removeVertex(branch); } graph.commit(); } catch (Exception e) { logger.error("Exception:", e); graph.rollback(); } finally { graph.shutdown(); } }
protected void delUser(Map<String, Object> data) throws Exception { OrientGraph graph = ServiceLocator.getInstance().getGraph(); try { graph.begin(); Vertex user = graph.getVertexByKey("User.userId", data.get("userId")); if(user != null) { graph.removeVertex(user.getProperty("credential")); graph.removeVertex(user); } } catch (Exception e) { logger.error("Exception:", e); graph.rollback(); throw e; } finally { graph.shutdown(); } }
protected void delHostConfigDb(Map<String, Object> data) throws Exception { OrientGraph graph = ServiceLocator.getInstance().getGraph(); try{ graph.begin(); OrientVertex config = getConfigByHostId(graph, (String)data.get("host"), (String)data.get("configId")); if(config != null) { graph.removeVertex(config); } graph.commit(); } catch (Exception e) { logger.error("Exception:", e); graph.rollback(); } finally { graph.shutdown(); } }
@Override protected void performMultiAction(AjaxRequestTarget target, List<ODocument> objects) { super.performMultiAction(target, objects); OrientGraph tx = orientGraphProvider.get(); for (ODocument doc : objects) { ORID id = doc.getIdentity(); tx.removeVertex(tx.getVertex(id)); } tx.commit();tx.begin(); sendActionPerformed(); }
protected void delAccess(Map<String, Object> data) throws Exception { OrientGraph graph = ServiceLocator.getInstance().getGraph(); try { graph.begin(); Vertex access = graph.getVertexByKey("Access.ruleClass", data.get("ruleClass")); if(access != null) { graph.removeVertex(access); } graph.commit(); } catch (Exception e) { logger.error("Exception:", e); graph.rollback(); throw e; } finally { graph.shutdown(); } Map<String, Object> accessMap = ServiceLocator.getInstance().getMemoryImage("accessMap"); ConcurrentMap<Object, Object> cache = (ConcurrentMap<Object, Object>)accessMap.get("cache"); if(cache != null) { cache.remove(data.get("ruleClass")); } }
protected void delMenu(Map<String, Object> data) throws Exception { String host = (String)data.get("host"); OrientGraph graph = ServiceLocator.getInstance().getGraph(); try { graph.begin(); Vertex menu = graph.getVertexByKey("Menu.host", host); if(menu != null) { // cascade deleting all menuItems belong to the host only. for (Vertex menuItem : graph.getVerticesOfClass("MenuItem")) { if(host.equals(menuItem.getProperty("host"))) { graph.removeVertex(menuItem); } } graph.removeVertex(menu); } graph.commit(); } catch (Exception e) { logger.error("Exception:", e); graph.rollback(); throw e; } finally { graph.shutdown(); } Map<String, Object> menuMap = ServiceLocator.getInstance().getMemoryImage("menuMap"); ConcurrentMap<Object, Object> cache = (ConcurrentMap<Object, Object>)menuMap.get("cache"); if(cache != null) { cache.remove(host); } }
protected void delConfigDb(Map<String, Object> data) throws Exception { OrientGraph graph = ServiceLocator.getInstance().getGraph(); try{ graph.begin(); Vertex config = graph.getVertexByKey("Config.configId", (String)data.get("configId")); if(config != null) { graph.removeVertex(config); } graph.commit(); } catch (Exception e) { logger.error("Exception:", e); graph.rollback(); } finally { graph.shutdown(); } }
protected void delMenuItem(Map<String, Object> data) throws Exception { OrientGraph graph = ServiceLocator.getInstance().getGraph(); try { graph.begin(); Vertex menuItem = graph.getVertexByKey("MenuItem.menuItemId",data.get("menuItemId")); if(menuItem != null) { graph.removeVertex(menuItem); } graph.commit(); } catch (Exception e) { logger.error("Exception:", e); graph.rollback(); throw e; } finally { graph.shutdown(); } // no need to refresh cache as there is no reference to this menuItem anywhere. }
protected void delRule(Map<String, Object> data) throws Exception { String ruleClass = (String)data.get("ruleClass"); OrientGraph graph = ServiceLocator.getInstance().getGraph(); try { graph.begin(); Vertex rule = graph.getVertexByKey("Rule.ruleClass", ruleClass); if(rule != null) { graph.removeVertex(rule); } graph.commit(); // check if the rule is in compile cache, remove it. Map<String, Object> compileMap = ServiceLocator.getInstance().getMemoryImage("compileMap"); ConcurrentMap<String, String> cache = (ConcurrentMap<String, String>)compileMap.get("cache"); if(cache != null) { cache.remove(ruleClass); } } catch (Exception e) { logger.error("Exception:", e); graph.rollback(); throw e; } finally { graph.shutdown(); } }
protected void delPostDb(String bfnType, Map<String, Object> data) throws Exception { OrientGraph graph = ServiceLocator.getInstance().getGraph(); try{ graph.begin(); OrientVertex post = (OrientVertex)graph.getVertexByKey("Post.entityId", data.get("entityId")); if(post != null) { // TODO cascade deleting all comments belong to the post. // Need to come up a query on that to get the entire tree. /* // https://github.com/orientechnologies/orientdb/issues/1108 delete graph... */ // TODO remove tags edge. Do I need to? graph.removeVertex(post); } graph.commit(); } catch (Exception e) { logger.error("Exception:", e); graph.rollback(); } finally { graph.shutdown(); } }
protected void delProductDb(Map<String, Object> data) throws Exception { String className = "Catalog"; String id = "categoryId"; String index = className + "." + id; OrientGraph graph = ServiceLocator.getInstance().getGraph(); try{ graph.begin(); OrientVertex product = (OrientVertex)graph.getVertexByKey("Product.entityId", data.get("entityId")); if(product != null) { // TODO cascade deleting all comments belong to the product. // Need to come up a query on that to get the entire tree. /* // https://github.com/orientechnologies/orientdb/issues/1108 delete graph... */ graph.removeVertex(product); } graph.commit(); } catch (Exception e) { logger.error("Exception:", e); graph.rollback(); } finally { graph.shutdown(); } }
public static Vertex delVertexByRid(String rid) throws Exception { Vertex v = null; OrientGraph graph = ServiceLocator.getInstance().getGraph(); try { graph.begin(); v = graph.getVertex(rid); graph.removeVertex(v); graph.commit(); } catch (Exception e) { graph.rollback(); logger.error("Exception:", e); throw e; } finally { graph.shutdown(); } return v; }
protected void delPage(String pageId) { OrientGraph graph = ServiceLocator.getInstance().getGraph(); try { graph.begin(); Vertex page = graph.getVertexByKey("Page.pageId", pageId); if(page != null) { graph.removeVertex(page); } graph.commit(); } catch (Exception e) { logger.error("Exception:", e); graph.rollback(); throw e; } finally { graph.shutdown(); } Map<String, Object> pageMap = ServiceLocator.getInstance().getMemoryImage("pageMap"); ConcurrentMap<Object, Object> cache = (ConcurrentMap<Object, Object>)pageMap.get("cache"); if(cache != null) { cache.remove(pageId); } }
protected void delRole(String roleId) throws Exception { OrientGraph graph = ServiceLocator.getInstance().getGraph(); try { graph.begin(); Vertex role = graph.getVertexByKey("Role.roleId", roleId); if(role != null) { graph.removeVertex(role); } graph.commit(); } catch (Exception e) { logger.error("Exception:", e); graph.rollback(); throw e; } finally { graph.shutdown(); } }
protected void delComment(Map<String, Object> data) throws Exception { OrientGraph graph = ServiceLocator.getInstance().getGraph(); try{ graph.begin(); String commentId = (String)data.get("commentId"); OrientVertex comment = (OrientVertex)graph.getVertexByKey("Comment.commentId", commentId); // remove the edge to this comment for (Edge edge : comment.getEdges(Direction.IN)) { graph.removeEdge(edge); } graph.removeVertex(comment); graph.commit(); } catch (Exception e) { logger.error("Exception:", e); graph.rollback(); } finally { graph.shutdown(); } }
OrientVertex form = (OrientVertex)graph.getVertexByKey("Form.formId", formId); if(form != null) { graph.removeVertex(form);
graph.removeVertex(form);
OrientVertex page = (OrientVertex)graph.getVertexByKey("Page.pageId", pageId); if(page != null) { graph.removeVertex(page);
graph.removeVertex(rule);