Search in sources :

Example 96 with ItemPathType

use of com.evolveum.prism.xml.ns._public.types_3.ItemPathType in project midpoint by Evolveum.

the class FocusLifecycleProcessor method executeDataReduction.

private <F extends AssignmentHolderType> void executeDataReduction(LensContext<F> context, LifecycleStateActionDataReductionType dataReduction) throws SchemaException {
    if (dataReduction == null) {
        return;
    }
    LensFocusContext<F> focusContext = context.getFocusContext();
    PrismObjectDefinition<F> focusDefinition = focusContext.getObjectDefinition();
    for (ItemPathType purgeItemPathType : dataReduction.getPurgeItem()) {
        ItemPath purgeItemPath = purgeItemPathType.getItemPath();
        LOGGER.trace("Purging item {} from {}", purgeItemPath, focusContext.getObjectNew());
        ItemDefinition purgeItemDef = focusDefinition.findItemDefinition(purgeItemPath);
        ItemDelta purgeItemDelta = purgeItemDef.createEmptyDelta(purgeItemPath);
        purgeItemDelta.setValueToReplace();
        focusContext.swallowToSecondaryDelta(purgeItemDelta);
    }
}
Also used : ItemPathType(com.evolveum.prism.xml.ns._public.types_3.ItemPathType) ItemPath(com.evolveum.midpoint.prism.path.ItemPath)

Example 97 with ItemPathType

use of com.evolveum.prism.xml.ns._public.types_3.ItemPathType in project midpoint by Evolveum.

the class ModelInteractionServiceImpl method getPath.

private ItemPath getPath(PolicyItemDefinitionType policyItemDefinition) {
    PolicyItemTargetType target = policyItemDefinition.getTarget();
    if (target == null) {
        return null;
    }
    ItemPathType itemPathType = target.getPath();
    return itemPathType != null ? itemPathType.getItemPath() : null;
}
Also used : ItemPathType(com.evolveum.prism.xml.ns._public.types_3.ItemPathType)

Example 98 with ItemPathType

use of com.evolveum.prism.xml.ns._public.types_3.ItemPathType in project midpoint by Evolveum.

the class SchemaTransformer method getVisibilityPolicy.

@NotNull
private <O extends ObjectType> List<VisibilityPolicyEntry> getVisibilityPolicy(ArchetypePolicyType archetypePolicy, Object contextDesc) throws SchemaException {
    List<VisibilityPolicyEntry> visibilityPolicy = new ArrayList<>();
    for (ItemConstraintType itemConstraint : archetypePolicy.getItemConstraint()) {
        UserInterfaceElementVisibilityType visibility = itemConstraint.getVisibility();
        if (visibility != null) {
            ItemPathType itemPathType = itemConstraint.getPath();
            if (itemPathType == null) {
                throw new SchemaException("No 'path' in item definition in archetype policy for " + contextDesc);
            }
            UniformItemPath itemPath = prismContext.toUniformPath(itemPathType);
            visibilityPolicy.add(new VisibilityPolicyEntry(itemPath, visibility));
        }
    }
    return visibilityPolicy;
}
Also used : ItemPathType(com.evolveum.prism.xml.ns._public.types_3.ItemPathType) UniformItemPath(com.evolveum.midpoint.prism.path.UniformItemPath) UserInterfaceElementVisibilityType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserInterfaceElementVisibilityType) NotNull(org.jetbrains.annotations.NotNull)

Example 99 with ItemPathType

use of com.evolveum.prism.xml.ns._public.types_3.ItemPathType in project midpoint by Evolveum.

the class TestAssignmentProcessor2 method createCondition.

private MappingType createCondition(String conditionName, char conditionType) {
    ScriptExpressionEvaluatorType script = new ScriptExpressionEvaluatorType();
    switch(conditionType) {
        case '+':
            script.setCode("basic.stringify(name) == 'jack1'");
            break;
        case '-':
            script.setCode("basic.stringify(name) == 'jack'");
            break;
        case '0':
            script.setCode("basic.stringify(name) == 'never there'");
            break;
        case '!':
            script.setCode(createDumpConditionCode(conditionName));
            break;
        default:
            throw new AssertionError(conditionType);
    }
    ExpressionType expression = new ExpressionType();
    expression.getExpressionEvaluator().add(new ObjectFactory().createScript(script));
    VariableBindingDefinitionType source = new VariableBindingDefinitionType();
    source.setPath(new ItemPathType(UserType.F_NAME));
    MappingType rv = new MappingType();
    rv.setName(conditionName);
    rv.setExpression(expression);
    rv.getSource().add(source);
    return rv;
}
Also used : ItemPathType(com.evolveum.prism.xml.ns._public.types_3.ItemPathType)

Example 100 with ItemPathType

use of com.evolveum.prism.xml.ns._public.types_3.ItemPathType in project midpoint by Evolveum.

the class TestAssignmentProcessor2 method prepareAbstractRole.

private <R extends AbstractRoleType> R prepareAbstractRole(R abstractRole, String name) {
    String oid = getRoleOid(name);
    abstractRole.setName(PolyStringType.fromOrig(name));
    abstractRole.setOid(oid);
    // constructions
    for (int i = 0; i <= constructionLevels; i++) {
        ConstructionType c = new ConstructionType(prismContext);
        c.setDescription(name + "-" + i);
        c.setResourceRef(ObjectTypeUtil.createObjectRef(RESOURCE_DUMMY_EMPTY_OID, ObjectTypes.RESOURCE));
        AssignmentType a = new AssignmentType(prismContext);
        a.setDescription("Assignment for " + c.getDescription());
        a.setConstruction(c);
        addAssignmentOrInducement(abstractRole, i, a);
    }
    // focus mappings
    for (int i = 0; i <= focusMappingLevels; i++) {
        MappingType mapping = new MappingType();
        mapping.setName(name + "-" + i);
        VariableBindingDefinitionType source = new VariableBindingDefinitionType();
        source.setPath(new ItemPathType(UserType.F_NAME));
        mapping.getSource().add(source);
        VariableBindingDefinitionType target = new VariableBindingDefinitionType();
        target.setPath(new ItemPathType(UserType.F_DESCRIPTION));
        mapping.setTarget(target);
        MappingsType mappings = new MappingsType(prismContext);
        mappings.getMapping().add(mapping);
        AssignmentType a = new AssignmentType(prismContext);
        a.setFocusMappings(mappings);
        addAssignmentOrInducement(abstractRole, i, a);
    }
    // policy rules
    for (int i = 0; i <= policyRulesLevels; i++) {
        PolicyRuleType rule = new PolicyRuleType(prismContext);
        rule.setName(name + "-" + i);
        AssignmentType a = new AssignmentType(prismContext);
        a.setPolicyRule(rule);
        addAssignmentOrInducement(abstractRole, i, a);
    }
    // authorization
    AuthorizationType authorization = new AuthorizationType(prismContext);
    authorization.getAction().add(name);
    abstractRole.getAuthorization().add(authorization);
    // admin gui config
    AdminGuiConfigurationType guiConfig = new AdminGuiConfigurationType();
    guiConfig.setPreferredDataLanguage(name);
    abstractRole.setAdminGuiConfiguration(guiConfig);
    return abstractRole;
}
Also used : ItemPathType(com.evolveum.prism.xml.ns._public.types_3.ItemPathType) PolyString(com.evolveum.midpoint.prism.polystring.PolyString)

Aggregations

ItemPathType (com.evolveum.prism.xml.ns._public.types_3.ItemPathType)114 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)58 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)27 Test (org.testng.annotations.Test)27 QName (javax.xml.namespace.QName)25 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)24 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)21 List (java.util.List)18 NotNull (org.jetbrains.annotations.NotNull)18 PrismObject (com.evolveum.midpoint.prism.PrismObject)15 ArrayList (java.util.ArrayList)15 SchemaConstants (com.evolveum.midpoint.schema.constants.SchemaConstants)13 com.evolveum.midpoint.xml.ns._public.common.common_3 (com.evolveum.midpoint.xml.ns._public.common.common_3)13 Collectors (java.util.stream.Collectors)13 ObjectTypes (com.evolveum.midpoint.schema.constants.ObjectTypes)12 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)11 ObjectDeltaOperation (com.evolveum.midpoint.schema.ObjectDeltaOperation)11 SelectorOptions (com.evolveum.midpoint.schema.SelectorOptions)11 OperationResultStatus (com.evolveum.midpoint.schema.result.OperationResultStatus)11 QueryType (com.evolveum.prism.xml.ns._public.query_3.QueryType)11