use of com.evolveum.midpoint.prism.query.ObjectFilter in project midpoint by Evolveum.
the class TestFilterExpression method test100EvaluateExpressionEmployeeTypeUndefinedFilter.
@Test
public void test100EvaluateExpressionEmployeeTypeUndefinedFilter() throws Exception {
final String TEST_NAME = "testEvaluateExpressionEmployeeTypeUndefinedFilter";
TestUtil.displayTestTile(TEST_NAME);
// GIVEN
OperationResult result = new OperationResult(TestFilterExpression.class.getName() + "." + TEST_NAME);
Task task = taskManager.createTaskInstance(TEST_NAME);
ObjectFilter filter = evaluateExpressionAssertFilter("expression-employeeType-undefined-filter.xml", null, UndefinedFilter.class, task, result);
executeFilter(filter, 5, task, result);
}
use of com.evolveum.midpoint.prism.query.ObjectFilter in project midpoint by Evolveum.
the class TypedAssignablePanel method createObjectListPanel.
private PopupObjectListPanel<T> createObjectListPanel(String id, final String countId, final QName type) {
PopupObjectListPanel<T> listPanel = new PopupObjectListPanel<T>(id, qnameToCompileTimeClass(type), true, getPageBase()) {
@Override
protected void onUpdateCheckbox(AjaxRequestTarget target) {
refreshCounts(target);
}
@Override
protected ObjectQuery addFilterToContentQuery(ObjectQuery query) {
if (type.equals(RoleType.COMPLEX_TYPE)) {
LOGGER.debug("Loading roles which the current user has right to assign");
OperationResult result = new OperationResult(OPERATION_LOAD_ASSIGNABLE_ROLES);
ObjectFilter filter = null;
try {
ModelInteractionService mis = parentPage.getModelInteractionService();
RoleSelectionSpecification roleSpec = mis.getAssignableRoleSpecification(SecurityUtils.getPrincipalUser().getUser().asPrismObject(), result);
filter = roleSpec.getFilter();
} catch (Exception ex) {
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't load available roles", ex);
result.recordFatalError("Couldn't load available roles", ex);
} finally {
result.recomputeStatus();
}
if (!result.isSuccess() && !result.isHandledError()) {
parentPage.showResult(result);
}
if (query == null) {
query = new ObjectQuery();
}
query.addFilter(filter);
}
return query;
}
};
listPanel.setOutputMarkupId(true);
listPanel.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return type.equals(typeModel.getObject());
}
});
return listPanel;
}
use of com.evolveum.midpoint.prism.query.ObjectFilter in project midpoint by Evolveum.
the class ValueChoosePanel method editValuePerformed.
protected void editValuePerformed(List<PrismReferenceValue> values, AjaxRequestTarget target) {
List<QName> supportedTypes = WebComponentUtil.resolveObjectTypesToQNames(types, getPageBase().getPrismContext());
ObjectFilter filter = createChooseQuery(values) == null ? null : createChooseQuery(values).getFilter();
Class<O> defaultType = (Class<O>) types.iterator().next();
ObjectBrowserPanel<O> objectBrowserPanel = new ObjectBrowserPanel<O>(getPageBase().getMainPopupBodyId(), defaultType, supportedTypes, false, getPageBase(), filter) {
private static final long serialVersionUID = 1L;
@Override
protected void onSelectPerformed(AjaxRequestTarget target, O object) {
getPageBase().hideMainPopup(target);
ValueChoosePanel.this.choosePerformed(target, object);
}
};
getPageBase().showMainPopup(objectBrowserPanel, target);
}
use of com.evolveum.midpoint.prism.query.ObjectFilter in project midpoint by Evolveum.
the class ValueChoosePanel method createChooseQuery.
protected ObjectQuery createChooseQuery(List<PrismReferenceValue> values) {
ArrayList<String> oidList = new ArrayList<>();
ObjectQuery query = new ObjectQuery();
if (oidList.isEmpty()) {
return null;
}
ObjectFilter oidFilter = InOidFilter.createInOid(oidList);
query.setFilter(NotFilter.createNot(oidFilter));
return query;
}
use of com.evolveum.midpoint.prism.query.ObjectFilter in project midpoint by Evolveum.
the class MultiValueChoosePanel method createChooseQuery.
protected ObjectQuery createChooseQuery(List<PrismReferenceValue> values) {
ArrayList<String> oidList = new ArrayList<>();
ObjectQuery query = new ObjectQuery();
if (oidList.isEmpty()) {
return null;
}
ObjectFilter oidFilter = InOidFilter.createInOid(oidList);
query.setFilter(NotFilter.createNot(oidFilter));
return query;
}
Aggregations