use of com.evolveum.midpoint.web.page.admin.roles.AbstractRoleCompositedSearchItem in project midpoint by Evolveum.
the class Search method createQueryFromDefaultItems.
private ObjectQuery createQueryFromDefaultItems(PageBase pageBase, VariablesMap variables) {
List<SearchItem> specialItems = getSpecialItems();
if (specialItems.isEmpty()) {
if (compositedSpecialItems == null) {
return null;
}
}
List<ObjectFilter> conditions = new ArrayList<>();
if (compositedSpecialItems instanceof AbstractRoleCompositedSearchItem) {
ObjectFilter filter = ((AbstractRoleCompositedSearchItem) compositedSpecialItems).createFilter(pageBase, variables);
if (filter != null) {
conditions.add(filter);
}
}
for (SearchItem item : specialItems) {
if (item.isApplyFilter()) {
if (item instanceof SpecialSearchItem) {
ObjectFilter filter = ((SpecialSearchItem) item).createFilter(pageBase, variables);
if (filter != null) {
conditions.add(filter);
}
}
if (item instanceof PropertySearchItem) {
PropertySearchItem propertyItem = (PropertySearchItem) item;
ObjectFilter filter = propertyItem.transformToFilter();
if (filter == null) {
filter = createFilterForSearchItem(propertyItem, pageBase.getPrismContext());
}
if (filter != null) {
conditions.add(filter);
}
}
}
}
ObjectQuery query;
if (getTypeClass() != null) {
query = pageBase.getPrismContext().queryFor(getTypeClass()).build();
} else {
query = pageBase.getPrismContext().queryFactory().createQuery();
}
switch(conditions.size()) {
case 0:
query = null;
break;
default:
for (ObjectFilter filter : conditions) {
query.addFilter(filter);
}
}
return query;
}
Aggregations