Class SearchBasedActivityRun<C extends Containerable,WD extends WorkDefinition,AH extends ActivityHandler<WD,AH>,WS extends AbstractActivityWorkStateType>
java.lang.Object
com.evolveum.midpoint.repo.common.activity.run.AbstractActivityRun<WD,AH,BS>
com.evolveum.midpoint.repo.common.activity.run.LocalActivityRun<WD,AH,WS>
com.evolveum.midpoint.repo.common.activity.run.IterativeActivityRun<C,WD,AH,WS>
com.evolveum.midpoint.repo.common.activity.run.SearchBasedActivityRun<C,WD,AH,WS>
- All Implemented Interfaces:
ImplicitSegmentationResolver,IterativeActivityRunSpecifics,SearchBasedActivityRunSpecifics<C>,ExecutionSupport,DebugDumpable
- Direct Known Subclasses:
AutoScalingActivityRun,ImportActivityRun,PartialReconciliationActivityRun,ScanActivityRun,ShadowCleanupActivityHandler.MyRun,ShadowIntegrityCheckActivityRun
public abstract class SearchBasedActivityRun<C extends Containerable,WD extends WorkDefinition,AH extends ActivityHandler<WD,AH>,WS extends AbstractActivityWorkStateType>
extends IterativeActivityRun<C,WD,AH,WS>
implements SearchBasedActivityRunSpecifics<C>
A run of a given search-iterative activity.
Responsibilities:
1. Bucketing, i.e. orchestrating getting and processing buckets. See
IterativeActivityRun.doRun(OperationResult).
2. Item source preparation = preparation of search specification (prepareSearchSpecificationAndSearchableItemSource(OperationResult)).
This includes
a. converting the configured object set to search spec (or obtaining the spec from
the specifics object - SearchBasedActivityRunSpecifics;
b. customizing the spec by calling `customizeXXX` methods in the specifics object;
c. narrowing the query for bucketing and error handling.
3. "Expected total" determination - see IterativeActivityRun.setExpectedTotal(OperationResult) and
IterativeActivityRun.setExpectedInCurrentBucket(OperationResult).
4. Pre-processing of items found - see processItem(ItemProcessingRequest, RunningTask, OperationResult):
a. checking for already-processed objects (OIDs seen),
b. applying additional filter (currently used for retrying failed objects),
c. applying additional pre-processing to objects (currently used for retrying failed objects),-
Nested Class Summary
Nested classes/interfaces inherited from interface com.evolveum.midpoint.task.api.ExecutionSupport
ExecutionSupport.CountersGroup -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected SearchSpecification<C>Specification of the search that is to be executed: container type, query, options, and "use repository" flag.Fields inherited from class com.evolveum.midpoint.repo.common.activity.run.IterativeActivityRun
beans, bucket, coordinator, errorState, transientRunStatisticsFields inherited from class com.evolveum.midpoint.repo.common.activity.run.AbstractActivityRun
activity, activityState, endTimestamp, startTimestamp, taskRunFields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING -
Constructor Summary
ConstructorsConstructorDescriptionSearchBasedActivityRun(@NotNull ActivityRunInstantiationContext<WD, AH> context, @NotNull String shortNameCapitalized) -
Method Summary
Modifier and TypeMethodDescriptionprotected IntegercountObjects(OperationResult result) Used to count objects using model or any similar higher-level interface.final @Nullable IntegerDetermines the current bucket size.final @Nullable IntegerdetermineOverallSize(OperationResult result) Determines expected progress (overall size) for the activity.protected final ErrorHandlingStrategyExecutor.FollowUpActionPrecondition: search specification must already exist.final ObjectQuerygetQuery()final SchemaServiceprotected final @NotNull SearchSpecification<C>protected final TaskManagerprotected final booleanisInRepository(OperationResult result) Do we execute over items in repository? (Maybe the name should be changed.)protected final voidStarts the item source (e.g.protected final voidPrepares the item source.final booleanprocessItem(@NotNull ItemProcessingRequest<C> request, @NotNull RunningTask workerTask, OperationResult result) Methods inherited from class com.evolveum.midpoint.repo.common.activity.run.IterativeActivityRun
canUpdateThreadLocalStatistics, determineActivityStateForCounters, disableGlobalConnIdOperationsListener, enableGlobalConnIdOperationsListener, ensureNoParallelism, ensureNoWorkerThreads, getBucket, getChannelOverride, getConnIdOperationsReport, getContextDescription, getContextDescriptionSpaced, getErrorState, getItemsReport, getRootTaskOid, getShortName, getTransientRunStatistics, handleError, isMultithreaded, runLocally, setContextDescription, shouldReportConnIdOperations, shouldReportInternalOperations, shouldReportItems, updateStatisticsMethods inherited from class com.evolveum.midpoint.repo.common.activity.run.LocalActivityRun
createReportingCharacteristics, getCurrentResultStatusBean, getDesiredTaskObjectRef, getSimulationTransaction, getTaskExecutionMode, isExcludedFromStalenessChecking, runInternal, shouldUpdateProgressInStateOverview, updateItemProgressInTreeOverviewIfTimePassedMethods inherited from class com.evolveum.midpoint.repo.common.activity.run.AbstractActivityRun
areActionsExecutedStatisticsSupported, areRunRecordsSupported, areStatisticsSupported, areSynchronizationStatisticsSupported, canRun, debugDump, debugDumpExtra, determineActivityStateDefinition, ensureFullExecution, ensureNoDryRun, ensureNoPreviewNorDryRun, getActivity, getActivityDefinition, getActivityExecutionMode, getActivityHandler, getActivityPath, getActivityState, getActivityStateDefinition, getBeans, getItemsProcessed, getLocalParentRun, getReportingCharacteristics, getRunningTask, getStartTimestampRequired, getTaskRun, getTreeStateOverview, getWorkDefinition, incrementCounters, incrementProgress, isBucketAnalysis, isDryRun, isFullExecution, isNoExecution, isNonScavengingWorker, isProgressSupported, isWorker, onActivityRealizationComplete, onActivityRealizationStart, recordIterativeOperationStart, run, setInstanceReady, shouldCreateWorkStateOnInitialization, standardRunResult, standardRunResult, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.evolveum.midpoint.util.DebugDumpable
debugDump, debugDumpLazily, debugDumpLazilyMethods inherited from interface com.evolveum.midpoint.task.api.ExecutionSupport
getActivityExecutionMode, getActivityPath, incrementCounters, recordIterativeOperationStartMethods inherited from interface com.evolveum.midpoint.repo.common.activity.run.IterativeActivityRunSpecifics
afterBucketProcessing, afterRun, beforeBucketProcessing, beforeRun, createReportingCharacteristics, resolveImplicitSegmentation, useOtherActivityStateForCountersMethods inherited from interface com.evolveum.midpoint.repo.common.activity.run.SearchBasedActivityRunSpecifics
createCustomSearchSpecification, createItemDefinitionProvider, customizeQuery, customizeSearchOptions, doesRequireDirectRepositoryAccess, processItem
-
Field Details
-
searchSpecification
Specification of the search that is to be executed: container type, query, options, and "use repository" flag.
-
-
Constructor Details
-
SearchBasedActivityRun
public SearchBasedActivityRun(@NotNull @NotNull ActivityRunInstantiationContext<WD, AH> context, @NotNull @NotNull String shortNameCapitalized)
-
-
Method Details
-
prepareItemSourceForCurrentBucket
protected final void prepareItemSourceForCurrentBucket(OperationResult result) throws ActivityRunException, CommonException Description copied from class:IterativeActivityRunPrepares the item source. E.g. for search-iterative tasks we prepare object type, query, and options here. Iterative activities delegate this method fully to the plugin. However, search-based activities provide their own default implementation.- Specified by:
prepareItemSourceForCurrentBucketin classIterativeActivityRun<C extends Containerable,WD extends WorkDefinition, AH extends ActivityHandler<WD, AH>, WS extends AbstractActivityWorkStateType> - Throws:
ActivityRunExceptionCommonException
-
isInRepository
protected final boolean isInRepository(OperationResult result) throws ActivityRunException, CommonException Description copied from class:IterativeActivityRunDo we execute over items in repository? (Maybe the name should be changed.)- Specified by:
isInRepositoryin classIterativeActivityRun<C extends Containerable,WD extends WorkDefinition, AH extends ActivityHandler<WD, AH>, WS extends AbstractActivityWorkStateType> - Throws:
ActivityRunExceptionCommonException
-
determineOverallSize
@Nullable public final @Nullable Integer determineOverallSize(OperationResult result) throws CommonException, ActivityRunException Description copied from class:IterativeActivityRunDetermines expected progress (overall size) for the activity. E.g. for search-based activities we count the objects here (overall).- Overrides:
determineOverallSizein classIterativeActivityRun<C extends Containerable,WD extends WorkDefinition, AH extends ActivityHandler<WD, AH>, WS extends AbstractActivityWorkStateType> - Returns:
- null if no value could be determined or is not applicable
- Throws:
CommonExceptionActivityRunException
-
determineCurrentBucketSize
@Nullable public final @Nullable Integer determineCurrentBucketSize(OperationResult result) throws CommonException Description copied from class:IterativeActivityRunDetermines the current bucket size. E.g. for search-based activities we count the objects here (in current bucket).- Overrides:
determineCurrentBucketSizein classIterativeActivityRun<C extends Containerable,WD extends WorkDefinition, AH extends ActivityHandler<WD, AH>, WS extends AbstractActivityWorkStateType> - Returns:
- null if no value could be determined or is not applicable
- Throws:
CommonException
-
countObjects
Used to count objects using model or any similar higher-level interface. Defaults to repository count.- Throws:
CommonException
-
iterateOverItemsInBucket
Description copied from class:IterativeActivityRunStarts the item source (e.g. `searchObjectsIterative` call or `synchronize` call) and begins processing items generated by it. Returns when the source finishes. For example: - for search-based tasks, this call returns immediately after the iterative search is over; - for live sync task, this returns after all changes were fetched and acknowledged, and the resulting token was written; - for async update task, this returns also after all changes were fetched and acknowledged and confirmed to the source.- Specified by:
iterateOverItemsInBucketin classIterativeActivityRun<C extends Containerable,WD extends WorkDefinition, AH extends ActivityHandler<WD, AH>, WS extends AbstractActivityWorkStateType> - Throws:
CommonException
-
getDefaultErrorAction
- Specified by:
getDefaultErrorActionin classIterativeActivityRun<C extends Containerable,WD extends WorkDefinition, AH extends ActivityHandler<WD, AH>, WS extends AbstractActivityWorkStateType> - Returns:
- Default error action if no policy is specified or if no policy entry matches.
-
processItem
public final boolean processItem(@NotNull @NotNull ItemProcessingRequest<C> request, @NotNull @NotNull RunningTask workerTask, OperationResult result) throws CommonException, ActivityRunException - Specified by:
processItemin classIterativeActivityRun<C extends Containerable,WD extends WorkDefinition, AH extends ActivityHandler<WD, AH>, WS extends AbstractActivityWorkStateType> - Throws:
CommonExceptionActivityRunException
-
getSchemaService
-
getTaskManager
-
getSearchSpecificationRequired
-
getItemType
Precondition: search specification must already exist. -
getQuery
-
getSearchOptions
-