Search in sources :

Example 6 with UniformItemPath

use of com.evolveum.midpoint.prism.path.UniformItemPath in project midpoint by Evolveum.

the class ReferenceNameResolver method getPathsToResolve.

@NotNull
private static List<? extends ItemPath> getPathsToResolve(Collection<SelectorOptions<GetOperationOptions>> options) {
    final UniformItemPath emptyPath = PrismContext.get().emptyPath();
    List<UniformItemPath> rv = new ArrayList<>();
    if (options == null || options.isEmpty()) {
        return rv;
    }
    for (SelectorOptions<GetOperationOptions> option : options) {
        if (GetOperationOptions.isResolveNames(option.getOptions())) {
            rv.add(option.getItemPath(emptyPath));
        }
    }
    return rv;
}
Also used : GetOperationOptions(com.evolveum.midpoint.schema.GetOperationOptions) UniformItemPath(com.evolveum.midpoint.prism.path.UniformItemPath) NotNull(org.jetbrains.annotations.NotNull)

Example 7 with UniformItemPath

use of com.evolveum.midpoint.prism.path.UniformItemPath in project midpoint by Evolveum.

the class EntityRegistry method hasAttributePathOverride.

public boolean hasAttributePathOverride(ManagedType<?> type, ItemPath pathOverride) {
    Map<UniformItemPath, Attribute<?, ?>> overrides = attributeNamePathOverrides.get(type);
    if (overrides == null) {
        return false;
    }
    ItemPath namedOnly = pathOverride.namedSegmentsOnly();
    for (UniformItemPath path : overrides.keySet()) {
        if (path.isSuperPathOrEquivalent(namedOnly)) {
            return true;
        }
    }
    return false;
}
Also used : Attribute(javax.persistence.metamodel.Attribute) UniformItemPath(com.evolveum.midpoint.prism.path.UniformItemPath) ItemPath(com.evolveum.midpoint.prism.path.ItemPath) UniformItemPath(com.evolveum.midpoint.prism.path.UniformItemPath)

Example 8 with UniformItemPath

use of com.evolveum.midpoint.prism.path.UniformItemPath in project midpoint by Evolveum.

the class GetOperationOptions method toRestIncludeOption.

public static List<String> toRestIncludeOption(Collection<SelectorOptions<GetOperationOptions>> options) {
    List<SelectorOptions<GetOperationOptions>> includeOptions = SelectorOptions.filterRetrieveOptions(options);
    List<String> includePaths = new ArrayList<>();
    for (SelectorOptions<GetOperationOptions> includeOption : includeOptions) {
        UniformItemPath path = includeOption.getSelector().getPath();
        includePaths.add(path.namedSegmentsOnly().toString());
    }
    return includePaths;
}
Also used : ArrayList(java.util.ArrayList) UniformItemPath(com.evolveum.midpoint.prism.path.UniformItemPath)

Example 9 with UniformItemPath

use of com.evolveum.midpoint.prism.path.UniformItemPath in project midpoint by Evolveum.

the class GetOperationOptions method merge.

@NotNull
@SafeVarargs
public static Collection<SelectorOptions<GetOperationOptions>> merge(PrismContext prismContext, Collection<SelectorOptions<GetOperationOptions>>... parts) {
    final UniformItemPath emptyPath = prismContext.emptyPath();
    Collection<SelectorOptions<GetOperationOptions>> merged = new ArrayList<>();
    for (Collection<SelectorOptions<GetOperationOptions>> part : parts) {
        for (SelectorOptions<GetOperationOptions> increment : CollectionUtils.emptyIfNull(part)) {
            if (increment != null) {
                // should always be so
                Collection<GetOperationOptions> existing = SelectorOptions.findOptionsForPath(merged, increment.getItemPath(emptyPath));
                if (existing.isEmpty()) {
                    merged.add(increment);
                } else if (existing.size() == 1) {
                    existing.iterator().next().merge(increment.getOptions());
                } else {
                    throw new AssertionError("More than one options for path: " + increment.getItemPath(emptyPath));
                }
            }
        }
    }
    return merged;
}
Also used : ArrayList(java.util.ArrayList) UniformItemPath(com.evolveum.midpoint.prism.path.UniformItemPath) NotNull(org.jetbrains.annotations.NotNull)

Example 10 with UniformItemPath

use of com.evolveum.midpoint.prism.path.UniformItemPath in project midpoint by Evolveum.

the class GetOperationOptionsBuilderImpl method forPaths.

private GetOperationOptionsBuilderImpl forPaths(Consumer<GetOperationOptions> modifier) {
    for (UniformItemPath path : currentPaths) {
        GetOperationOptions optionsForPath = options.computeIfAbsent(path, (key) -> new GetOperationOptions());
        modifier.accept(optionsForPath);
    }
    return this;
}
Also used : UniformItemPath(com.evolveum.midpoint.prism.path.UniformItemPath)

Aggregations

UniformItemPath (com.evolveum.midpoint.prism.path.UniformItemPath)18 NotNull (org.jetbrains.annotations.NotNull)5 GetOperationOptions (com.evolveum.midpoint.schema.GetOperationOptions)4 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)2 UserInterfaceElementVisibilityType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserInterfaceElementVisibilityType)2 ArrayList (java.util.ArrayList)2 Attribute (javax.persistence.metamodel.Attribute)2 MappingImpl (com.evolveum.midpoint.model.common.mapping.MappingImpl)1 DefinitionsToTransformable (com.evolveum.midpoint.model.impl.schema.transform.DefinitionsToTransformable)1 ItemName (com.evolveum.midpoint.prism.path.ItemName)1 JaxbName (com.evolveum.midpoint.repo.sql.query.definition.JaxbName)1 JaxbPath (com.evolveum.midpoint.repo.sql.query.definition.JaxbPath)1 JaxbType (com.evolveum.midpoint.repo.sql.query.definition.JaxbType)1 DefinitionProcessingOption (com.evolveum.midpoint.schema.DefinitionProcessingOption)1 GetOperationOptions.createReadOnlyCollection (com.evolveum.midpoint.schema.GetOperationOptions.createReadOnlyCollection)1 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)1 ObjectSecurityConstraints (com.evolveum.midpoint.security.enforcer.api.ObjectSecurityConstraints)1 ItemPathType (com.evolveum.prism.xml.ns._public.types_3.ItemPathType)1 Method (java.lang.reflect.Method)1 HashMap (java.util.HashMap)1