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
Modifier 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, transientRunStatistics
Fields inherited from class com.evolveum.midpoint.repo.common.activity.run.AbstractActivityRun
activity, activityState, endTimestamp, startTimestamp, taskRun
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
-
Constructor Summary
ConstructorDescriptionSearchBasedActivityRun
(@NotNull ActivityRunInstantiationContext<WD, AH> context, @NotNull String shortNameCapitalized) -
Method Summary
Modifier and TypeMethodDescriptionprotected Integer
countObjects
(OperationResult result) Used to count objects using model or any similar higher-level interface.final @Nullable Integer
Determines the current bucket size.final @Nullable Integer
determineOverallSize
(OperationResult result) Determines expected progress (overall size) for the activity.protected final ErrorHandlingStrategyExecutor.FollowUpAction
Precondition: search specification must already exist.final ObjectQuery
getQuery()
final SchemaService
protected final @NotNull SearchSpecification<C>
protected final TaskManager
protected final boolean
isInRepository
(OperationResult result) Do we execute over items in repository? (Maybe the name should be changed.)protected final void
Starts the item source (e.g.protected final void
Prepares the item source.final boolean
processItem
(@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, updateStatistics
Methods inherited from class com.evolveum.midpoint.repo.common.activity.run.LocalActivityRun
createReportingCharacteristics, getCurrentResultStatusBean, getDesiredTaskObjectRef, getSimulationTransaction, getTaskExecutionMode, isExcludedFromStalenessChecking, runInternal, shouldUpdateProgressInStateOverview, updateItemProgressInTreeOverviewIfTimePassed
Methods 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, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.evolveum.midpoint.util.DebugDumpable
debugDump, debugDumpLazily, debugDumpLazily
Methods inherited from interface com.evolveum.midpoint.task.api.ExecutionSupport
getActivityExecutionMode, getActivityPath, incrementCounters, recordIterativeOperationStart
Methods inherited from interface com.evolveum.midpoint.repo.common.activity.run.IterativeActivityRunSpecifics
afterBucketProcessing, afterRun, beforeBucketProcessing, beforeRun, createReportingCharacteristics, resolveImplicitSegmentation, useOtherActivityStateForCounters
Methods 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:IterativeActivityRun
Prepares 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:
prepareItemSourceForCurrentBucket
in classIterativeActivityRun<C extends Containerable,
WD extends WorkDefinition, AH extends ActivityHandler<WD, AH>, WS extends AbstractActivityWorkStateType> - Throws:
ActivityRunException
CommonException
-
isInRepository
protected final boolean isInRepository(OperationResult result) throws ActivityRunException, CommonException Description copied from class:IterativeActivityRun
Do we execute over items in repository? (Maybe the name should be changed.)- Specified by:
isInRepository
in classIterativeActivityRun<C extends Containerable,
WD extends WorkDefinition, AH extends ActivityHandler<WD, AH>, WS extends AbstractActivityWorkStateType> - Throws:
ActivityRunException
CommonException
-
determineOverallSize
@Nullable public final @Nullable Integer determineOverallSize(OperationResult result) throws CommonException, ActivityRunException Description copied from class:IterativeActivityRun
Determines expected progress (overall size) for the activity. E.g. for search-based activities we count the objects here (overall).- Overrides:
determineOverallSize
in 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
ActivityRunException
-
determineCurrentBucketSize
@Nullable public final @Nullable Integer determineCurrentBucketSize(OperationResult result) throws CommonException Description copied from class:IterativeActivityRun
Determines the current bucket size. E.g. for search-based activities we count the objects here (in current bucket).- Overrides:
determineCurrentBucketSize
in 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:IterativeActivityRun
Starts 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:
iterateOverItemsInBucket
in classIterativeActivityRun<C extends Containerable,
WD extends WorkDefinition, AH extends ActivityHandler<WD, AH>, WS extends AbstractActivityWorkStateType> - Throws:
CommonException
-
getDefaultErrorAction
- Specified by:
getDefaultErrorAction
in 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:
processItem
in classIterativeActivityRun<C extends Containerable,
WD extends WorkDefinition, AH extends ActivityHandler<WD, AH>, WS extends AbstractActivityWorkStateType> - Throws:
CommonException
ActivityRunException
-
getSchemaService
-
getTaskManager
-
getSearchSpecificationRequired
-
getItemType
Precondition: search specification must already exist. -
getQuery
-
getSearchOptions
-