//Create filter
Filter filter = builder.getFilter();
FilterController fc = Lookup.getDefault().lookup(FilterController.class);
Query query = fc.createQuery(filter);
FilterProperty property = null;
boolean end = false;
while (reader.hasNext() && !end) {
Integer eventType = reader.next();
if (eventType.equals(XMLEvent.START_ELEMENT)) {
String name = reader.getLocalName();
if ("parameter".equalsIgnoreCase(name)) {
int index = Integer.parseInt(reader.getAttributeValue(null, "index"));
property = query.getFilter().getProperties()[index];
}
} else if (eventType.equals(XMLStreamReader.CHARACTERS) && property != null) {
try {
PropertyEditor editor = property.getPropertyEditor();
if (editor == null) {
editor = PropertyEditorManager.findEditor(property.getValueType());
}
if (editor != null) {
String textValue = reader.getText();
editor.setAsText(textValue);
property.setValue(editor.getValue());
model.updateParameters(query);
}
} catch (Exception e) {
e.printStackTrace();
}