Search in sources :

Example 1 with TreeNode

use of com.evolveum.midpoint.util.TreeNode in project midpoint by Evolveum.

the class EvaluatedTriggerGroupDto method initializeFromRules.

public static EvaluatedTriggerGroupDto initializeFromRules(List<EvaluatedPolicyRuleType> rules, boolean highlighted, UniquenessFilter uniquenessFilter) {
    List<AugmentedTrigger<HighlightingInformation>> augmentedTriggers = new ArrayList<>();
    for (EvaluatedPolicyRuleType rule : rules) {
        for (EvaluatedPolicyRuleTriggerType trigger : rule.getTrigger()) {
            augmentedTriggers.add(new AugmentedTrigger<>(trigger, new HighlightingInformation(highlighted)));
        }
    }
    List<TreeNode<AugmentedTrigger<HighlightingInformation>>> triggerTrees = arrangeForPresentationExt(augmentedTriggers, uniquenessFilter);
    return new EvaluatedTriggerGroupDto(null, triggerTrees);
}
Also used : AugmentedTrigger(com.evolveum.midpoint.model.api.util.EvaluatedPolicyRuleUtil.AugmentedTrigger) EvaluatedPolicyRuleType(com.evolveum.midpoint.xml.ns._public.common.common_3.EvaluatedPolicyRuleType) EvaluatedPolicyRuleTriggerType(com.evolveum.midpoint.xml.ns._public.common.common_3.EvaluatedPolicyRuleTriggerType) TreeNode(com.evolveum.midpoint.util.TreeNode) ArrayList(java.util.ArrayList)

Example 2 with TreeNode

use of com.evolveum.midpoint.util.TreeNode in project midpoint by Evolveum.

the class CaseManagementHelper method addChildren.

private void addChildren(TreeNode<CaseType> tree, OperationResult result) throws SchemaException {
    ObjectQuery query = prismContext.queryFor(CaseType.class).item(CaseType.F_PARENT_REF).ref(tree.getUserObject().getOid()).build();
    SearchResultList<PrismObject<CaseType>> children = repositoryService.searchObjects(CaseType.class, query, null, result);
    for (PrismObject<CaseType> child : children) {
        TreeNode<CaseType> childNode = new TreeNode<>(child.asObjectable());
        tree.add(childNode);
        addChildren(childNode, result);
    }
}
Also used : PrismObject(com.evolveum.midpoint.prism.PrismObject) CaseType(com.evolveum.midpoint.xml.ns._public.common.common_3.CaseType) TreeNode(com.evolveum.midpoint.util.TreeNode) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery)

Example 3 with TreeNode

use of com.evolveum.midpoint.util.TreeNode in project midpoint by Evolveum.

the class PolicySituationConstraintEvaluator method createMessage.

private LocalizableMessage createMessage(Collection<EvaluatedPolicyRule> sourceRules, JAXBElement<PolicySituationPolicyConstraintType> constraintElement, PolicyRuleEvaluationContext<?> ctx, OperationResult result) throws ExpressionEvaluationException, ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, SecurityViolationException {
    // determine if there's a single message that could be retrieved
    List<TreeNode<LocalizableMessage>> messageTrees = sourceRules.stream().flatMap(r -> r.extractMessages().stream()).collect(Collectors.toList());
    LocalizableMessage builtInMessage;
    if (messageTrees.size() == 1) {
        builtInMessage = messageTrees.get(0).getUserObject();
    } else {
        builtInMessage = new LocalizableMessageBuilder().key(SchemaConstants.DEFAULT_POLICY_CONSTRAINT_KEY_PREFIX + CONSTRAINT_KEY).build();
    }
    return evaluatorHelper.createLocalizableMessage(constraintElement, ctx, builtInMessage, result);
}
Also used : SchemaConstants(com.evolveum.midpoint.schema.constants.SchemaConstants) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ConfigurationException(com.evolveum.midpoint.util.exception.ConfigurationException) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) Autowired(org.springframework.beans.factory.annotation.Autowired) ExpressionEvaluationException(com.evolveum.midpoint.util.exception.ExpressionEvaluationException) SecurityViolationException(com.evolveum.midpoint.util.exception.SecurityViolationException) EvaluatedPolicyRule(com.evolveum.midpoint.model.api.context.EvaluatedPolicyRule) EvaluatedAssignmentImpl(com.evolveum.midpoint.model.impl.lens.assignments.EvaluatedAssignmentImpl) LocalizableMessage(com.evolveum.midpoint.util.LocalizableMessage) EvaluatedSituationTrigger(com.evolveum.midpoint.model.api.context.EvaluatedSituationTrigger) AssignmentHolderType(com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentHolderType) ObjectNotFoundException(com.evolveum.midpoint.util.exception.ObjectNotFoundException) JAXBElement(javax.xml.bind.JAXBElement) Collection(java.util.Collection) AssignmentPolicyRuleEvaluationContext(com.evolveum.midpoint.model.impl.lens.projector.policy.AssignmentPolicyRuleEvaluationContext) PolicyRuleEvaluationContext(com.evolveum.midpoint.model.impl.lens.projector.policy.PolicyRuleEvaluationContext) PolicySituationPolicyConstraintType(com.evolveum.midpoint.xml.ns._public.common.common_3.PolicySituationPolicyConstraintType) LocalizableMessageBuilder(com.evolveum.midpoint.util.LocalizableMessageBuilder) TreeNode(com.evolveum.midpoint.util.TreeNode) Collectors(java.util.stream.Collectors) Component(org.springframework.stereotype.Component) List(java.util.List) CommunicationException(com.evolveum.midpoint.util.exception.CommunicationException) NotNull(org.jetbrains.annotations.NotNull) TreeNode(com.evolveum.midpoint.util.TreeNode) LocalizableMessage(com.evolveum.midpoint.util.LocalizableMessage) LocalizableMessageBuilder(com.evolveum.midpoint.util.LocalizableMessageBuilder)

Example 4 with TreeNode

use of com.evolveum.midpoint.util.TreeNode in project midpoint by Evolveum.

the class PolicySituationConstraintEvaluator method createShortMessage.

private LocalizableMessage createShortMessage(Collection<EvaluatedPolicyRule> sourceRules, JAXBElement<PolicySituationPolicyConstraintType> constraintElement, PolicyRuleEvaluationContext<?> ctx, OperationResult result) throws ExpressionEvaluationException, ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, SecurityViolationException {
    // determine if there's a single message that could be retrieved
    List<TreeNode<LocalizableMessage>> messageTrees = sourceRules.stream().flatMap(r -> r.extractShortMessages().stream()).collect(Collectors.toList());
    LocalizableMessage builtInMessage;
    if (messageTrees.size() == 1) {
        builtInMessage = messageTrees.get(0).getUserObject();
    } else {
        builtInMessage = new LocalizableMessageBuilder().key(SchemaConstants.DEFAULT_POLICY_CONSTRAINT_SHORT_MESSAGE_KEY_PREFIX + CONSTRAINT_KEY).build();
    }
    return evaluatorHelper.createLocalizableShortMessage(constraintElement, ctx, builtInMessage, result);
}
Also used : SchemaConstants(com.evolveum.midpoint.schema.constants.SchemaConstants) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ConfigurationException(com.evolveum.midpoint.util.exception.ConfigurationException) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) Autowired(org.springframework.beans.factory.annotation.Autowired) ExpressionEvaluationException(com.evolveum.midpoint.util.exception.ExpressionEvaluationException) SecurityViolationException(com.evolveum.midpoint.util.exception.SecurityViolationException) EvaluatedPolicyRule(com.evolveum.midpoint.model.api.context.EvaluatedPolicyRule) EvaluatedAssignmentImpl(com.evolveum.midpoint.model.impl.lens.assignments.EvaluatedAssignmentImpl) LocalizableMessage(com.evolveum.midpoint.util.LocalizableMessage) EvaluatedSituationTrigger(com.evolveum.midpoint.model.api.context.EvaluatedSituationTrigger) AssignmentHolderType(com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentHolderType) ObjectNotFoundException(com.evolveum.midpoint.util.exception.ObjectNotFoundException) JAXBElement(javax.xml.bind.JAXBElement) Collection(java.util.Collection) AssignmentPolicyRuleEvaluationContext(com.evolveum.midpoint.model.impl.lens.projector.policy.AssignmentPolicyRuleEvaluationContext) PolicyRuleEvaluationContext(com.evolveum.midpoint.model.impl.lens.projector.policy.PolicyRuleEvaluationContext) PolicySituationPolicyConstraintType(com.evolveum.midpoint.xml.ns._public.common.common_3.PolicySituationPolicyConstraintType) LocalizableMessageBuilder(com.evolveum.midpoint.util.LocalizableMessageBuilder) TreeNode(com.evolveum.midpoint.util.TreeNode) Collectors(java.util.stream.Collectors) Component(org.springframework.stereotype.Component) List(java.util.List) CommunicationException(com.evolveum.midpoint.util.exception.CommunicationException) NotNull(org.jetbrains.annotations.NotNull) TreeNode(com.evolveum.midpoint.util.TreeNode) LocalizableMessage(com.evolveum.midpoint.util.LocalizableMessage) LocalizableMessageBuilder(com.evolveum.midpoint.util.LocalizableMessageBuilder)

Aggregations

TreeNode (com.evolveum.midpoint.util.TreeNode)4 EvaluatedPolicyRule (com.evolveum.midpoint.model.api.context.EvaluatedPolicyRule)2 EvaluatedSituationTrigger (com.evolveum.midpoint.model.api.context.EvaluatedSituationTrigger)2 EvaluatedAssignmentImpl (com.evolveum.midpoint.model.impl.lens.assignments.EvaluatedAssignmentImpl)2 AssignmentPolicyRuleEvaluationContext (com.evolveum.midpoint.model.impl.lens.projector.policy.AssignmentPolicyRuleEvaluationContext)2 PolicyRuleEvaluationContext (com.evolveum.midpoint.model.impl.lens.projector.policy.PolicyRuleEvaluationContext)2 SchemaConstants (com.evolveum.midpoint.schema.constants.SchemaConstants)2 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)2 LocalizableMessage (com.evolveum.midpoint.util.LocalizableMessage)2 LocalizableMessageBuilder (com.evolveum.midpoint.util.LocalizableMessageBuilder)2 CommunicationException (com.evolveum.midpoint.util.exception.CommunicationException)2 ConfigurationException (com.evolveum.midpoint.util.exception.ConfigurationException)2 ExpressionEvaluationException (com.evolveum.midpoint.util.exception.ExpressionEvaluationException)2 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)2 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)2 SecurityViolationException (com.evolveum.midpoint.util.exception.SecurityViolationException)2 AssignmentHolderType (com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentHolderType)2 PolicySituationPolicyConstraintType (com.evolveum.midpoint.xml.ns._public.common.common_3.PolicySituationPolicyConstraintType)2 Collection (java.util.Collection)2 List (java.util.List)2