Class AbstractActivityRun<WD extends WorkDefinition,AH extends ActivityHandler<WD,AH>,WS extends AbstractActivityWorkStateType>   
java.lang.Object
com.evolveum.midpoint.repo.common.activity.run.AbstractActivityRun<WD,AH,WS>  
- Type Parameters:
- WD- Definition of the work that this activity has to do.
- AH- Type of the activity handler.
- WS- Type of the activity work (business) state.
- All Implemented Interfaces:
- ExecutionSupport,- DebugDumpable
- Direct Known Subclasses:
- DelegatingActivityRun,- DistributingActivityRun,- LocalActivityRun
public abstract class AbstractActivityRun<WD extends WorkDefinition,AH extends ActivityHandler<WD,AH>,WS extends AbstractActivityWorkStateType>   
extends Object
implements ExecutionSupport, DebugDumpable
Implements (represents) a run (execution) of an activity in the current task.
 Responsibilities _at this [highest] level of abstraction_:
 . Maintains links to other activity framework objects:
 - 
taskRun (ActivityBasedTaskRun)
 - activity (Activity)
 - activityState (ActivityState) (and its ActivityStateDefinition), including the state holding
 thresholds-supporting counters
 . Provides methods for navigation to more distant objects of the framework and other auxiliary objects (beans).
 . Provides skeleton of the execution - see run(OperationResult), managing (among others):
    a. activity state initialization and closing,
    b. execution of "before run" code,
    c. conversion of exceptions into ActivityRunResult (such conversion is done at various other levels, btw),
    d. start/end logging,
    e. updating task statistics,
    f. sending notifications.
 +
 Some of these duties are related to ones of LocalActivityRun.runInternal(OperationResult)- 
Nested Class SummaryNested classes/interfaces inherited from interface com.evolveum.midpoint.task.api.ExecutionSupportExecutionSupport.CountersGroup
- 
Field SummaryFieldsModifier and TypeFieldDescriptionDefinition of the activity.protected final @NotNull CurrentActivityState<WS>The "live" version of the activity state.protected LongWhen did this run end?protected LongWhen did this run start?protected final @NotNull ActivityBasedTaskRunThe task run in context of which this activity run takes place.Fields inherited from interface com.evolveum.midpoint.util.DebugDumpableINDENT_STRING
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedAbstractActivityRun(@NotNull ActivityRunInstantiationContext<WD, AH> context) 
- 
Method SummaryModifier and TypeMethodDescriptionbooleanbooleanbooleanbooleanbooleancanRun()@NotNull ActivityReportingCharacteristicsThis method should be called only after the concrete instance is fully initialized.debugDump(int indent) protected voiddebugDumpExtra(StringBuilder sb, int indent) protected ActivityStateDefinition<WS>Called during initialization.protected @NotNull ActivityStatedetermineActivityStateForCounters(@NotNull OperationResult result) protected voidprotected voidprotected voidUse this to disallow running activities that do not honor preview and/or dry-run mode, to avoid any confusion of the user.protected @NotNull ActivityDefinition<WD>@NotNull ExecutionModeTypeReturns the mode in which the activity executes (normal, dry run, simulate, ...).@NotNull ActivityPathReturns the path of the activity we are executing.@NotNull CurrentActivityState<WS>@NotNull ActivityStateDefinition<WS>getBeans()intAbstractActivityRun<?,?, ?> @NotNull ActivityReportingCharacteristics@NotNull RunningTasklong@NotNull ActivityBasedTaskRunReturns task run that contains this activity run.protected @NotNull ActivityTreeStateOverviewincrementCounters(@NotNull ExecutionSupport.CountersGroup counterGroup, @NotNull Collection<String> countersIdentifiers, @NotNull OperationResult result) Increments given counters related to the activity execution.voidincrementProgress(@NotNull QualifiedItemProcessingOutcomeType outcome) booleanbooleanisDryRun()protected booleanbooleanbooleanbooleanbooleanisWorker()protected voidCalled when the activity realization is complete.protected voidCalled when the activity realization startsrecordIterativeOperationStart(@NotNull IterativeOperationStartInfo info) @NotNull ActivityRunResultrun(OperationResult result) Runs the activity.protected abstract @NotNull ActivityRunResultrunInternal(OperationResult result) Carries out the actual run of this activity.protected voidbooleanReturns true if the work (business) state should be created right on activity run initialization, along with the rest of the state.protected ActivityRunResultprotected ActivityRunResultstandardRunResult(@Nullable OperationResultStatus status) Finished (with specified status), or interrupted.toString()Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.evolveum.midpoint.util.DebugDumpabledebugDump, debugDumpLazily, debugDumpLazily
- 
Field Details- 
taskRunThe task run in context of which this activity run takes place.
- 
activity@NotNull protected final @NotNull Activity<WD extends WorkDefinition,AH extends ActivityHandler<WD, activityAH>> Definition of the activity. Contains the definition of the work.
- 
activityState@NotNull protected final @NotNull CurrentActivityState<WS extends AbstractActivityWorkStateType> activityStateThe "live" version of the activity state.
- 
startTimestampWhen did this run start?
- 
endTimestampWhen did this run end?
 
- 
- 
Constructor Details- 
AbstractActivityRun
 
- 
- 
Method Details- 
createReportingCharacteristicsThis method should be called only after the concrete instance is fully initialized.
- 
setInstanceReadyprotected void setInstanceReady()
- 
determineActivityStateDefinitionCalled during initialization. Should not access reporting characteristics.
- 
getTaskRunReturns task run that contains this activity run.
- 
getActivity
- 
getBeans
- 
runRuns the activity. This method is responsible for carrying out the work, e.g. recomputing all the users. For pure- or semi-composite activities it is also responsible for creating the children runs. Note that the work can be delegated to other (asynchronous) tasks. This is the case of worker tasks in multi-node task run, or of activities executed as separate subtasks.- Throws:
- ActivityRunException
- See Also:
 
- 
runInternal@NotNull protected abstract @NotNull ActivityRunResult runInternal(OperationResult result) throws ActivityRunException, CommonException Carries out the actual run of this activity.- Throws:
- ActivityRunException
- CommonException
 
- 
toString
- 
debugDump- Specified by:
- debugDumpin interface- DebugDumpable
 
- 
debugDumpExtra
- 
getActivityPathDescription copied from interface:ExecutionSupportReturns the path of the activity we are executing.- Specified by:
- getActivityPathin interface- ExecutionSupport
 
- 
getLocalParentRun
- 
getActivityHandler
- 
getActivityState
- 
getRunningTask
- 
getTreeStateOverview
- 
standardRunResult
- 
standardRunResultFinished (with specified status), or interrupted.
- 
canRunpublic boolean canRun()
- 
shouldCreateWorkStateOnInitializationpublic boolean shouldCreateWorkStateOnInitialization()Returns true if the work (business) state should be created right on activity run initialization, along with the rest of the state. Maybe we should provide this customization in the "specifics" interface for iterative activities.
- 
areStatisticsSupportedpublic boolean areStatisticsSupported()
- 
isProgressSupportedpublic boolean isProgressSupported()
- 
areSynchronizationStatisticsSupportedpublic boolean areSynchronizationStatisticsSupported()
- 
areActionsExecutedStatisticsSupportedpublic boolean areActionsExecutedStatisticsSupported()
- 
areRunRecordsSupportedpublic boolean areRunRecordsSupported()
- 
incrementProgress
- 
getActivityStateDefinition
- 
incrementCounterspublic Map<String,Integer> incrementCounters(@NotNull @NotNull ExecutionSupport.CountersGroup counterGroup, @NotNull @NotNull Collection<String> countersIdentifiers, @NotNull @NotNull OperationResult result) throws SchemaException, ObjectNotFoundException, ObjectAlreadyExistsException Description copied from interface:ExecutionSupportIncrements given counters related to the activity execution.- Specified by:
- incrementCountersin interface- ExecutionSupport
- Returns:
- Current values of the counters (after the update).
- Throws:
- SchemaException
- ObjectNotFoundException
- ObjectAlreadyExistsException
 
- 
determineActivityStateForCounters@NotNull protected @NotNull ActivityState determineActivityStateForCounters(@NotNull @NotNull OperationResult result) throws SchemaException, ObjectNotFoundException 
- 
getActivityExecutionModeDescription copied from interface:ExecutionSupportReturns the mode in which the activity executes (normal, dry run, simulate, ...).- Specified by:
- getActivityExecutionModein interface- ExecutionSupport
 
- 
isDryRunpublic boolean isDryRun()
- 
isFullExecutionprotected boolean isFullExecution()
- 
isNoExecutionpublic boolean isNoExecution()
- 
isBucketAnalysispublic boolean isBucketAnalysis()
- 
getItemsProcessedpublic int getItemsProcessed()
- 
isNonScavengingWorkerpublic boolean isNonScavengingWorker()
- 
isWorkerpublic boolean isWorker()
- 
getWorkDefinition
- 
getActivityDefinition
- 
getReportingCharacteristics
- 
getStartTimestampRequiredpublic long getStartTimestampRequired()
- 
recordIterativeOperationStart- Specified by:
- recordIterativeOperationStartin interface- ExecutionSupport
 
- 
onActivityRealizationStartCalled when the activity realization starts. - For delegated activities this is _after_ the delegation occurred. (I.e. in the delegate run.) - For distributed activities this is before any of the workers are started. - For non-delegated, non-distributed (local-only) activities this is when the local run starts the first time. Overall, this should happen exactly once per activity realization. In subclasses: Do not forget to call the implementation in the super-class.- Throws:
- ActivityRunException
 
- 
onActivityRealizationCompleteCalled when the activity realization is complete. It should be called at most once for any given activity. (Regardless of its delegation or distribution.) Planned e.g. for closing the simulation result (for computing statistics, etc). TODO this is something like a placeholder for now -- probably it will NOT work in the current implementation!- Throws:
- ActivityRunException
 
- 
ensureNoPreviewNorDryRunprotected void ensureNoPreviewNorDryRun()Use this to disallow running activities that do not honor preview and/or dry-run mode, to avoid any confusion of the user.
- 
ensureNoDryRunprotected void ensureNoDryRun()
- 
ensureFullExecutionprotected void ensureFullExecution()
 
-