Search in sources :

Example 6 with DynamicFormPanel

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);
    }
}
Also used : ObjectReferenceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType) Task(com.evolveum.midpoint.task.api.Task) DynamicFormPanel(com.evolveum.midpoint.web.component.prism.DynamicFormPanel) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Example 7 with DynamicFormPanel

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));
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) QueryFactory(com.evolveum.midpoint.prism.query.QueryFactory) ArrayList(java.util.ArrayList) DynamicFormPanel(com.evolveum.midpoint.web.component.prism.DynamicFormPanel) RestartResponseException(org.apache.wicket.RestartResponseException) EqualFilter(com.evolveum.midpoint.prism.query.EqualFilter) List(java.util.List) ArrayList(java.util.ArrayList) SearchResultList(com.evolveum.midpoint.schema.SearchResultList) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) ItemPath(com.evolveum.midpoint.prism.path.ItemPath)

Aggregations

DynamicFormPanel (com.evolveum.midpoint.web.component.prism.DynamicFormPanel)7 Task (com.evolveum.midpoint.task.api.Task)6 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)5 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)5 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)5 ObjectReferenceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType)3 VisibleBehaviour (com.evolveum.midpoint.web.component.util.VisibleBehaviour)2 List (java.util.List)2 Label (org.apache.wicket.markup.html.basic.Label)2 CaseDetailsModels (com.evolveum.midpoint.gui.impl.page.admin.cases.CaseDetailsModels)1 CorrelationContextPanel (com.evolveum.midpoint.gui.impl.page.admin.cases.component.CorrelationContextPanel)1 PrismReferenceValue (com.evolveum.midpoint.prism.PrismReferenceValue)1 EncryptionException (com.evolveum.midpoint.prism.crypto.EncryptionException)1 ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)1 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)1 EqualFilter (com.evolveum.midpoint.prism.query.EqualFilter)1 QueryFactory (com.evolveum.midpoint.prism.query.QueryFactory)1 SearchResultList (com.evolveum.midpoint.schema.SearchResultList)1 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)1 LinkedReferencePanel (com.evolveum.midpoint.web.component.data.LinkedReferencePanel)1