/** * Reads the next row from the result object and transforms it into a RowModel object * * @param data the data to transform, given as a map * @return @return the data transformed to an {@link RowModel} */ public GraphRowModel adapt(Map<String, Object> data) { assert (columns != null); Set<Long> nodeIdentities = new HashSet(); Set<Long> edgeIdentities = new HashSet(); GraphModel graphModel = new DefaultGraphModel(); List<String> variables = new ArrayList<>(); List<Object> values = new ArrayList<>(); // there is no guarantee that the objects in the data are ordered the same way as required by the columns // so we use the columns information to extract them in the correct order for post-processing. Iterator<String> iterator = columns.iterator(); adapt(iterator, data, graphModel, variables, values, nodeIdentities, edgeIdentities); DefaultRowModel rowModel = new DefaultRowModel(values.toArray(new Object[]{}), variables.toArray(new String[]{})); return new DefaultGraphRowModel(graphModel, rowModel.getValues()); }
@Override public GraphRowModel adapt(Map<String, Object> data) { if (columns == null) { throw new ResultProcessingException("Column data cannot be null!"); } Set<Long> nodeIdentities = new HashSet<>(); Set<Long> edgeIdentities = new HashSet<>(); GraphModel graphModel = new DefaultGraphModel(); List<String> variables = new ArrayList<>(); List<Object> values = new ArrayList<>(); // there is no guarantee that the objects in the data are ordered the same way as required by the columns // so we use the columns information to extract them in the correct order for post-processing. Iterator<String> iterator = columns.iterator(); adapt(iterator, data, graphModel, variables, values, nodeIdentities, edgeIdentities); DefaultRowModel rowModel = new DefaultRowModel(values.toArray(new Object[] {}), variables.toArray(new String[] {})); return new DefaultGraphRowModel(graphModel, rowModel.getValues()); }
/** * Reads the next row from the result object and transforms it into a RowModel object * * @param data the data to transform, given as a map * @return the data transformed to an {@link RowModel} */ public GraphRowModel adapt(Map<String, Object> data) { if (columns == null) { throw new ResultProcessingException("Result columns should not be null"); } Set<Long> nodeIdentities = new HashSet<>(); Set<Long> edgeIdentities = new HashSet<>(); DefaultGraphModel graphModel = new DefaultGraphModel(); List<String> variables = new ArrayList<>(); List<Object> values = new ArrayList<>(); // there is no guarantee that the objects in the data are ordered the same way as required by the columns // so we use the columns information to extract them in the correct order for post-processing. Iterator<String> iterator = columns.iterator(); adapt(iterator, data, graphModel, variables, values, nodeIdentities, edgeIdentities); DefaultRowModel rowModel = new DefaultRowModel(values.toArray(new Object[] {}), variables.toArray(new String[] {})); return new DefaultGraphRowModel(graphModel, rowModel.getValues()); }
/** * Reads the next row from the result object and transforms it into a RowModel object * * @param data the data to transform, given as a map * @return the data transformed to an {@link RowModel} */ public GraphRowModel adapt(Map<String, Object> data) { if (columns == null) { throw new ResultProcessingException("Column data cannot be null!"); } Set<Long> nodeIdentities = new HashSet<>(); Set<Long> edgeIdentities = new HashSet<>(); GraphModel graphModel = new DefaultGraphModel(); List<String> variables = new ArrayList<>(); List<Object> values = new ArrayList<>(); // there is no guarantee that the objects in the data are ordered the same way as required by the columns // so we use the columns information to extract them in the correct order for post-processing. Iterator<String> iterator = columns.iterator(); adapt(iterator, data, graphModel, variables, values, nodeIdentities, edgeIdentities); DefaultRowModel rowModel = new DefaultRowModel(values.toArray(new Object[] {}), variables.toArray(new String[] {})); return new DefaultGraphRowModel(graphModel, rowModel.getValues()); }