Search in sources :

Example 81 with PageBase

use of com.evolveum.midpoint.gui.api.page.PageBase in project midpoint by Evolveum.

the class AbstractTreeTablePanel method createOrgChildQuery.

protected ObjectQuery createOrgChildQuery() {
    SelectableBeanImpl<OrgType> dto = selected.getObject();
    String oid = dto != null && dto.getValue() != null ? dto.getValue().getOid() : getModel().getObject();
    BasicSearchPanel<String> basicSearch = (BasicSearchPanel<String>) get(createComponentPath(ID_SEARCH_FORM, ID_BASIC_SEARCH));
    String object = basicSearch.getModelObject();
    DropDownChoice<String> searchScopeChoice = (DropDownChoice<String>) get(createComponentPath(ID_SEARCH_FORM, ID_SEARCH_SCOPE));
    String scope = searchScopeChoice.getModelObject();
    if (StringUtils.isBlank(object)) {
        object = null;
    }
    PageBase page = getPageBase();
    PrismContext context = page.getPrismContext();
    S_AtomicFilterExit q;
    if (object == null || SEARCH_SCOPE_ONE.equals(scope)) {
        q = context.queryFor(OrgType.class).isDirectChildOf(oid);
    } else {
        q = context.queryFor(OrgType.class).isChildOf(oid);
    }
    if (object == null) {
        return q.build();
    }
    PolyStringNormalizer normalizer = context.getDefaultPolyStringNormalizer();
    String normalizedString = normalizer.normalize(object);
    if (StringUtils.isEmpty(normalizedString)) {
        return q.build();
    }
    ObjectQuery query = q.and().block().item(OrgType.F_NAME).containsPoly(normalizedString).matchingNorm().or().item(OrgType.F_DISPLAY_NAME).containsPoly(normalizedString).matchingNorm().build();
    if (LOGGER.isTraceEnabled()) {
        LOGGER.trace("Searching child orgs of org {} with query:\n{}", oid, query.debugDump());
    }
    return query;
}
Also used : DropDownChoice(org.apache.wicket.markup.html.form.DropDownChoice) BasicSearchPanel(com.evolveum.midpoint.web.component.BasicSearchPanel) OrgType(com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType) PrismContext(com.evolveum.midpoint.prism.PrismContext) S_AtomicFilterExit(com.evolveum.midpoint.prism.query.builder.S_AtomicFilterExit) PageBase(com.evolveum.midpoint.gui.api.page.PageBase) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) PolyStringNormalizer(com.evolveum.midpoint.prism.polystring.PolyStringNormalizer)

Example 82 with PageBase

use of com.evolveum.midpoint.gui.api.page.PageBase in project midpoint by Evolveum.

the class AbstractTreeTablePanel method refreshTabbedPanel.

protected void refreshTabbedPanel(AjaxRequestTarget target) {
    PageBase page = getPageBase();
    TabbedPanel<ITab> tabbedPanel = findParent(TabbedPanel.class);
    IModel<List<ITab>> tabs = tabbedPanel.getTabs();
    if (tabs instanceof LoadableModel) {
        ((LoadableModel) tabs).reset();
    }
    if (tabs.getObject() != null && tabs.getObject().size() > 0) {
        tabbedPanel.setSelectedTab(0);
    }
    target.add(tabbedPanel);
    target.add(page.getFeedbackPanel());
}
Also used : LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) List(java.util.List) PageBase(com.evolveum.midpoint.gui.api.page.PageBase) ITab(org.apache.wicket.extensions.markup.html.tabs.ITab)

Aggregations

PageBase (com.evolveum.midpoint.gui.api.page.PageBase)82 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)30 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)25 Task (com.evolveum.midpoint.task.api.Task)16 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)13 IModel (org.apache.wicket.model.IModel)12 Label (org.apache.wicket.markup.html.basic.Label)11 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)9 ArrayList (java.util.ArrayList)9 PageParameters (org.apache.wicket.request.mapper.parameter.PageParameters)9 List (java.util.List)8 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)7 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)6 RestartResponseException (org.apache.wicket.RestartResponseException)6 StringResourceModel (org.apache.wicket.model.StringResourceModel)6 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)5 PrismObject (com.evolveum.midpoint.prism.PrismObject)5 ConfirmationPanel (com.evolveum.midpoint.web.component.dialog.ConfirmationPanel)5 VisibleBehaviour (com.evolveum.midpoint.web.component.util.VisibleBehaviour)5 QName (javax.xml.namespace.QName)5