Search in sources :

Example 1 with DefaultDseEdgeMetadata

use of com.datastax.dse.driver.internal.core.metadata.schema.DefaultDseEdgeMetadata in project java-driver by datastax.

the class DseTableParser method buildEdge.

private DseEdgeMetadata buildEdge(CqlIdentifier tableId, Multimap<CqlIdentifier, AdminRow> keyspaceEdges, Multimap<CqlIdentifier, AdminRow> keyspaceVertices) {
    if (keyspaceEdges == null) {
        return null;
    }
    Collection<AdminRow> tableEdges = keyspaceEdges.get(tableId);
    if (tableEdges == null || tableEdges.isEmpty()) {
        return null;
    }
    AdminRow row = tableEdges.iterator().next();
    CqlIdentifier fromTable = CqlIdentifier.fromInternal(row.getString("from_table"));
    CqlIdentifier toTable = CqlIdentifier.fromInternal(row.getString("to_table"));
    return new DefaultDseEdgeMetadata(getLabel(row), fromTable, findVertexLabel(fromTable, keyspaceVertices, "incoming"), CqlIdentifiers.wrapInternal(row.getListOfString("from_partition_key_columns")), CqlIdentifiers.wrapInternal(row.getListOfString("from_clustering_columns")), toTable, findVertexLabel(toTable, keyspaceVertices, "outgoing"), CqlIdentifiers.wrapInternal(row.getListOfString("to_partition_key_columns")), CqlIdentifiers.wrapInternal(row.getListOfString("to_clustering_columns")));
}
Also used : AdminRow(com.datastax.oss.driver.internal.core.adminrequest.AdminRow) CqlIdentifier(com.datastax.oss.driver.api.core.CqlIdentifier) DefaultDseEdgeMetadata(com.datastax.dse.driver.internal.core.metadata.schema.DefaultDseEdgeMetadata)

Aggregations

DefaultDseEdgeMetadata (com.datastax.dse.driver.internal.core.metadata.schema.DefaultDseEdgeMetadata)1 CqlIdentifier (com.datastax.oss.driver.api.core.CqlIdentifier)1 AdminRow (com.datastax.oss.driver.internal.core.adminrequest.AdminRow)1