Search in sources :

Example 1 with GlobalPolicyRuleType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.GlobalPolicyRuleType in project midpoint by Evolveum.

the class FocusProcessor method triggerGlobalRules.

private <F extends FocusType> void triggerGlobalRules(LensContext<F> context) throws SchemaException, PolicyViolationException {
    PrismObject<SystemConfigurationType> systemConfiguration = context.getSystemConfiguration();
    if (systemConfiguration == null) {
        return;
    }
    LensFocusContext<F> focusContext = context.getFocusContext();
    // We need to consider object before modification here. We need to prohibit the modification, so we
    // cannot look at modified object.
    PrismObject<F> focus = focusContext.getObjectCurrent();
    if (focus == null) {
        focus = focusContext.getObjectNew();
    }
    for (GlobalPolicyRuleType globalPolicyRule : systemConfiguration.asObjectable().getGlobalPolicyRule()) {
        ObjectSelectorType focusSelector = globalPolicyRule.getFocusSelector();
        if (cacheRepositoryService.selectorMatches(focusSelector, focus, LOGGER, "Global policy rule " + globalPolicyRule.getName() + ": ")) {
            EvaluatedPolicyRule evaluatedRule = new EvaluatedPolicyRuleImpl(globalPolicyRule, null);
            triggerRule(focusContext, evaluatedRule);
        }
    }
}
Also used : EvaluatedPolicyRule(com.evolveum.midpoint.model.api.context.EvaluatedPolicyRule) GlobalPolicyRuleType(com.evolveum.midpoint.xml.ns._public.common.common_3.GlobalPolicyRuleType) EvaluatedPolicyRuleImpl(com.evolveum.midpoint.model.impl.lens.EvaluatedPolicyRuleImpl) SystemConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType) ObjectSelectorType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectSelectorType)

Example 2 with GlobalPolicyRuleType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.GlobalPolicyRuleType in project midpoint by Evolveum.

the class GlobalPolicyRuleTabPanel method initBasicColumns.

private List<IColumn<PrismContainerValueWrapper<GlobalPolicyRuleType>, String>> initBasicColumns() {
    List<IColumn<PrismContainerValueWrapper<GlobalPolicyRuleType>, String>> columns = new ArrayList<>();
    columns.add(new CheckBoxHeaderColumn<>());
    PrismPropertyWrapperColumn<GlobalPolicyRuleType, String> linkColumn = new PrismPropertyWrapperColumn<GlobalPolicyRuleType, String>(getModel(), GlobalPolicyRuleType.F_NAME, ColumnType.LINK, getPageBase()) {

        @Override
        protected void onClick(AjaxRequestTarget target, IModel<PrismContainerValueWrapper<GlobalPolicyRuleType>> rowModel) {
            getMultivalueContainerListPanel().itemDetailsPerformed(target, rowModel);
        }

        protected DisplayType getIconDisplayType(IModel<PrismContainerValueWrapper<GlobalPolicyRuleType>> rowModel) {
            return GuiDisplayTypeUtil.createDisplayType(WebComponentUtil.createDefaultBlackIcon(SystemConfigurationType.COMPLEX_TYPE));
        }
    };
    columns.add(linkColumn);
    columns.add(new PrismContainerWrapperColumn<>(getModel(), GlobalPolicyRuleType.F_POLICY_CONSTRAINTS, getPageBase()));
    columns.add(new PrismContainerWrapperColumn<>(getModel(), GlobalPolicyRuleType.F_POLICY_ACTIONS, getPageBase()));
    columns.add(new PrismPropertyWrapperColumn<GlobalPolicyRuleType, String>(getModel(), GlobalPolicyRuleType.F_POLICY_SITUATION, ColumnType.STRING, getPageBase()));
    List<InlineMenuItem> menuActionsList = getMultivalueContainerListPanel().getDefaultMenuActions();
    columns.add(new InlineMenuButtonColumn(menuActionsList, getPageBase()) {

        private static final long serialVersionUID = 1L;

        @Override
        public String getCssClass() {
            return " col-md-1 ";
        }
    });
    return columns;
}
Also used : IModel(org.apache.wicket.model.IModel) PrismPropertyWrapperColumn(com.evolveum.midpoint.gui.impl.component.data.column.PrismPropertyWrapperColumn) InlineMenuButtonColumn(com.evolveum.midpoint.web.component.data.column.InlineMenuButtonColumn) ArrayList(java.util.ArrayList) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) GlobalPolicyRuleType(com.evolveum.midpoint.xml.ns._public.common.common_3.GlobalPolicyRuleType) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)

Aggregations

GlobalPolicyRuleType (com.evolveum.midpoint.xml.ns._public.common.common_3.GlobalPolicyRuleType)2 PrismPropertyWrapperColumn (com.evolveum.midpoint.gui.impl.component.data.column.PrismPropertyWrapperColumn)1 EvaluatedPolicyRule (com.evolveum.midpoint.model.api.context.EvaluatedPolicyRule)1 EvaluatedPolicyRuleImpl (com.evolveum.midpoint.model.impl.lens.EvaluatedPolicyRuleImpl)1 InlineMenuButtonColumn (com.evolveum.midpoint.web.component.data.column.InlineMenuButtonColumn)1 InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)1 ObjectSelectorType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectSelectorType)1 SystemConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType)1 ArrayList (java.util.ArrayList)1 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)1 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)1 IModel (org.apache.wicket.model.IModel)1