com.vesoft.nebula.driver.graph.scan.ScanNodeResult Maven / Gradle / Ivy
The newest version!
package com.vesoft.nebula.driver.graph.scan;
import com.vesoft.nebula.driver.graph.data.ResultSet;
import com.vesoft.nebula.driver.graph.data.ValueWrapper;
import com.vesoft.nebula.driver.graph.data.Vertex;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class ScanNodeResult extends ScanResult {
private List propNames;
public ScanNodeResult(List results, List propNames) {
super(results);
this.propNames = propNames;
}
/**
* get node table row's column names
*
* @return list of row column names
*/
public List getPropNames() {
return propNames;
}
protected void convertResultToRow() {
if (isEmpty) {
return;
}
if (tableRows.isEmpty()) {
for (ResultSet resultSet : results) {
while (resultSet.hasNext()) {
ResultSet.Record record = resultSet.next();
List values = record.values();
List rowValues = new ArrayList<>();
Map properties;
Vertex vertex = values.get(0).asNode();
properties = vertex.getProperties();
for (String propName : propNames) {
rowValues.add(properties.get(propName));
}
tableRows.add(new TableRow(rowValues));
}
}
}
}
}