use of au.gov.asd.tac.constellation.plugins.importexport.RowFilter in project constellation by constellation-app.
the class ImportDelimitedPlugin method processVertices.
private static int processVertices(ImportDefinition definition, GraphWriteMethods graph, List<String[]> data, AttributeType attributeType, boolean initialiseWithSchema, PluginInteraction interaction, String source) throws InterruptedException {
final List<ImportAttributeDefinition> attributeDefinitions = definition.getDefinitions(attributeType);
addAttributes(graph, GraphElementType.VERTEX, attributeDefinitions);
int currentRow = 0;
int importedRows = 0;
final int totalRows = data.size() - definition.getFirstRow();
final RowFilter filter = definition.getRowFilter();
for (int i = definition.getFirstRow(); i < data.size(); i++) {
interaction.setProgress(++currentRow, totalRows, "Importing Vertices: " + source, true);
final String[] row = data.get(i);
if (filter == null || filter.passesFilter(i - 1, row)) {
// Count the number of processed rows to notify in the status message
++importedRows;
final int vertexId = graph.addVertex();
for (final ImportAttributeDefinition attributeDefinition : attributeDefinitions) {
attributeDefinition.setValue(graph, vertexId, row, (i - 1));
}
if (initialiseWithSchema && graph.getSchema() != null) {
graph.getSchema().completeVertex(graph, vertexId);
}
}
}
return importedRows;
}
Aggregations