}
private Query readQuery(XMLStreamReader reader) throws XMLStreamException {
String builderClassName = reader.getAttributeValue(null, "builder");
String filterClassName = reader.getAttributeValue(null, "filter");
FilterBuilder builder = null;
for (FilterBuilder fb : model.getLibrary().getLookup().lookupAll(FilterBuilder.class)) {
if (fb.getClass().getName().equals(builderClassName)) {
if (filterClassName != null) {
if (fb.getFilter().getClass().getName().equals(filterClassName)) {
builder = fb;
break;
}
} else {
builder = fb;
break;
}
}
}
if (builder == null) {
for (CategoryBuilder catBuilder : Lookup.getDefault().lookupAll(CategoryBuilder.class)) {
for (FilterBuilder fb : catBuilder.getBuilders()) {
if (fb.getClass().getName().equals(builderClassName)) {
if (filterClassName != null) {
if (fb.getFilter().getClass().getName().equals(filterClassName)) {
builder = fb;
break;
}
} else {
builder = fb;
break;
}
}
}
}
}
if (builder != null) {
//Create filter
Filter filter = builder.getFilter();
FilterController fc = Lookup.getDefault().lookup(FilterController.class);
Query query = fc.createQuery(filter);
FilterProperty property = null;
boolean end = false;