Skip to content

Commit

Permalink
Add missing method impl in shadow correlation ctx
Browse files Browse the repository at this point in the history
The getCandidateOids method does nothing in CorrelationContext.Shadow,
but instead of failing with an "unsupported" exception this commit
provides "no restriction" value there.

This should fix some of the failing tests.
  • Loading branch information
mederly committed Aug 21, 2023
1 parent 1cf5f98 commit 8866975
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ private CompleteCorrelationResult correlate(
CorrelationVerificationToken correlationToken,
String archetypeOid,
Set<String> candidatesOids,
Class<? extends FocusType> focusType) throws SchemaException, ExpressionEvaluationException, CommunicationException, SecurityViolationException, ConfigurationException, ObjectNotFoundException {
Class<? extends FocusType> focusType) throws SchemaException, ExpressionEvaluationException, CommunicationException,
SecurityViolationException, ConfigurationException, ObjectNotFoundException {
Task task = taskManager.createTaskInstance("correlate");
task.setChannel(SchemaConstants.CHANNEL_IDENTITY_RECOVERY_URI);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,21 @@ public CorrelationContext(
/** Returns the archetype for focus objects that the candidate(s) must possess. Null means "no restrictions". */
public abstract @Nullable String getArchetypeOid();

/** Returns candidate owners returned from previous correlator
* If more than one correlator are defined to be used, they will
* run separatelly. First correlator probably won't have any candidates to consider,
* but every next correlator might consider a cadidate set from previous correlator
* as a base for the search.
* @return
/**
* Returns candidate owners provided by previous correlator(s), if any.
*
* Background: If more child correlators are defined to be used, they will run separately (at least under
* the default implementation of the composite correlator), one after another. The original implementation executed
* each of the correlators independently, so that (typically) each of them issued its own query over all population
* of focus objects. The results were then combined by the composite correlator.
*
* However, there might be situations where subsequent correlators should just _refine_ the results returned
* by previous one(s). For that, we want to retain the relevant candidate owner(s) OID(s) in the context, and
* use that to limit search within those correlators.
*
* Empty set means "no previous candidates available", i.e. no restrictions will be applied.
*
* LIMITED USE. Currently used only "identification recovery" feature - for {@link Focus} context and `items` correlator.
*/
public abstract @NotNull Set<String> getCandidateOids();

Expand Down Expand Up @@ -185,7 +194,7 @@ public Shadow(

@Override
public @NotNull Set<String> getCandidateOids() {
throw new UnsupportedOperationException("Not supported yet");
return Set.of();
}

@Override
Expand Down Expand Up @@ -243,7 +252,6 @@ public Focus(
@Override
public @Nullable String getArchetypeOid() {
return archetypeOid;
// throw new UnsupportedOperationException(); // TODO implement
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ public interface CorrelationService {
@Nullable String archetypeOid,
@NotNull Set<String> candidateOids,
@NotNull CorrelatorDiscriminator discriminator,
// @NotNull ObjectTemplateType objectTemplate, //todo should be removed, archetype is to be here instead
@NotNull Task task,
@NotNull OperationResult result)
throws SchemaException, ExpressionEvaluationException, CommunicationException, SecurityViolationException,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,13 @@ public class CorrelationServiceImpl implements CorrelationService {
public @NotNull CompleteCorrelationResult correlate(
@NotNull FocusType preFocus,
@Nullable String archetypeOid,
@NotNull Set<String> cadidateOdis,
@NotNull Set<String> candidateOids,
@NotNull CorrelatorDiscriminator discriminator,
@NotNull Task task,
@NotNull OperationResult result)
throws SchemaException, ExpressionEvaluationException, CommunicationException, SecurityViolationException,
ConfigurationException, ObjectNotFoundException {
CompleteContext ctx = getCompleteContext(preFocus, archetypeOid, cadidateOdis, discriminator, task, result);
CompleteContext ctx = getCompleteContext(preFocus, archetypeOid, candidateOids, discriminator, task, result);
return correlate(ctx.correlatorContext, ctx.correlationContext, result);
}

Expand Down

0 comments on commit 8866975

Please sign in to comment.