use of org.gephi.filters.api.Query in project gephi by gephi.
the class FilterModelPersistenceProvider method writeQuery.
private void writeQuery(String code, XMLStreamWriter writer, FilterModelImpl model, Query query, int parentId) throws XMLStreamException {
Serialization serialization = new Serialization(model.getGraphModel());
writer.writeStartElement(code);
int id = queryId++;
writer.writeAttribute("id", String.valueOf(id));
if (parentId != -1) {
writer.writeAttribute("parent", String.valueOf(parentId));
}
Filter filter = query.getFilter();
FilterBuilder builder = model.getLibrary().getBuilder(filter);
writer.writeAttribute("builder", builder.getClass().getName());
writer.writeAttribute("filter", filter.getClass().getName());
if (query.getName() != null) {
writer.writeAttribute("name", query.getName());
}
// Params
for (int i = 0; i < query.getPropertiesCount(); i++) {
FilterProperty prop = query.getFilter().getProperties()[i];
writeParameter(writer, i, prop, serialization);
}
writer.writeEndElement();
for (Query child : query.getChildren()) {
writeQuery(code, writer, model, child, id);
}
}
Aggregations