Search in sources :

Example 1 with Visitor

use of com.evolveum.midpoint.prism.query.Visitor in project midpoint by Evolveum.

the class ObjectQueryUtil method assertPropertyOnly.

// TODO what about OidIn here?
public static void assertPropertyOnly(ObjectFilter filter, final String message) {
    Visitor visitor = f -> {
        if (f instanceof OrgFilter) {
            if (message == null) {
                throw new IllegalArgumentException(f.toString());
            } else {
                throw new IllegalArgumentException(message + ": " + f);
            }
        }
    };
    filter.accept(visitor);
}
Also used : java.util(java.util) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) com.evolveum.midpoint.prism.query(com.evolveum.midpoint.prism.query) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) S_AtomicFilterExit(com.evolveum.midpoint.prism.query.builder.S_AtomicFilterExit) PolyStringNormalizer(com.evolveum.midpoint.prism.polystring.PolyStringNormalizer) PrismDefaultPolyStringNormalizer(com.evolveum.midpoint.prism.polystring.PrismDefaultPolyStringNormalizer) ShadowKindType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowKindType) ItemPath(com.evolveum.midpoint.prism.path.ItemPath) ResourceShadowDiscriminator(com.evolveum.midpoint.schema.ResourceShadowDiscriminator) QueryBuilder(com.evolveum.midpoint.prism.query.builder.QueryBuilder) DOMUtil(com.evolveum.midpoint.util.DOMUtil) Visitor(com.evolveum.midpoint.prism.query.Visitor) CollectionUtils(org.apache.commons.collections.CollectionUtils) PolyStringType(com.evolveum.prism.xml.ns._public.types_3.PolyStringType) MutableBoolean(org.apache.commons.lang.mutable.MutableBoolean) QName(javax.xml.namespace.QName) NotNull(org.jetbrains.annotations.NotNull) Validate(org.apache.commons.lang.Validate) com.evolveum.midpoint.prism(com.evolveum.midpoint.prism) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) QueryType(com.evolveum.prism.xml.ns._public.query_3.QueryType) Visitor(com.evolveum.midpoint.prism.query.Visitor)

Example 2 with Visitor

use of com.evolveum.midpoint.prism.query.Visitor in project midpoint by Evolveum.

the class ObjectQueryUtil method hasAllDefinitions.

public static boolean hasAllDefinitions(ObjectFilter filter) {
    final MutableBoolean hasAllDefinitions = new MutableBoolean(true);
    Visitor visitor = f -> {
        if (f instanceof ValueFilter) {
            ItemDefinition definition = ((ValueFilter<?, ?>) f).getDefinition();
            if (definition == null) {
                hasAllDefinitions.setValue(false);
            }
        }
    };
    filter.accept(visitor);
    return hasAllDefinitions.booleanValue();
}
Also used : java.util(java.util) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) com.evolveum.midpoint.prism.query(com.evolveum.midpoint.prism.query) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) S_AtomicFilterExit(com.evolveum.midpoint.prism.query.builder.S_AtomicFilterExit) PolyStringNormalizer(com.evolveum.midpoint.prism.polystring.PolyStringNormalizer) PrismDefaultPolyStringNormalizer(com.evolveum.midpoint.prism.polystring.PrismDefaultPolyStringNormalizer) ShadowKindType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowKindType) ItemPath(com.evolveum.midpoint.prism.path.ItemPath) ResourceShadowDiscriminator(com.evolveum.midpoint.schema.ResourceShadowDiscriminator) QueryBuilder(com.evolveum.midpoint.prism.query.builder.QueryBuilder) DOMUtil(com.evolveum.midpoint.util.DOMUtil) Visitor(com.evolveum.midpoint.prism.query.Visitor) CollectionUtils(org.apache.commons.collections.CollectionUtils) PolyStringType(com.evolveum.prism.xml.ns._public.types_3.PolyStringType) MutableBoolean(org.apache.commons.lang.mutable.MutableBoolean) QName(javax.xml.namespace.QName) NotNull(org.jetbrains.annotations.NotNull) Validate(org.apache.commons.lang.Validate) com.evolveum.midpoint.prism(com.evolveum.midpoint.prism) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) QueryType(com.evolveum.prism.xml.ns._public.query_3.QueryType) Visitor(com.evolveum.midpoint.prism.query.Visitor) MutableBoolean(org.apache.commons.lang.mutable.MutableBoolean)

Example 3 with Visitor

use of com.evolveum.midpoint.prism.query.Visitor in project midpoint by Evolveum.

the class ObjectQueryUtil method assertNotRaw.

public static void assertNotRaw(ObjectFilter filter, final String message) {
    Visitor visitor = f -> {
        if (f instanceof ValueFilter && ((ValueFilter) f).isRaw()) {
            if (message == null) {
                throw new IllegalArgumentException(f.toString());
            } else {
                throw new IllegalArgumentException(message + ": " + f);
            }
        }
    };
    filter.accept(visitor);
}
Also used : java.util(java.util) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) com.evolveum.midpoint.prism.query(com.evolveum.midpoint.prism.query) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) S_AtomicFilterExit(com.evolveum.midpoint.prism.query.builder.S_AtomicFilterExit) PolyStringNormalizer(com.evolveum.midpoint.prism.polystring.PolyStringNormalizer) PrismDefaultPolyStringNormalizer(com.evolveum.midpoint.prism.polystring.PrismDefaultPolyStringNormalizer) ShadowKindType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowKindType) ItemPath(com.evolveum.midpoint.prism.path.ItemPath) ResourceShadowDiscriminator(com.evolveum.midpoint.schema.ResourceShadowDiscriminator) QueryBuilder(com.evolveum.midpoint.prism.query.builder.QueryBuilder) DOMUtil(com.evolveum.midpoint.util.DOMUtil) Visitor(com.evolveum.midpoint.prism.query.Visitor) CollectionUtils(org.apache.commons.collections.CollectionUtils) PolyStringType(com.evolveum.prism.xml.ns._public.types_3.PolyStringType) MutableBoolean(org.apache.commons.lang.mutable.MutableBoolean) QName(javax.xml.namespace.QName) NotNull(org.jetbrains.annotations.NotNull) Validate(org.apache.commons.lang.Validate) com.evolveum.midpoint.prism(com.evolveum.midpoint.prism) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) QueryType(com.evolveum.prism.xml.ns._public.query_3.QueryType) Visitor(com.evolveum.midpoint.prism.query.Visitor)

Example 4 with Visitor

use of com.evolveum.midpoint.prism.query.Visitor in project midpoint by Evolveum.

the class ShadowManager method processQueryMatchingRules.

/**
	 * Visit the query and normalize values (or set matching rules) as needed
	 */
private void processQueryMatchingRules(ObjectQuery repoQuery, final RefinedObjectClassDefinition objectClassDef) {
    ObjectFilter filter = repoQuery.getFilter();
    Visitor visitor = f -> {
        try {
            processQueryMatchingRuleFilter(f, objectClassDef);
        } catch (SchemaException e) {
            throw new SystemException(e);
        }
    };
    filter.accept(visitor);
}
Also used : PrismValue(com.evolveum.midpoint.prism.PrismValue) ObjectDeltaType(com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType) Arrays(java.util.Arrays) ChangeType(com.evolveum.midpoint.prism.delta.ChangeType) Autowired(org.springframework.beans.factory.annotation.Autowired) ConfigurationException(com.evolveum.midpoint.util.exception.ConfigurationException) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) PrismPropertyValue(com.evolveum.midpoint.prism.PrismPropertyValue) ResourceAttribute(com.evolveum.midpoint.schema.processor.ResourceAttribute) AsynchronousOperationReturnValue(com.evolveum.midpoint.schema.result.AsynchronousOperationReturnValue) MiscSchemaUtil(com.evolveum.midpoint.schema.util.MiscSchemaUtil) S_AtomicFilterEntry(com.evolveum.midpoint.prism.query.builder.S_AtomicFilterEntry) SelectorOptions(com.evolveum.midpoint.schema.SelectorOptions) ObjectDelta(com.evolveum.midpoint.prism.delta.ObjectDelta) PrismProperty(com.evolveum.midpoint.prism.PrismProperty) ObjectNotFoundException(com.evolveum.midpoint.util.exception.ObjectNotFoundException) Collection(java.util.Collection) MiscUtil(com.evolveum.midpoint.util.MiscUtil) ObjectAlreadyExistsException(com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException) MatchingRuleRegistry(com.evolveum.midpoint.prism.match.MatchingRuleRegistry) S_FilterEntry(com.evolveum.midpoint.prism.query.builder.S_FilterEntry) List(java.util.List) SystemException(com.evolveum.midpoint.util.exception.SystemException) PolyStringType(com.evolveum.prism.xml.ns._public.types_3.PolyStringType) RefinedAssociationDefinition(com.evolveum.midpoint.common.refinery.RefinedAssociationDefinition) PropertyDelta(com.evolveum.midpoint.prism.delta.PropertyDelta) CommunicationException(com.evolveum.midpoint.util.exception.CommunicationException) SearchResultMetadata(com.evolveum.midpoint.schema.SearchResultMetadata) QName(javax.xml.namespace.QName) Clock(com.evolveum.midpoint.common.Clock) com.evolveum.midpoint.xml.ns._public.common.common_3(com.evolveum.midpoint.xml.ns._public.common.common_3) Item(com.evolveum.midpoint.prism.Item) EqualFilter(com.evolveum.midpoint.prism.query.EqualFilter) PrismContainer(com.evolveum.midpoint.prism.PrismContainer) SchemaConstants(com.evolveum.midpoint.schema.constants.SchemaConstants) ResourceAttributeContainer(com.evolveum.midpoint.schema.processor.ResourceAttributeContainer) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Trace(com.evolveum.midpoint.util.logging.Trace) TaskManager(com.evolveum.midpoint.task.api.TaskManager) DebugUtil(com.evolveum.midpoint.util.DebugUtil) ObjectFilter(com.evolveum.midpoint.prism.query.ObjectFilter) ExpressionEvaluationException(com.evolveum.midpoint.util.exception.ExpressionEvaluationException) ArrayList(java.util.ArrayList) ItemDelta(com.evolveum.midpoint.prism.delta.ItemDelta) SecurityViolationException(com.evolveum.midpoint.util.exception.SecurityViolationException) ObjectTypeUtil(com.evolveum.midpoint.schema.util.ObjectTypeUtil) SchemaDebugUtil(com.evolveum.midpoint.schema.util.SchemaDebugUtil) DeltaConvertor(com.evolveum.midpoint.schema.DeltaConvertor) PrismContext(com.evolveum.midpoint.prism.PrismContext) Qualifier(org.springframework.beans.factory.annotation.Qualifier) RepositoryService(com.evolveum.midpoint.repo.api.RepositoryService) Containerable(com.evolveum.midpoint.prism.Containerable) RefinedAttributeDefinition(com.evolveum.midpoint.common.refinery.RefinedAttributeDefinition) ContainerDelta(com.evolveum.midpoint.prism.delta.ContainerDelta) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) DeltaBuilder(com.evolveum.midpoint.prism.delta.builder.DeltaBuilder) PrismPropertyDefinition(com.evolveum.midpoint.prism.PrismPropertyDefinition) PrismObject(com.evolveum.midpoint.prism.PrismObject) XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) RefinedObjectClassDefinition(com.evolveum.midpoint.common.refinery.RefinedObjectClassDefinition) Change(com.evolveum.midpoint.provisioning.ucf.api.Change) ItemPath(com.evolveum.midpoint.prism.path.ItemPath) ResourceOperationDescription(com.evolveum.midpoint.provisioning.api.ResourceOperationDescription) QueryBuilder(com.evolveum.midpoint.prism.query.builder.QueryBuilder) Component(org.springframework.stereotype.Component) MatchingRule(com.evolveum.midpoint.prism.match.MatchingRule) PrismContainerValue(com.evolveum.midpoint.prism.PrismContainerValue) Visitor(com.evolveum.midpoint.prism.query.Visitor) ProvisioningUtil(com.evolveum.midpoint.provisioning.util.ProvisioningUtil) ShadowUtil(com.evolveum.midpoint.schema.util.ShadowUtil) GetOperationOptions(com.evolveum.midpoint.schema.GetOperationOptions) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) TraceManager(com.evolveum.midpoint.util.logging.TraceManager) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) Visitor(com.evolveum.midpoint.prism.query.Visitor) SystemException(com.evolveum.midpoint.util.exception.SystemException) ObjectFilter(com.evolveum.midpoint.prism.query.ObjectFilter)

Aggregations

ItemPath (com.evolveum.midpoint.prism.path.ItemPath)4 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)4 Visitor (com.evolveum.midpoint.prism.query.Visitor)4 QueryBuilder (com.evolveum.midpoint.prism.query.builder.QueryBuilder)4 com.evolveum.midpoint.prism (com.evolveum.midpoint.prism)3 PolyStringNormalizer (com.evolveum.midpoint.prism.polystring.PolyStringNormalizer)3 PrismDefaultPolyStringNormalizer (com.evolveum.midpoint.prism.polystring.PrismDefaultPolyStringNormalizer)3 com.evolveum.midpoint.prism.query (com.evolveum.midpoint.prism.query)3 S_AtomicFilterExit (com.evolveum.midpoint.prism.query.builder.S_AtomicFilterExit)3 ResourceShadowDiscriminator (com.evolveum.midpoint.schema.ResourceShadowDiscriminator)3 DOMUtil (com.evolveum.midpoint.util.DOMUtil)3 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)3 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)3 ShadowKindType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowKindType)3 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)3 QueryType (com.evolveum.prism.xml.ns._public.query_3.QueryType)3 PolyStringType (com.evolveum.prism.xml.ns._public.types_3.PolyStringType)3 java.util (java.util)3 QName (javax.xml.namespace.QName)3 CollectionUtils (org.apache.commons.collections.CollectionUtils)3