Java Code Examples for com.tinkerpop.blueprints.Vertex#removeProperty()
The following examples show how to use
com.tinkerpop.blueprints.Vertex#removeProperty() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractUserRule.java From light with Apache License 2.0 | 6 votes |
protected String activateUser(Map<String, Object> data) throws Exception { String email = (String)data.get("email"); String code = (String)data.get("code"); OrientGraph graph = ServiceLocator.getInstance().getGraph(); try { graph.begin(); Vertex user = graph.getVertexByKey("User.email", email); if(user != null) { String s = user.getProperty("code"); if(code.equals(s)) { user.removeProperty("code"); } } graph.commit(); } catch (Exception e) { logger.error("Exception:", e); graph.rollback(); throw e; } finally { graph.shutdown(); } return code; }
Example 2
Source File: AbstractUserRule.java From light with Apache License 2.0 | 6 votes |
protected void revokeRefreshToken(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) { Vertex credential = user.getProperty("credential"); if(credential != null) { credential.removeProperty("clientRefreshTokens"); } } graph.commit(); } catch (Exception e) { logger.error("Exception:", e); graph.rollback(); throw e; } finally { graph.shutdown(); } }
Example 3
Source File: TinkerGraphUtil.java From SciGraph with Apache License 2.0 | 5 votes |
public void project(Collection<String> projection) { if (projection.contains("*")) { return; } for (Vertex vertex : graph.getVertices()) { for (String key : vertex.getPropertyKeys()) { if (!projection.contains(key) && !PROTECTED_PROPERTY_KEYS.contains(key)) { vertex.removeProperty(key); } } } }
Example 4
Source File: AbstractRoleRule.java From light with Apache License 2.0 | 5 votes |
protected void updRole(Map<String, Object> data) throws Exception { OrientGraph graph = ServiceLocator.getInstance().getGraph(); try { graph.begin(); Vertex updateUser = graph.getVertexByKey("User.userId", data.remove("updateUserId")); Vertex role = graph.getVertexByKey("Role.roleId", data.get("roleId")); if(role != null) { String host = (String)data.get("host"); if(host != null && host.length() > 0) { if(!host.equals(role.getProperty("host"))) role.setProperty("host", host); } else { role.removeProperty("host"); } String description = (String)data.get("description"); if(description != null && !description.equals(role.getProperty("description"))) { role.setProperty("description", description); } role.setProperty("updateDate", data.get("updateDate")); updateUser.addEdge("Update", role); } graph.commit(); } catch (Exception e) { logger.error("Exception:", e); graph.rollback(); throw e; } finally { graph.shutdown(); } }
Example 5
Source File: AbstractRuleRule.java From light with Apache License 2.0 | 5 votes |
protected void updEtag(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) { rule.setProperty("enableEtag", data.get("enableEtag")); String cacheControl = (String)data.get("cacheControl"); if(cacheControl != null) { rule.setProperty("cacheControl", cacheControl); } else { rule.removeProperty("cacheControl"); } rule.setProperty("updateDate", data.get("updateDate")); Map<String, Object> ruleMap = ServiceLocator.getInstance().getMemoryImage("ruleMap"); ConcurrentMap<String, Map<String, Object>> cache = (ConcurrentMap<String, Map<String, Object>>)ruleMap.get("cache"); if(cache != null) { cache.remove(ruleClass); } } graph.commit(); } catch (Exception e) { logger.error("Exception:", e); graph.rollback(); throw e; } finally { graph.shutdown(); } }
Example 6
Source File: AbstractRuleRule.java From light with Apache License 2.0 | 5 votes |
protected void updSchema(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) { String schema = (String)data.get("schema"); if(schema != null && schema.length() > 0) { // convert it to map before setProperty. Map<String, Object> schemaMap = mapper.readValue(schema, new TypeReference<HashMap<String, Object>>() {}); rule.setProperty("schema", schemaMap); } else { rule.removeProperty("schema"); } rule.setProperty("updateDate", data.get("updateDate")); Map<String, Object> ruleMap = ServiceLocator.getInstance().getMemoryImage("ruleMap"); ConcurrentMap<String, Map<String, Object>> cache = (ConcurrentMap<String, Map<String, Object>>)ruleMap.get("cache"); if(cache != null) { cache.remove(ruleClass); } } graph.commit(); } catch (Exception e) { logger.error("Exception:", e); graph.rollback(); throw e; } finally { graph.shutdown(); } }
Example 7
Source File: AbstractRuleRule.java From light with Apache License 2.0 | 5 votes |
protected void updCors(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) { rule.setProperty("enableCors", data.get("enableCors")); String corsHosts = (String)data.get("corsHosts"); if(corsHosts != null) { rule.setProperty("corsHosts", corsHosts); } else { rule.removeProperty("corsHosts"); } rule.setProperty("updateDate", data.get("updateDate")); Map<String, Object> ruleMap = ServiceLocator.getInstance().getMemoryImage("ruleMap"); ConcurrentMap<String, Map<String, Object>> cache = (ConcurrentMap<String, Map<String, Object>>)ruleMap.get("cache"); if(cache != null) { cache.remove(ruleClass); } } graph.commit(); } catch (Exception e) { logger.error("Exception:", e); graph.rollback(); throw e; } finally { graph.shutdown(); } }
Example 8
Source File: AbstractConfigRule.java From light with Apache License 2.0 | 5 votes |
protected void updConfigDb(Map<String, Object> data) throws Exception { String configId = (String)data.get("configId"); OrientGraph graph = ServiceLocator.getInstance().getGraph(); try{ graph.begin(); Vertex updateUser = graph.getVertexByKey("User.userId", data.remove("updateUserId")); Vertex config = graph.getVertexByKey("Config.configId", configId); if(config != null) { if(data.get("description") != null) { config.setProperty("description", data.get("description")); } else { config.removeProperty("description"); } if(data.get("properties") != null) { config.setProperty("properties", data.get("properties")); } else { config.removeProperty("properties"); } config.setProperty("updateDate", data.get("updateDate")); // updateUser updateUser.addEdge("Update", config); } graph.commit(); } catch (Exception e) { logger.error("Exception:", e); graph.rollback(); } finally { graph.shutdown(); } }