use of com.evolveum.midpoint.web.page.admin.configuration.dto.ObjectSearchDto in project midpoint by Evolveum.
the class ObjectSelectionPanel method clearSearchPerformed.
private void clearSearchPerformed(AjaxRequestTarget target) {
searchModel.setObject(new ObjectSearchDto());
TablePanel panel = getTablePanel();
DataTable table = panel.getDataTable();
ObjectDataProvider provider = (ObjectDataProvider) table.getDataProvider();
if (context.getDataProviderQuery() != null) {
provider.setQuery(context.getDataProviderQuery());
} else {
provider.setQuery(null);
}
target.add(panel, getSearchForm());
}
use of com.evolveum.midpoint.web.page.admin.configuration.dto.ObjectSearchDto in project midpoint by Evolveum.
the class ObjectSelectionPanel method initLayout.
public void initLayout(PageBase pageBase) {
Form searchForm = new Form(ID_SEARCH_FORM);
searchForm.setOutputMarkupId(true);
add(searchForm);
searchForm.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return context.isSearchEnabled();
}
});
BasicSearchPanel<ObjectSearchDto> basicSearch = new BasicSearchPanel<ObjectSearchDto>(ID_BASIC_SEARCH) {
@Override
protected IModel<String> createSearchTextModel() {
return new PropertyModel<>(searchModel, ObjectSearchDto.F_SEARCH_TEXT);
}
@Override
protected void searchPerformed(AjaxRequestTarget target) {
ObjectSelectionPanel.this.searchPerformed(target);
}
@Override
protected void clearSearchPerformed(AjaxRequestTarget target) {
ObjectSelectionPanel.this.clearSearchPerformed(target);
}
};
searchForm.add(basicSearch);
add(context.createExtraContentContainer(ID_EXTRA_CONTENT_CONTAINER, this));
List<IColumn<SelectableBean<ObjectType>, String>> columns = initColumns();
ObjectDataProvider provider = new ObjectDataProvider(pageBase, this.objectType);
provider.setQuery(context.getDataProviderQuery());
provider.setOptions(context.getDataProviderOptions());
TablePanel table = new TablePanel<>(ID_TABLE, provider, columns);
table.setOutputMarkupId(true);
addOrReplace(table);
AjaxButton cancelButton = new AjaxButton(ID_BUTTON_CANCEL, createStringResource("chooseTypeDialog.button.cancel")) {
@Override
public void onClick(AjaxRequestTarget ajaxRequestTarget) {
modalWindow.close(ajaxRequestTarget);
}
};
add(cancelButton);
}
use of com.evolveum.midpoint.web.page.admin.configuration.dto.ObjectSearchDto in project midpoint by Evolveum.
the class ObjectSelectionPanel method createObjectQuery.
private ObjectQuery createObjectQuery() {
ObjectSearchDto dto = searchModel.getObject();
ObjectQuery query = null;
if (StringUtils.isEmpty(dto.getText())) {
if (context.getDataProviderQuery() != null) {
return context.getDataProviderQuery();
} else {
return query;
}
}
try {
PageBase pageBase = WebComponentUtil.getPageBase(this);
PrismContext prismContext = pageBase.getPrismContext();
PolyStringNormalizer normalizer = prismContext.getDefaultPolyStringNormalizer();
String normalized = normalizer.normalize(dto.getText());
ObjectFilter filter = QueryBuilder.queryFor(objectType, prismContext).item(context.getSearchProperty()).contains(normalized).matchingNorm().buildFilter();
if (context.getDataProviderQuery() != null) {
AndFilter and = AndFilter.createAnd(context.getDataProviderQuery().getFilter(), filter);
query = ObjectQuery.createObjectQuery(and);
} else {
query = ObjectQuery.createObjectQuery(filter);
}
} catch (Exception e) {
error(getString("chooseTypeDialog.message.queryError") + " " + e.getMessage());
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't create query filter.", e);
}
return query;
}
Aggregations