Search in sources :

Example 21 with CompiledObjectCollectionView

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

the class ObjectCollectionViewFinder method assertCount.

public ObjectCollectionViewsAsserter<RA> assertCount(int expectedCount) throws ObjectNotFoundException, SchemaException {
    int foundCount = 0;
    for (CompiledObjectCollectionView view : viewsAsserter.getViews()) {
        if (matches(view)) {
            foundCount++;
        }
    }
    assertEquals("Wrong number of links for specified criteria in " + viewsAsserter.desc(), expectedCount, foundCount);
    return viewsAsserter;
}
Also used : CompiledObjectCollectionView(com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView)

Example 22 with CompiledObjectCollectionView

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

the class DashboardServiceImpl method generateNumberMessageForCollection.

private String generateNumberMessageForCollection(DashboardWidgetType widget, DashboardWidget data, Task task, OperationResult result) throws SchemaException, CommunicationException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException, ObjectNotFoundException {
    CollectionRefSpecificationType collectionSpec = getCollectionRefSpecificationType(widget, task, result);
    if (collectionSpec != null) {
        CompiledObjectCollectionView compiledCollection = modelInteractionService.compileObjectCollectionView(collectionSpec, null, task, task.getResult());
        CollectionStats collStats = modelInteractionService.determineCollectionStats(compiledCollection, task, result);
        // getObjectCount(valueCollection, true, task, result);
        Integer value = collStats.getObjectCount();
        Integer domainValue = collStats.getDomainCount();
        IntegerStatType statType = generateIntegerStat(value, domainValue);
        Collection<EvaluatedPolicyRule> evalPolicyRules = new ArrayList<>();
        if (collectionSpec.getCollectionRef() != null && QNameUtil.match(ObjectCollectionType.COMPLEX_TYPE, collectionSpec.getCollectionRef().getType())) {
            ObjectCollectionType valueCollection = getObjectCollectionType(widget, task, result);
            evalPolicyRules = modelInteractionService.evaluateCollectionPolicyRules(valueCollection.asPrismObject(), compiledCollection, null, task, task.getResult());
        }
        Collection<String> policySituations = new ArrayList<>();
        for (EvaluatedPolicyRule evalPolicyRule : evalPolicyRules) {
            if (!evalPolicyRule.getAllTriggers().isEmpty()) {
                policySituations.add(evalPolicyRule.getPolicySituation());
            }
        }
        return generateNumberMessage(widget, createVariables(null, statType, policySituations, null), data);
    } else {
        LOGGER.error("CollectionRefSpecificationType is null in widget " + widget.getIdentifier());
    }
    return null;
}
Also used : EvaluatedPolicyRule(com.evolveum.midpoint.model.api.context.EvaluatedPolicyRule) CompiledObjectCollectionView(com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView) CollectionStats(com.evolveum.midpoint.model.api.CollectionStats)

Example 23 with CompiledObjectCollectionView

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

the class CollectionProcessor method compileObjectCollectionView.

public CompiledObjectCollectionView compileObjectCollectionView(CollectionRefSpecificationType collectionRef, Class<? extends Containerable> targetTypeClass, Task task, OperationResult result) throws SchemaException, CommunicationException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException, ObjectNotFoundException {
    CompiledObjectCollectionView view = new CompiledObjectCollectionView();
    compileObjectCollectionView(view, collectionRef, targetTypeClass, task, result);
    return view;
}
Also used : CompiledObjectCollectionView(com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView)

Example 24 with CompiledObjectCollectionView

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

the class HtmlDashboardReportDataWriter method setupDefaultExportedWidgetData.

private void setupDefaultExportedWidgetData(ReportServiceImpl reportService) {
    ExportedWidgetData widgetData = new ExportedWidgetData();
    CompiledObjectCollectionView compiledView = new CompiledObjectCollectionView();
    compiledView.setViewIdentifier(GenericSupport.getMessage(localizationService, CommonHtmlSupport.REPORT_WIDGET_TABLE_NAME));
    widgetData.setSupport(new CommonHtmlSupport(reportService.getClock(), compiledView));
    data.put(BASIC_WIDGET_ROW_KEY, widgetData);
}
Also used : CompiledObjectCollectionView(com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView)

Example 25 with CompiledObjectCollectionView

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

the class ReportServiceImpl method createCompiledView.

public CompiledObjectCollectionView createCompiledView(ObjectCollectionReportEngineConfigurationType collectionConfig, boolean useDefaultView, Task task, OperationResult result) throws CommunicationException, ObjectNotFoundException, SchemaException, SecurityViolationException, ConfigurationException, ExpressionEvaluationException {
    Validate.notNull(collectionConfig, "Collection engine in report couldn't be null.");
    CompiledObjectCollectionView compiledCollection = new CompiledObjectCollectionView();
    GuiObjectListViewType reportView = collectionConfig.getView();
    if (reportView != null) {
        getModelInteractionService().applyView(compiledCollection, reportView);
    }
    CollectionRefSpecificationType collectionRefSpecification = collectionConfig.getCollection();
    if (collectionRefSpecification != null) {
        @NotNull CompiledObjectCollectionView compiledCollectionRefSpec = getModelInteractionService().compileObjectCollectionView(collectionRefSpecification, compiledCollection.getTargetClass(prismContext), task, result);
        if (Boolean.TRUE.equals(collectionConfig.isUseOnlyReportView())) {
            compiledCollectionRefSpec.getColumns().clear();
        }
        getModelInteractionService().applyView(compiledCollectionRefSpec, compiledCollection.toGuiObjectListViewType());
        compiledCollection = compiledCollectionRefSpec;
    }
    if (compiledCollection.getColumns().isEmpty()) {
        if (useDefaultView) {
            Class<Containerable> type = resolveTypeForReport(compiledCollection);
            getModelInteractionService().applyView(compiledCollection, DefaultColumnUtils.getDefaultView(ObjectUtils.defaultIfNull(type, ObjectType.class)));
        } else {
            return null;
        }
    }
    return compiledCollection;
}
Also used : CompiledObjectCollectionView(com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView) NotNull(org.jetbrains.annotations.NotNull)

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