Search in sources :

Example 76 with ItemPathType

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

the class Mapping method parseTarget.

private void parseTarget() throws SchemaException {
    VariableBindingDefinitionType targetType = mappingType.getTarget();
    if (targetType == null) {
        outputDefinition = defaultTargetDefinition;
        outputPath = defaultTargetPath;
    } else {
        ItemPathType itemPathType = targetType.getPath();
        if (itemPathType == null) {
            outputDefinition = defaultTargetDefinition;
            outputPath = defaultTargetPath;
        } else {
            ItemPath path = itemPathType.getItemPath();
            outputDefinition = ExpressionUtil.resolveDefinitionPath(path, variables, targetContext, "target definition in " + getMappingContextDescription());
            if (outputDefinition == null) {
                throw new SchemaException("No target item that would conform to the path " + path + " in " + getMappingContextDescription());
            }
            outputPath = path.stripVariableSegment();
        }
    }
    if (stringPolicyResolver != null) {
        stringPolicyResolver.setOutputDefinition(outputDefinition);
        stringPolicyResolver.setOutputPath(outputPath);
    }
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) ItemPathType(com.evolveum.prism.xml.ns._public.types_3.ItemPathType) ItemPath(com.evolveum.midpoint.prism.path.ItemPath)

Example 77 with ItemPathType

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

the class QNameEditorPanel method getModel.

@Override
public IModel<ItemPathType> getModel() {
    IModel<ItemPathType> model = super.getModel();
    ItemPathType modelObject = model.getObject();
    // TODO consider removing this
    if (modelObject == null) {
        model.setObject(new ItemPathType());
    }
    return model;
}
Also used : ItemPathType(com.evolveum.prism.xml.ns._public.types_3.ItemPathType)

Example 78 with ItemPathType

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

the class ItemWrapperFactoryImpl method determineShowInVirtualContainer.

private boolean determineShowInVirtualContainer(IW itemWrapper, WrapperContext context) {
    Collection<VirtualContainersSpecificationType> virtualContainers = context.getVirtualContainers();
    if (virtualContainers == null) {
        return false;
    }
    for (VirtualContainersSpecificationType virtualContainer : virtualContainers) {
        for (VirtualContainerItemSpecificationType item : virtualContainer.getItem()) {
            ItemPathType itemPathType = item.getPath();
            if (itemPathType == null) {
                LOGGER.error("Bad virtual item specification, missing path. Skipping virtual item settings for {}", itemWrapper);
                continue;
            }
            ItemPath itemPath = itemPathType.getItemPath();
            if (itemPath.equivalent(itemWrapper.getPath())) {
                return true;
            }
        }
    }
    return false;
}
Also used : ItemPathType(com.evolveum.prism.xml.ns._public.types_3.ItemPathType) ItemPath(com.evolveum.midpoint.prism.path.ItemPath)

Example 79 with ItemPathType

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

the class InducedEntitlementsValidator method validateInducement.

private Collection<SimpleValidationError> validateInducement(AssignmentType assignment) {
    List<SimpleValidationError> errors = new ArrayList<>();
    // TODO impelemnt findContainer(ItemPath)
    com.evolveum.midpoint.prism.Item<PrismContainerValue<ResourceObjectAssociationType>, PrismContainerDefinition<ResourceObjectAssociationType>> association = assignment.asPrismContainerValue().findItem(ItemPath.create(AssignmentType.F_CONSTRUCTION, ConstructionType.F_ASSOCIATION));
    if (association != null && !association.getValues().isEmpty()) {
        for (PrismContainerValue<ResourceObjectAssociationType> associationValue : association.getValues()) {
            PrismContainer<MappingType> outbound = associationValue.findContainer(ResourceObjectAssociationType.F_OUTBOUND);
            if (outbound == null || outbound.getValues().isEmpty()) {
                SimpleValidationError error = new SimpleValidationError();
                error.setMessage(PageBase.createStringResourceStatic(null, "InducedEntitlementsPanel.validator.message").getString());
                ItemPathType path = new ItemPathType();
                path.setItemPath(ItemPath.create(AbstractRoleType.F_INDUCEMENT, AssignmentType.F_CONSTRUCTION, ConstructionType.F_ASSOCIATION, ResourceObjectAssociationType.F_OUTBOUND));
                error.setAttribute(path);
                errors.add(error);
            }
        }
    }
    return errors;
}
Also used : ItemPathType(com.evolveum.prism.xml.ns._public.types_3.ItemPathType) ArrayList(java.util.ArrayList) SimpleValidationError(com.evolveum.midpoint.web.util.validation.SimpleValidationError) com.evolveum.midpoint.prism(com.evolveum.midpoint.prism)

Example 80 with ItemPathType

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

the class SchemaDebugUtil method prettyPrint.

public static String prettyPrint(PropertyReferenceListType reflist) {
    if (reflist == null) {
        return "null";
    }
    StringBuilder sb = new StringBuilder("[");
    Iterator<ItemPathType> iterator = reflist.getProperty().iterator();
    while (iterator.hasNext()) {
        ItemPathType xpath = iterator.next();
        sb.append(xpath.toString());
        if (iterator.hasNext()) {
            sb.append(",");
        }
    }
    sb.append("]");
    return sb.toString();
}
Also used : ItemPathType(com.evolveum.prism.xml.ns._public.types_3.ItemPathType)

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