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. SeeIterativeActivityRun.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 - seeIterativeActivityRun.setExpectedTotal(OperationResult)
andIterativeActivityRun.setExpectedInCurrentBucket(OperationResult)
. 4. Pre-processing of items found - seeprocessItem(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
Fields Modifier and Type Field Description protected SearchSpecification<C>
searchSpecification
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
Constructors Constructor Description SearchBasedActivityRun(@NotNull ActivityRunInstantiationContext<WD,AH> context, @NotNull String shortNameCapitalized)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Integer
countObjects(OperationResult result)
Used to count objects using model or any similar higher-level interface.@Nullable Integer
determineCurrentBucketSize(OperationResult result)
Determines the current bucket size.@Nullable Integer
determineOverallSize(OperationResult result)
Determines expected progress (overall size) for the activity.protected ErrorHandlingStrategyExecutor.FollowUpAction
getDefaultErrorAction()
protected ExpressionProfile
getExpressionProfile()
protected Class<C>
getItemType()
ObjectQuery
getQuery()
SchemaService
getSchemaService()
Collection<SelectorOptions<GetOperationOptions>>
getSearchOptions()
protected @NotNull SearchSpecification<C>
getSearchSpecificationRequired()
protected TaskManager
getTaskManager()
protected boolean
isInRepository(OperationResult result)
Do we execute over items in repository? (Maybe the name should be changed.)protected void
iterateOverItemsInBucket(OperationResult result)
Starts the item source (e.g.protected void
prepareItemSourceForCurrentBucket(OperationResult result)
Prepares the item source.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 Detail
-
searchSpecification
protected SearchSpecification<C extends Containerable> searchSpecification
Specification of the search that is to be executed: container type, query, options, and "use repository" flag.
-
-
Constructor Detail
-
SearchBasedActivityRun
public SearchBasedActivityRun(@NotNull @NotNull ActivityRunInstantiationContext<WD,AH> context, @NotNull @NotNull String shortNameCapitalized)
-
-
Method Detail
-
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
protected Integer countObjects(OperationResult result) throws CommonException
Used to count objects using model or any similar higher-level interface. Defaults to repository count.- Throws:
CommonException
-
iterateOverItemsInBucket
protected final void iterateOverItemsInBucket(OperationResult result) throws CommonException
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
@NotNull protected final ErrorHandlingStrategyExecutor.FollowUpAction 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
-
getExpressionProfile
protected ExpressionProfile getExpressionProfile()
-
getSchemaService
public final SchemaService getSchemaService()
-
getTaskManager
protected final TaskManager getTaskManager()
-
getSearchSpecificationRequired
@NotNull protected final @NotNull SearchSpecification<C> getSearchSpecificationRequired()
-
getQuery
public final ObjectQuery getQuery()
-
getSearchOptions
public final Collection<SelectorOptions<GetOperationOptions>> getSearchOptions()
-
-