Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Evolveum/midpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
1azyman committed Aug 22, 2022
2 parents f7b6b9e + 8ab816a commit 990bb99
Show file tree
Hide file tree
Showing 20 changed files with 266 additions and 156 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ public enum Match {
/**
* A partial match.
*
* The default meaning is that any normalization of any primary or secondary value exactly matches
* The "baseline" meaning is that any normalization of any primary or secondary value exactly matches
* the same normalization of the source value.
*
* For items mentioned by "items" correlator(s) the partial match is also if at least one filter defined
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public interface Correlator {
*/
@NotNull CorrelationExplanation explain(
@NotNull CorrelationContext correlationContext,
@NotNull FocusType candidateOwner,
@NotNull FocusType candidate,
@NotNull OperationResult result)
throws SchemaException, ExpressionEvaluationException, CommunicationException, SecurityViolationException,
ConfigurationException, ObjectNotFoundException;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright (C) 2010-2022 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/

package com.evolveum.midpoint.model.api.indexing;

import com.evolveum.midpoint.xml.ns._public.common.common_3.IndexedItemNormalizationDefinitionType;

import org.jetbrains.annotations.NotNull;

import com.evolveum.midpoint.prism.PrismPropertyDefinition;
import com.evolveum.midpoint.prism.path.ItemName;
import com.evolveum.midpoint.prism.path.ItemPath;

/**
* A {@link ValueNormalizer} configured for an indexed item.
*
* Terminological note: From the point of view of configuration, one may call this object a _normalization_.
* It is used to do the actual normalization of values, hence the name of _normalizer_.
*
* @see IndexedItemNormalizationDefinitionType
*/
public interface IndexedItemValueNormalizer extends ValueNormalizer {

/** Returns the name of the normalizer (normalization). */
@NotNull String getName();

/** Is this normalizer (normalization) the default one configured for the given item? */
boolean isDefault();

/** Returns the qualified name of the indexed version of the item, corresponding to this normalizer (normalization). */
ItemName getIndexItemName();

/** Returns the full path to the indexed version of the item. */
ItemPath getIndexItemPath();

/**
* Returns the definition of the indexed version of the item.
*
* Currently, it is always a definition of a string. Later this may be changed.
*/
@NotNull PrismPropertyDefinition<?> getIndexItemDefinition();
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ public interface IndexingItemConfiguration {

@NotNull ItemPath getPath();

@NotNull Collection<Normalization> getNormalizations();
@NotNull Collection<IndexedItemValueNormalizer> getNormalizers();

Normalization findNormalization(@Nullable String index) throws ConfigurationException;
IndexedItemValueNormalizer findNormalizer(@Nullable String index) throws ConfigurationException;

Normalization getDefaultNormalization() throws ConfigurationException;
IndexedItemValueNormalizer getDefaultNormalizer() throws ConfigurationException;
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@

import org.jetbrains.annotations.NotNull;

/**
* Normalizes a (string) value for the purpose of custom property indexing.
*/
public interface ValueNormalizer {

@NotNull String normalize(@NotNull String input, Task task, OperationResult result)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import com.evolveum.midpoint.model.impl.correlation.CorrelationCaseManager;
import com.evolveum.midpoint.model.impl.lens.*;
import com.evolveum.midpoint.model.impl.lens.identities.IdentitiesManager;
import com.evolveum.midpoint.model.impl.lens.identities.IndexingManager;
import com.evolveum.midpoint.model.impl.lens.indexing.IndexingManager;
import com.evolveum.midpoint.model.impl.lens.projector.Projector;
import com.evolveum.midpoint.model.impl.lens.projector.credentials.CredentialsProcessor;
import com.evolveum.midpoint.model.impl.lens.projector.focus.AutoAssignMappingCollector;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import com.evolveum.midpoint.model.api.indexing.ValueNormalizer;
import com.evolveum.midpoint.model.impl.ModelBeans;
import com.evolveum.midpoint.model.impl.correlator.items.CorrelationItem;
import com.evolveum.midpoint.model.impl.lens.identities.IndexingManager;
import com.evolveum.midpoint.model.impl.lens.indexing.IndexingManager;
import com.evolveum.midpoint.prism.PrismContainerValue;
import com.evolveum.midpoint.prism.PrismContext;
import com.evolveum.midpoint.prism.PrismProperty;
Expand Down Expand Up @@ -267,7 +267,7 @@ CorrelationCaseDescription.Match determine(Task task, OperationResult result)
return NOT_APPLICABLE;
}
ValueNormalizer defaultValueNormalizer = indexing != null ?
indexing.getDefaultNormalization() : IndexingManager.getDefaultNormalizer();
indexing.getDefaultNormalizer() : IndexingManager.getDefaultNormalizer();
String preFocusNormalized = IndexingManager.normalizeValue(preFocusRealValue, defaultValueNormalizer, task, result);

for (PrismValue primaryValue : primaryValues) {
Expand Down Expand Up @@ -312,7 +312,7 @@ CorrelationCaseDescription.Match determine(Task task, OperationResult result)
}

Collection<? extends ValueNormalizer> normalizers = indexing != null ?
indexing.getNormalizations() : Set.of(IndexingManager.getDefaultNormalizer());
indexing.getNormalizers() : Set.of(IndexingManager.getDefaultNormalizer());
LOGGER.trace("Trying to find a match using applicable normalizers (count: {})", normalizers.size());

for (PrismValue anyValue : allValues) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import com.evolveum.midpoint.model.api.indexing.IndexingConfiguration;

import com.evolveum.midpoint.model.impl.lens.identities.IdentityManagementConfigurationImpl;
import com.evolveum.midpoint.model.impl.lens.identities.IndexingConfigurationImpl;
import com.evolveum.midpoint.model.impl.lens.indexing.IndexingConfigurationImpl;
import com.evolveum.midpoint.prism.path.PathKeyedMap;

import com.evolveum.midpoint.util.MiscUtil;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,19 +115,19 @@ protected BaseCorrelator(
@Override
public @NotNull CorrelationExplanation explain(
@NotNull CorrelationContext correlationContext,
@NotNull FocusType candidateOwner,
@NotNull FocusType candidate,
@NotNull OperationResult parentResult)
throws SchemaException, ExpressionEvaluationException, CommunicationException, SecurityViolationException,
ConfigurationException, ObjectNotFoundException {

OperationResult result = parentResult.subresult(getClass().getName() + OP_EXPLAIN_SUFFIX)
.build();
try {
logger.trace("Explaining candidate owner:\n{}\nin context:\n{}",
candidateOwner.debugDumpLazily(1),
logger.trace("Explaining candidate:\n{}\nin context:\n{}",
candidate.debugDumpLazily(1),
correlationContext.debugDumpLazily(1));

CorrelationExplanation explanation = explainInternal(correlationContext, candidateOwner, result);
CorrelationExplanation explanation = explainInternal(correlationContext, candidate, result);

logger.trace("Determined candidate owner explanation:\n{}", explanation.debugDumpLazily(1));

Expand Down

0 comments on commit 990bb99

Please sign in to comment.