Search in sources :

Example 6 with CompiledObjectCollectionView

use of com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView in project midpoint by Evolveum.

the class PageCertDefinitions method initLayout.

private void initLayout() {
    Form mainForm = new MidpointForm(ID_MAIN_FORM);
    add(mainForm);
    MainObjectListPanel<AccessCertificationDefinitionType> mainPanel = new MainObjectListPanel<AccessCertificationDefinitionType>(ID_TABLE, AccessCertificationDefinitionType.class, null) {

        private static final long serialVersionUID = 1L;

        @Override
        protected UserProfileStorage.TableId getTableId() {
            return UserProfileStorage.TableId.PAGE_CERT_DEFINITIONS_PANEL;
        }

        @Override
        protected IColumn<SelectableBean<AccessCertificationDefinitionType>, String> createCheckboxColumn() {
            return null;
        }

        @Override
        public void objectDetailsPerformed(AjaxRequestTarget target, AccessCertificationDefinitionType service) {
            PageCertDefinitions.this.detailsPerformed(target, service);
        }

        @Override
        protected List<InlineMenuItem> createInlineMenu() {
            return PageCertDefinitions.this.createInlineMenu();
        }

        @Override
        protected void newObjectPerformed(AjaxRequestTarget target, AssignmentObjectRelation relation, CompiledObjectCollectionView collectionView) {
            navigateToNext(PageCertDefinition.class);
        }
    };
    mainPanel.setOutputMarkupId(true);
    mainPanel.setAdditionalBoxCssClasses(GuiStyleConstants.CLASS_OBJECT_CERT_DEF_BOX_CSS_CLASSES);
    mainForm.add(mainPanel);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) UserProfileStorage(com.evolveum.midpoint.web.session.UserProfileStorage) AccessCertificationDefinitionType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationDefinitionType) MainObjectListPanel(com.evolveum.midpoint.gui.api.component.MainObjectListPanel) Form(org.apache.wicket.markup.html.form.Form) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) CompiledObjectCollectionView(com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) ButtonInlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem) AssignmentObjectRelation(com.evolveum.midpoint.model.api.AssignmentObjectRelation)

Example 7 with CompiledObjectCollectionView

use of com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView in project midpoint by Evolveum.

the class WebComponentUtil method isRefreshEnabled.

public static boolean isRefreshEnabled(PageBase pageBase, QName type) {
    CompiledGuiProfile cup = pageBase.getCompiledGuiProfile();
    if (cup == null) {
        return false;
    }
    List<CompiledObjectCollectionView> views = cup.getObjectCollectionViews();
    if (CollectionUtils.isEmpty(views)) {
        return false;
    }
    for (CompiledObjectCollectionView view : views) {
        if (QNameUtil.match(type, view.getContainerType())) {
            if (view.getRefreshInterval() != null) {
                return true;
            }
        }
    }
    return false;
}
Also used : CompiledObjectCollectionView(com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView) CompiledGuiProfile(com.evolveum.midpoint.model.api.authentication.CompiledGuiProfile)

Example 8 with CompiledObjectCollectionView

use of com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView in project midpoint by Evolveum.

the class ContainerableListPanel method getObjectCollectionView.

protected CompiledObjectCollectionView getObjectCollectionView() {
    CompiledObjectCollectionView containerPanelCollectionView = getCompiledCollectionViewFromPanelConfiguration();
    if (containerPanelCollectionView != null) {
        return containerPanelCollectionView;
    }
    CompiledObjectCollectionView view = getWidgetCollectionView();
    if (view != null) {
        return view;
    }
    String collectionName = getCollectionNameParameterValue().toString();
    return getPageBase().getCompiledGuiProfile().findObjectCollectionView(WebComponentUtil.containerClassToQName(getPageBase().getPrismContext(), getType()), collectionName);
}
Also used : CompiledObjectCollectionView(com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView) PolyString(com.evolveum.midpoint.prism.polystring.PolyString)

Example 9 with CompiledObjectCollectionView

use of com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView in project midpoint by Evolveum.

the class ContainerableListPanel method createSearchModel.

protected LoadableDetachableModel<Search<C>> createSearchModel() {
    return new LoadableDetachableModel<>() {

        private static final long serialVersionUID = 1L;

        @Override
        public Search<C> load() {
            Search<C> newSearch = createSearch(getType());
            Search<C> search = null;
            PageStorage storage = getPageStorage();
            String searchByName = getSearchByNameParameterValue();
            if (storage != null && searchByName == null) {
                // do NOT use storage when using name search (e.g. from dashboard)
                search = storage.getSearch();
            }
            if (search == null || (!SearchBoxModeType.ADVANCED.equals(search.getSearchType()) && !search.getAllDefinitions().containsAll(newSearch.getAllDefinitions())) || search.isTypeChanged()) {
                search = newSearch;
                search.searchWasReload();
            }
            if (searchByName != null) {
                if (SearchBoxModeType.FULLTEXT.equals(search.getSearchType())) {
                    search.setFullText(searchByName);
                } else {
                    for (PropertySearchItem<String> item : search.getPropertyItems()) {
                        if (ItemPath.create(ObjectType.F_NAME).equivalent(item.getPath())) {
                            item.setValue(new SearchValue<>(searchByName));
                        }
                    }
                }
            }
            if (isCollectionViewPanel()) {
                CompiledObjectCollectionView view = getObjectCollectionView();
                search.setCollectionSearchItem(new ObjectCollectionSearchItem(search, view));
                search.setCollectionItemVisible(isCollectionViewPanelForWidget());
                if (storage != null && view.getPaging() != null) {
                    ObjectPaging paging = ObjectQueryUtil.convertToObjectPaging(view.getPaging(), getPrismContext());
                    if (storage.getPaging() == null) {
                        storage.setPaging(paging);
                    }
                    if (getTableId() != null && paging.getMaxSize() != null && !getPageBase().getSessionStorage().getUserProfile().isExistPagingSize(getTableId())) {
                        getPageBase().getSessionStorage().getUserProfile().setPagingSize(getTableId(), paging.getMaxSize());
                    }
                }
            }
            if (storage != null) {
                storage.setSearch(search);
            }
            return search;
        }
    };
}
Also used : ObjectPaging(com.evolveum.midpoint.prism.query.ObjectPaging) LoadableDetachableModel(org.apache.wicket.model.LoadableDetachableModel) CompiledObjectCollectionView(com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) PageStorage(com.evolveum.midpoint.web.session.PageStorage)

Example 10 with CompiledObjectCollectionView

use of com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView in project midpoint by Evolveum.

the class ContainerableListPanel method createReportPerformed.

protected void createReportPerformed(AjaxRequestTarget target) {
    PrismContext prismContext = getPageBase().getPrismContext();
    PrismObjectDefinition<ReportType> def = prismContext.getSchemaRegistry().findObjectDefinitionByType(ReportType.COMPLEX_TYPE);
    PrismObject<ReportType> obj;
    try {
        obj = def.instantiate();
    } catch (SchemaException e) {
        LOGGER.error("Couldn't instantiate new report", e);
        getPageBase().error(getString("MainObjectListPanel.message.error.instantiateNewReport"));
        target.add(getPageBase().getFeedbackPanel());
        return;
    }
    ReportType report = obj.asObjectable();
    ObjectCollectionReportEngineConfigurationType objectCollection = new ObjectCollectionReportEngineConfigurationType();
    CompiledObjectCollectionView view = getObjectCollectionView();
    CollectionRefSpecificationType collection = new CollectionRefSpecificationType();
    objectCollection.setUseOnlyReportView(true);
    if (view != null) {
        objectCollection.setView(view.toGuiObjectListViewType());
        if (view.getCollection() != null && view.getCollection().getCollectionRef() != null) {
            if (!QNameUtil.match(view.getCollection().getCollectionRef().getType(), ArchetypeType.COMPLEX_TYPE)) {
                collection.setBaseCollectionRef(view.getCollection());
            } else {
                OperationResult result = new OperationResult(MainObjectListPanel.class.getSimpleName() + "." + "evaluateExpressionsInFilter");
                CollectionRefSpecificationType baseCollection = new CollectionRefSpecificationType();
                try {
                    baseCollection.setFilter(getPageBase().getQueryConverter().createSearchFilterType(WebComponentUtil.evaluateExpressionsInFilter(view.getFilter(), result, getPageBase())));
                    collection.setBaseCollectionRef(baseCollection);
                } catch (SchemaException e) {
                    LOGGER.error("Couldn't create filter for archetype");
                    getPageBase().error(getString("MainObjectListPanel.message.error.createArchetypeFilter"));
                    target.add(getPageBase().getFeedbackPanel());
                }
            }
        }
    } else {
        objectCollection.setView(getDefaultView());
    }
    SearchFilterType searchFilter = null;
    ObjectQuery query = getSearchModel().getObject().createObjectQuery(getPageBase());
    if (query != null) {
        ObjectFilter filter = query.getFilter();
        try {
            searchFilter = getPageBase().getPrismContext().getQueryConverter().createSearchFilterType(filter);
        } catch (Exception e) {
            LOGGER.error("Couldn't create filter from search panel", e);
            getPageBase().error(getString("ExportingFilterTabPanel.message.error.serializeFilterFromSearch"));
        }
    }
    if (searchFilter != null) {
        collection.setFilter(searchFilter);
    } else {
        try {
            SearchFilterType allFilter = prismContext.getQueryConverter().createSearchFilterType(prismContext.queryFactory().createAll());
            collection.setFilter(allFilter);
        } catch (SchemaException e) {
            LOGGER.error("Couldn't create all filter", e);
            getPageBase().error(getString("MainObjectListPanel.message.error.createAllFilter"));
            target.add(getPageBase().getFeedbackPanel());
            return;
        }
    }
    objectCollection.setCollection(collection);
    report.setObjectCollection(objectCollection);
    report.getAssignment().add(ObjectTypeUtil.createAssignmentTo(SystemObjectsType.ARCHETYPE_COLLECTION_REPORT.value(), ObjectTypes.ARCHETYPE, prismContext));
    report.getArchetypeRef().add(ObjectTypeUtil.createObjectRef(SystemObjectsType.ARCHETYPE_COLLECTION_REPORT.value(), ObjectTypes.ARCHETYPE));
    PageReport pageReport = new PageReport(report.asPrismObject());
    getPageBase().navigateToNext(pageReport);
}
Also used : MainObjectListPanel(com.evolveum.midpoint.gui.api.component.MainObjectListPanel) PageReport(com.evolveum.midpoint.gui.impl.page.admin.report.PageReport) SearchFilterType(com.evolveum.prism.xml.ns._public.query_3.SearchFilterType) CompiledObjectCollectionView(com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ObjectFilter(com.evolveum.midpoint.prism.query.ObjectFilter) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery)

Aggregations

CompiledObjectCollectionView (com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView)41 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)14 AssignmentObjectRelation (com.evolveum.midpoint.model.api.AssignmentObjectRelation)13 WebPage (org.apache.wicket.markup.html.WebPage)8 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)7 MainObjectListPanel (com.evolveum.midpoint.gui.api.component.MainObjectListPanel)6 ArrayList (java.util.ArrayList)6 MultiCompositedButtonPanel (com.evolveum.midpoint.web.component.MultiCompositedButtonPanel)5 InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)5 UserProfileStorage (com.evolveum.midpoint.web.session.UserProfileStorage)5 MultiFunctinalButtonDto (com.evolveum.midpoint.web.component.MultiFunctinalButtonDto)4 VisibleBehaviour (com.evolveum.midpoint.web.component.util.VisibleBehaviour)4 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)4 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)3 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)3 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)3 ButtonInlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem)3 SelectableBean (com.evolveum.midpoint.web.component.util.SelectableBean)3 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)3 Form (org.apache.wicket.markup.html.form.Form)3