use of com.evolveum.midpoint.web.component.prism.DynamicFormPanel in project midpoint by Evolveum.
the class PageForgotPassword method initDynamicLayout.
private void initDynamicLayout(final Form<?> mainForm) {
WebMarkupContainer dynamicLayout = new WebMarkupContainer(ID_DYNAMIC_LAYOUT);
dynamicLayout.setOutputMarkupId(true);
mainForm.add(dynamicLayout);
dynamicLayout.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return isDynamicForm();
}
});
DynamicFormPanel<UserType> searchAttributesForm = runPrivileged(() -> {
ObjectReferenceType formRef = getResetPasswordPolicy().getFormRef();
if (formRef == null) {
return null;
}
Task task = createAnonymousTask(OPERATION_LOAD_DYNAMIC_FORM);
return new DynamicFormPanel<UserType>(ID_DYNAMIC_FORM, UserType.COMPLEX_TYPE, formRef.getOid(), mainForm, task, PageForgotPassword.this, true);
});
if (searchAttributesForm != null) {
dynamicLayout.add(searchAttributesForm);
}
}
use of com.evolveum.midpoint.web.component.prism.DynamicFormPanel in project midpoint by Evolveum.
the class PageForgotPassword method createDynamicFormQuery.
private ObjectQuery createDynamicFormQuery(Form form) {
DynamicFormPanel<UserType> userDynamicPanel = (DynamicFormPanel<UserType>) form.get(createComponentPath(ID_DYNAMIC_LAYOUT, ID_DYNAMIC_FORM));
List<ItemPath> filledItems = userDynamicPanel.getChangedItems();
PrismObject<UserType> user;
try {
user = userDynamicPanel.getObject();
} catch (SchemaException e1) {
getSession().error(getString("pageForgetPassword.message.usernotfound"));
throw new RestartResponseException(PageForgotPassword.class);
}
List<EqualFilter> filters = new ArrayList<>();
QueryFactory queryFactory = getPrismContext().queryFactory();
for (ItemPath path : filledItems) {
PrismProperty<?> property = user.findProperty(path);
EqualFilter filter = queryFactory.createEqual(path, property.getDefinition(), null);
filter.setValue(property.getAnyValue().clone());
filters.add(filter);
}
return queryFactory.createQuery(queryFactory.createAnd((List) filters));
}
Aggregations