public void ensurePropertiesExist(Map<String, PropertyType> columns) { for (Map.Entry<String, PropertyType> column : columns.entrySet()) { if (!this.properties.containsKey(column.getKey())) { Preconditions.checkState(!this.getSchema().isSqlgSchema(), "schema may not be %s", SQLG_SCHEMA); if (!this.uncommittedProperties.containsKey(column.getKey())) { this.getSchema().getTopology().lock(); if (!getProperty(column.getKey()).isPresent()) { TopologyManager.addEdgeColumn(this.sqlgGraph, this.getSchema().getName(), EDGE_PREFIX + getLabel(), column, new ListOrderedSet<>()); addColumn(this.getSchema().getName(), EDGE_PREFIX + getLabel(), ImmutablePair.of(column.getKey(), column.getValue())); PropertyColumn propertyColumn = new PropertyColumn(this, column.getKey(), column.getValue()); propertyColumn.setCommitted(false); this.uncommittedProperties.put(column.getKey(), propertyColumn); this.getSchema().getTopology().fire(propertyColumn, "", TopologyChangeAction.CREATE); } } } } }
public void ensurePropertiesExist(Map<String, PropertyType> columns) { for (Map.Entry<String, PropertyType> column : columns.entrySet()) { if (!this.properties.containsKey(column.getKey())) { Preconditions.checkState(!this.getSchema().isSqlgSchema(), "schema may not be %s", SQLG_SCHEMA); if (!this.uncommittedProperties.containsKey(column.getKey())) { this.getSchema().getTopology().lock(); if (!getProperty(column.getKey()).isPresent()) { TopologyManager.addEdgeColumn(this.sqlgGraph, this.getSchema().getName(), EDGE_PREFIX + getLabel(), column, new ListOrderedSet<>()); addColumn(this.getSchema().getName(), EDGE_PREFIX + getLabel(), ImmutablePair.of(column.getKey(), column.getValue())); PropertyColumn propertyColumn = new PropertyColumn(this, column.getKey(), column.getValue()); propertyColumn.setCommitted(false); this.uncommittedProperties.put(column.getKey(), propertyColumn); this.getSchema().getTopology().fire(propertyColumn, "", TopologyChangeAction.CREATE); } } } } }