Search in sources :

Example 1 with ObjectSelectorType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectSelectorType 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)

Aggregations

EvaluatedPolicyRule (com.evolveum.midpoint.model.api.context.EvaluatedPolicyRule)1 EvaluatedPolicyRuleImpl (com.evolveum.midpoint.model.impl.lens.EvaluatedPolicyRuleImpl)1 GlobalPolicyRuleType (com.evolveum.midpoint.xml.ns._public.common.common_3.GlobalPolicyRuleType)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