Search in sources :

Example 11 with ObjectWrapper

use of com.evolveum.midpoint.web.component.prism.ObjectWrapper in project midpoint by Evolveum.

the class FocusPersonasTabPanel method initLayout.

private void initLayout() {
    WebMarkupContainer container = new WebMarkupContainer(ID_PERSONAS_CONTAINER);
    container.setOutputMarkupId(true);
    add(container);
    RepeatingView view = new RepeatingView(ID_PERSONAS_TABLE);
    view.setOutputMarkupId(true);
    container.add(view);
    LoadableModel<List<PrismObject<FocusType>>> personasListModel = loadModel();
    if (personasListModel.getObject() == null || personasListModel.getObject().size() == 0) {
        WebMarkupContainer viewChild = new WebMarkupContainer(view.newChildId());
        viewChild.setOutputMarkupId(true);
        view.add(viewChild);
        WebMarkupContainer emptyContainer = new WebMarkupContainer(ID_PERSONAS_SUMMARY);
        emptyContainer.setOutputMarkupId(true);
        viewChild.add(emptyContainer);
        return;
    }
    Task task = pageBase.createSimpleTask(OPERATION_LOAD_PERSONAS);
    for (PrismObject<FocusType> personaObject : personasListModel.getObject()) {
        ObjectWrapper<FocusType> personaWrapper = ObjectWrapperUtil.createObjectWrapper(WebComponentUtil.getEffectiveName(personaObject, RoleType.F_DISPLAY_NAME), "", personaObject, ContainerStatus.MODIFYING, task, getPageBase());
        WebMarkupContainer personaPanel = new WebMarkupContainer(view.newChildId());
        personaPanel.setOutputMarkupId(true);
        view.add(personaPanel);
        if (personaObject.getCompileTimeClass().equals(UserType.class)) {
            personaPanel.add(new UserSummaryPanel(ID_PERSONAS_SUMMARY, new Model<ObjectWrapper<UserType>>((ObjectWrapper) personaWrapper)));
        } else if (personaObject.getCompileTimeClass().equals(RoleType.class)) {
            personaPanel.add(new RoleSummaryPanel(ID_PERSONAS_SUMMARY, new Model<ObjectWrapper<RoleType>>((ObjectWrapper) personaWrapper)));
        } else if (personaObject.getCompileTimeClass().equals(OrgType.class)) {
            personaPanel.add(new OrgSummaryPanel(ID_PERSONAS_SUMMARY, new Model<ObjectWrapper<OrgType>>((ObjectWrapper) personaWrapper)));
        } else if (personaObject.getCompileTimeClass().equals(ServiceType.class)) {
            personaPanel.add(new ServiceSummaryPanel(ID_PERSONAS_SUMMARY, new Model<ObjectWrapper<ServiceType>>((ObjectWrapper) personaWrapper)));
        }
    }
}
Also used : Task(com.evolveum.midpoint.task.api.Task) ServiceSummaryPanel(com.evolveum.midpoint.web.page.admin.users.component.ServiceSummaryPanel) RepeatingView(org.apache.wicket.markup.repeater.RepeatingView) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) UserSummaryPanel(com.evolveum.midpoint.web.page.admin.users.component.UserSummaryPanel) Model(org.apache.wicket.model.Model) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) RoleSummaryPanel(com.evolveum.midpoint.web.page.admin.roles.component.RoleSummaryPanel) ObjectWrapper(com.evolveum.midpoint.web.component.prism.ObjectWrapper) ArrayList(java.util.ArrayList) List(java.util.List) OrgSummaryPanel(com.evolveum.midpoint.web.page.admin.users.component.OrgSummaryPanel)

Aggregations

ObjectWrapper (com.evolveum.midpoint.web.component.prism.ObjectWrapper)11 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)5 Task (com.evolveum.midpoint.task.api.Task)5 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)3 FocusSubwrapperDto (com.evolveum.midpoint.web.page.admin.users.dto.FocusSubwrapperDto)3 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)3 ArrayList (java.util.ArrayList)3 RestartResponseException (org.apache.wicket.RestartResponseException)3 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)3 SelectorOptions (com.evolveum.midpoint.schema.SelectorOptions)2 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)2 RoleSummaryPanel (com.evolveum.midpoint.web.page.admin.roles.component.RoleSummaryPanel)2 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)2 Form (org.apache.wicket.markup.html.form.Form)2 RepeatingView (org.apache.wicket.markup.repeater.RepeatingView)2 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)1 PrismObject (com.evolveum.midpoint.prism.PrismObject)1 EncryptionException (com.evolveum.midpoint.prism.crypto.EncryptionException)1 ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)1 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)1