@Override public boolean isInBatchMode() { return this.sqlG.tx().isInBatchMode(); }
public void flush() { if (!this.isInBatchMode()) { throw new IllegalStateException("Transaction must be in batch mode to flush"); } logger.debug("flushing transaction!!!"); if (!this.getBatchManager().isBusyFlushing()) { this.getBatchManager().flush(); } }
public void flush() { if (!this.isInBatchMode()) { throw new IllegalStateException("Transaction must be in batch mode to flush"); } logger.debug("flushing transaction!!!"); if (!this.getBatchManager().isBusyFlushing()) { this.getBatchManager().flush(); } }
private void insertEdge(boolean complete, Pair<Map<String, Object>, Map<String, Object>> keyValueMapPair) throws SQLException { Map<String, Object> allKeyValueMap = keyValueMapPair.getLeft(); Map<String, Object> notNullKeyValueMap = keyValueMapPair.getRight(); if (this.sqlgGraph.features().supportsBatchMode() && this.sqlgGraph.tx().isInBatchMode()) { internalBatchAddEdge(complete, allKeyValueMap); } else { internalAddEdge(notNullKeyValueMap); } //Cache the properties this.properties.putAll(notNullKeyValueMap); }
private void insertVertex(boolean temporary, boolean streaming, Pair<Map<String, Object>, Map<String, Object>> keyValueMapPair) { Map<String, Object> keyAllValueMap = keyValueMapPair.getLeft(); Map<String, Object> keyNotNullValueMap = keyValueMapPair.getRight(); if (this.sqlgGraph.getSqlDialect().supportsBatchMode() && this.sqlgGraph.tx().isInBatchMode()) { internalBatchAddVertex(temporary, streaming, keyAllValueMap); } else { internalAddVertex(temporary, keyNotNullValueMap); } //Cache the properties this.properties.putAll(keyNotNullValueMap); }
private void insertVertex(boolean temporary, boolean streaming, Pair<Map<String, Object>, Map<String, Object>> keyValueMapPair) { Map<String, Object> keyAllValueMap = keyValueMapPair.getLeft(); Map<String, Object> keyNotNullValueMap = keyValueMapPair.getRight(); if (this.sqlgGraph.getSqlDialect().supportsBatchMode() && this.sqlgGraph.tx().isInBatchMode()) { internalBatchAddVertex(temporary, streaming, keyAllValueMap); } else { internalAddVertex(temporary, keyNotNullValueMap); } //Cache the properties this.properties.putAll(keyNotNullValueMap); }
private void insertEdge(boolean complete, Pair<Map<String, Object>, Map<String, Object>> keyValueMapPair) throws SQLException { Map<String, Object> allKeyValueMap = keyValueMapPair.getLeft(); Map<String, Object> notNullKeyValueMap = keyValueMapPair.getRight(); if (this.sqlgGraph.features().supportsBatchMode() && this.sqlgGraph.tx().isInBatchMode()) { internalBatchAddEdge(complete, allKeyValueMap); } else { internalAddEdge(notNullKeyValueMap); } //Cache the properties this.properties.putAll(notNullKeyValueMap); }
@Override public int hashCode() { if (this.id() != null) { return id().hashCode(); } if (this.sqlgGraph.features().supportsBatchMode() && this.sqlgGraph.tx().isInBatchMode()) { return super.hashCode(); } else { return id().hashCode(); } }
@Override public int hashCode() { if (this.id() != null) { return id().hashCode(); } if (this.sqlgGraph.features().supportsBatchMode() && this.sqlgGraph.tx().isInBatchMode()) { return super.hashCode(); } else { return id().hashCode(); } }
public static SqlgVertex of(SqlgGraph sqlgGraph, Long id, String schema, String table) { if (!sqlgGraph.tx().isInBatchMode()) { return sqlgGraph.tx().putVertexIfAbsent(sqlgGraph, schema, table, id); } else { return new SqlgVertex(sqlgGraph, id, schema, table); } }
public static SqlgVertex of(SqlgGraph sqlgGraph, Long id, String schema, String table) { if (!sqlgGraph.tx().isInBatchMode()) { return sqlgGraph.tx().putVertexIfAbsent(sqlgGraph, schema, table, id); } else { return new SqlgVertex(sqlgGraph, id, schema, table); } }
public static SqlgVertex of(SqlgGraph sqlgGraph, ListOrderedSet<Comparable> identifiers, String schema, String table) { if (!sqlgGraph.tx().isInBatchMode()) { return sqlgGraph.tx().putVertexIfAbsent(sqlgGraph, schema, table, identifiers); } else { return new SqlgVertex(sqlgGraph, identifiers, schema, table); } }
public static SqlgVertex of(SqlgGraph sqlgGraph, ListOrderedSet<Comparable> identifiers, String schema, String table) { if (!sqlgGraph.tx().isInBatchMode()) { return sqlgGraph.tx().putVertexIfAbsent(sqlgGraph, schema, table, identifiers); } else { return new SqlgVertex(sqlgGraph, identifiers, schema, table); } }
@Override public void remove() { this.sqlgGraph.tx().readWrite(); if (this.removed) throw new IllegalStateException(String.format("Edge with id %s was removed.", id().toString())); if (this.sqlgGraph.getSqlDialect().supportsBatchMode() && this.sqlgGraph.tx().isInBatchMode()) { this.sqlgGraph.tx().getBatchManager().removeEdge(this.schema, this.table, this); } else { super.remove(); } }
@Override public void remove() { this.sqlgGraph.tx().readWrite(); if (this.removed) throw new IllegalStateException(String.format("Edge with id %s was removed.", id().toString())); if (this.sqlgGraph.getSqlDialect().supportsBatchMode() && this.sqlgGraph.tx().isInBatchMode()) { this.sqlgGraph.tx().getBatchManager().removeEdge(this.schema, this.table, this); } else { super.remove(); } }
/** * @param sqlgGraph The graph. * @param temporary Indicates if it is a temporary vertex. * @param streaming Indicates if the vertex is being streamed in. This only works if the transaction is in streaming mode. * @param schema The database schema. * @param table The table name. * @param keyValueMapPair The properties. */ public SqlgVertex( SqlgGraph sqlgGraph, boolean temporary, boolean streaming, String schema, String table, Pair<Map<String, Object>, Map<String, Object>> keyValueMapPair) { super(sqlgGraph, schema, table); insertVertex(temporary, streaming, keyValueMapPair); if (!sqlgGraph.tx().isInBatchMode()) { sqlgGraph.tx().add(this); } }
@Override public boolean equals(final Object object) { this.sqlgGraph.tx().readWrite(); if (this.sqlgGraph.features().supportsBatchMode() && this.sqlgGraph.tx().isInBatchMode()) { if (this.id() != null && (object instanceof SqlgElement) && ((SqlgElement) object).id() != null) { return ElementHelper.areEqual(this, object); } else { return super.equals(object); } } else { return ElementHelper.areEqual(this, object); } }
@Override public boolean equals(final Object object) { this.sqlgGraph.tx().readWrite(); if (this.sqlgGraph.features().supportsBatchMode() && this.sqlgGraph.tx().isInBatchMode()) { if (this.id() != null && (object instanceof SqlgElement) && ((SqlgElement) object).id() != null) { return ElementHelper.areEqual(this, object); } else { return super.equals(object); } } else { return ElementHelper.areEqual(this, object); } }
private static BatchManager.BatchModeType flushAndSetTxToNone(SqlgGraph sqlgGraph) { //topology elements can not be added in batch mode because on flushing the topology //needs to be queries and yet the elements are still in the cache. BatchManager.BatchModeType batchModeType = sqlgGraph.tx().getBatchModeType(); if (sqlgGraph.tx().isInBatchMode()) { batchModeType = sqlgGraph.tx().getBatchModeType(); sqlgGraph.tx().flush(); sqlgGraph.tx().batchMode(BatchManager.BatchModeType.NONE); } return batchModeType; }
private static BatchManager.BatchModeType flushAndSetTxToNone(SqlgGraph sqlgGraph) { //topology elements can not be added in batch mode because on flushing the topology //needs to be queries and yet the elements are still in the cache. BatchManager.BatchModeType batchModeType = sqlgGraph.tx().getBatchModeType(); if (sqlgGraph.tx().isInBatchMode()) { batchModeType = sqlgGraph.tx().getBatchModeType(); sqlgGraph.tx().flush(); sqlgGraph.tx().batchMode(BatchManager.BatchModeType.NONE); } return batchModeType; }