Search in sources :

Example 26 with CompiledObjectCollectionView

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

the class ExportDashboardActivitySupport method setupCompiledViewsForWidgets.

private void setupCompiledViewsForWidgets(OperationResult result) throws CommonException {
    mapOfCompiledViews = new LinkedHashMap<>();
    List<DashboardWidgetType> widgets = dashboard.getWidget();
    for (DashboardWidgetType widget : widgets) {
        if (isWidgetTableVisible()) {
            CompiledObjectCollectionView compiledView = reportService.createCompiledView(report.getDashboard(), widget, runningTask, result);
            DisplayType newDisplay = widget.getDisplay();
            if (compiledView.getDisplay() == null) {
                compiledView.setDisplay(newDisplay);
            } else if (newDisplay != null) {
                MiscSchemaUtil.mergeDisplay(compiledView.getDisplay(), newDisplay);
            }
            compiledView.setViewIdentifier(widget.getIdentifier());
            mapOfCompiledViews.put(widget.getIdentifier(), compiledView);
        }
    }
}
Also used : CompiledObjectCollectionView(com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView)

Example 27 with CompiledObjectCollectionView

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

the class MultifunctionalButton method initLayout.

private void initLayout() {
    AjaxCompositedIconButton mainButton = new AjaxCompositedIconButton(ID_MAIN_BUTTON, new PropertyModel<>(getModel(), MultiFunctinalButtonDto.F_MAIN_BUTTON)) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            if (!additionalButtonsExist()) {
                buttonClickPerformed(target, null, null);
            }
        }
    };
    mainButton.add(AttributeAppender.append(" data-toggle", additionalButtonsExist() ? "dropdown" : ""));
    // if (!additionalButtonsExist()) {
    mainButton.add(new VisibleBehaviour(this::isMainButtonVisible));
    // }
    add(mainButton);
    MultiCompositedButtonPanel buttonsPanel = new MultiCompositedButtonPanel(ID_BUTTON, new PropertyModel<>(getModel(), MultiFunctinalButtonDto.F_ADDITIONAL_BUTTONS)) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void buttonClickPerformed(AjaxRequestTarget target, AssignmentObjectRelation relationSpec, CompiledObjectCollectionView collectionViews, Class<? extends WebPage> page) {
            MultifunctionalButton.this.buttonClickPerformed(target, relationSpec, collectionViews);
        }
    };
    buttonsPanel.setOutputMarkupId(true);
    buttonsPanel.add(new VisibleBehaviour(this::additionalButtonsExist));
    add(buttonsPanel);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxCompositedIconButton(com.evolveum.midpoint.gui.impl.component.AjaxCompositedIconButton) WebPage(org.apache.wicket.markup.html.WebPage) VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) CompiledObjectCollectionView(com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView) AssignmentObjectRelation(com.evolveum.midpoint.model.api.AssignmentObjectRelation)

Example 28 with CompiledObjectCollectionView

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

the class TaskTablePanel method getNewTaskInfluencesList.

private List<CompiledObjectCollectionView> getNewTaskInfluencesList(List<String> oids) {
    List<CompiledObjectCollectionView> compiledObjectCollectionViews = getPageBase().getCompiledGuiProfile().findAllApplicableArchetypeViews(TaskType.COMPLEX_TYPE, OperationTypeType.ADD);
    List<CompiledObjectCollectionView> filteredObjectCollectionViews = new ArrayList<>();
    for (CompiledObjectCollectionView compiledObjectCollectionView : compiledObjectCollectionViews) {
        for (String oid : oids) {
            if (isViewForObjectCollectionType(compiledObjectCollectionView, oid, ArchetypeType.COMPLEX_TYPE)) {
                filteredObjectCollectionViews.add(compiledObjectCollectionView);
            }
        }
    }
    return filteredObjectCollectionViews;
}
Also used : CompiledObjectCollectionView(com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView)

Example 29 with CompiledObjectCollectionView

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

the class ReportServiceImpl method createCompiledView.

public CompiledObjectCollectionView createCompiledView(DashboardReportEngineConfigurationType dashboardConfig, DashboardWidgetType widget, Task task, OperationResult result) throws CommonException {
    MiscUtil.stateCheck(dashboardConfig != null, "Dashboard engine in report couldn't be null.");
    DashboardWidgetPresentationType presentation = widget.getPresentation();
    MiscUtil.stateCheck(!DashboardUtils.isDataFieldsOfPresentationNullOrEmpty(presentation), "DataField of presentation couldn't be null.");
    DashboardWidgetSourceTypeType sourceType = DashboardUtils.getSourceType(widget);
    MiscUtil.stateCheck(sourceType != null, "No source type specified in " + widget);
    CompiledObjectCollectionView compiledCollection = new CompiledObjectCollectionView();
    if (widget.getPresentation() != null && widget.getPresentation().getView() != null) {
        getModelInteractionService().applyView(compiledCollection, widget.getPresentation().getView());
    }
    CollectionRefSpecificationType collectionRefSpecification = getDashboardService().getCollectionRefSpecificationType(widget, task, result);
    if (collectionRefSpecification != null) {
        @NotNull CompiledObjectCollectionView compiledCollectionRefSpec = getModelInteractionService().compileObjectCollectionView(collectionRefSpecification, compiledCollection.getTargetClass(prismContext), task, result);
        getModelInteractionService().applyView(compiledCollectionRefSpec, compiledCollection.toGuiObjectListViewType());
        compiledCollection = compiledCollectionRefSpec;
    }
    GuiObjectListViewType reportView = getReportViewByType(dashboardConfig, ObjectUtils.defaultIfNull(compiledCollection.getContainerType(), ObjectType.COMPLEX_TYPE));
    if (reportView != null) {
        getModelInteractionService().applyView(compiledCollection, reportView);
    }
    if (compiledCollection.getColumns().isEmpty()) {
        Class<Containerable> type = resolveTypeForReport(compiledCollection);
        getModelInteractionService().applyView(compiledCollection, DefaultColumnUtils.getDefaultView(ObjectUtils.defaultIfNull(type, ObjectType.class)));
    }
    return compiledCollection;
}
Also used : CompiledObjectCollectionView(com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView) NotNull(org.jetbrains.annotations.NotNull)

Example 30 with CompiledObjectCollectionView

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

the class DefaultGuiConfigurationCompiler method compileDefaultCollectionViews.

private List<CompiledObjectCollectionView> compileDefaultCollectionViews(Collection<Class<?>> classes) {
    List<CompiledObjectCollectionView> compiledObjectCollectionViews = new ArrayList<>();
    for (Class<?> clazz : classes) {
        CollectionInstance collectionInstance = clazz.getAnnotation(CollectionInstance.class);
        if (collectionInstance == null) {
            continue;
        }
        ObjectTypes objectType = ObjectTypes.getObjectType(collectionInstance.applicableForType());
        CompiledObjectCollectionView defaultCollectionView = new CompiledObjectCollectionView(objectType.getTypeQName(), collectionInstance.identifier());
        defaultCollectionView.setDisplay(createDisplayType(collectionInstance.display()));
        compiledObjectCollectionViews.add(defaultCollectionView);
        defaultCollectionView.setDefaultView(true);
        if (collectionInstance.applicableForOperation().length == 1) {
            defaultCollectionView.setApplicableForOperation(collectionInstance.applicableForOperation()[0]);
        }
    }
    return compiledObjectCollectionViews;
}
Also used : CompiledObjectCollectionView(com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView) ObjectTypes(com.evolveum.midpoint.schema.constants.ObjectTypes)

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