Class ActivityState
java.lang.Object
com.evolveum.midpoint.repo.common.activity.run.state.ActivityState
- All Implemented Interfaces:
DebugDumpable
- Direct Known Subclasses:
CurrentActivityState,OtherActivityState
Used to manipulate
ActivityStateType objects in a task:
- either the current one (CurrentActivityState)
- or some other one (OtherActivityState) - e.g. parent activity (in the same task or its parent task), or any
other activity in the task tree.
The most recommended usage style is to update the current activity state. It is e.g. the most safe regarding the concurrency.
NOTE: This class is NOT intended to hold everything related to "activity state". It is just-
Field Summary
FieldsFields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDeleteItemRealValues(@NotNull ItemPath path, @NotNull Collection<?> valuesToAdd, @NotNull Collection<?> valuesToDelete) DO NOT use for setting work state items because of dynamic typing of the work state container value.debugDump(int indent) protected abstract voiddebugDumpExtra(StringBuilder sb, int indent) voidFlushes pending task modifications.voidFlushes pending task modifications.abstract @NotNull ActivityPathstatic @NotNull ActivityStategetActivityStateDownwards(@NotNull ActivityPath activityPath, @NotNull Task task, @NotNull QName workStateTypeName, OperationResult result) Gets the state of the given activity, starting from the `task` and going downwards.Returns an iterator over activity states, from the parent of the current activity to the root.static @NotNull ActivityStategetActivityStateUpwards(@NotNull ActivityPath activityPath, @NotNull Task task, @Nullable QName workStateTypeName, OperationResult result) Returns activity state for given path, crawling from the current task upwards.getCounters(@NotNull ExecutionSupport.CountersGroup counterGroup) @NotNull ActivityStategetCurrentActivityStateInParentTask(boolean fresh, @NotNull QName workStateTypeName, @Nullable OperationResult result) Returns the state of the current activity in the parent task.protected @NotNull Stringint@NotNull ActivityStategetParentActivityState(@Nullable QName workStateTypeName, OperationResult result) Returns the state of the _parent activity_, e.g. operations completion sub-activity -> reconciliation activity.<T> TgetPropertyRealValue(ItemPath path, Class<T> expectedType) @NotNull Collection<ActivityRunRecordType>@NotNull RestartActivityPolicyActionType@Nullable String@Nullable ObjectReferenceTypeprotected abstract @NotNull TaskgetTask()abstract @Nullable ComplexTypeDefinition<T> TgetWorkStateItemRealValueClone(ItemPath path, Class<T> expectedType) <T> TgetWorkStatePropertyRealValue(ItemPath path, Class<T> expectedType) incrementCounters(@NotNull ExecutionSupport.CountersGroup counterGroup, @NotNull Collection<String> countersIdentifiers, @NotNull OperationResult result) booleanbooleanReturnstrueif there is a request to restart this particular activity.booleanReturnstrueif there is a request to restart or skip this particular activity.booleanReturnstrueif there is a request to skip this particular activity.booleanbooleanbooleanbooleanBeware!booleanbooleanbooleanisWorker()voidsetAbortingWorkerRef(ObjectReferenceType workerRef) voidvoidsetItemRealValues(ItemPath path, Object... values) DO NOT use for setting work state items because of dynamic typing of the work state container value.voidsetItemRealValuesCollection(ItemPath path, Collection<?> values) DO NOT use for setting work state items because of dynamic typing of the work state container value.voidvoidvoidsetWorkStateItemRealValues(ItemPath path, ItemDefinition<?> explicitDefinition, Object... values) voidsetWorkStateItemRealValues(ItemPath path, Object... values) toString()updatePolicies(@NotNull Collection<ActivityPolicyStateType> policies, @NotNull OperationResult result) Methods 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, debugDumpLazily
-
Field Details
-
beans
-
-
Constructor Details
-
ActivityState
protected ActivityState()
-
-
Method Details
-
getRealizationState
-
isComplete
public boolean isComplete() -
isAborted
public boolean isAborted() -
isBeingRestartedOrSkipped
public boolean isBeingRestartedOrSkipped()Returnstrueif there is a request to restart or skip this particular activity. -
isBeingRestarted
public boolean isBeingRestarted()Returnstrueif there is a request to restart this particular activity. -
getRestartPolicyActionRequired
-
isBeingSkipped
public boolean isBeingSkipped()Returnstrueif there is a request to skip this particular activity. -
getRealizationStartTimestamp
-
getResultStatus
-
setBucketProcessingRole
- Throws:
ActivityRunException
-
getBucketProcessingRole
-
isWorker
public boolean isWorker() -
isScavenger
public boolean isScavenger() -
isBucketedWorkComplete
public boolean isBucketedWorkComplete() -
setAbortingWorkerRef
- Throws:
ActivityRunException
-
getAbortingWorkerRef
-
isBucketedWorkAborted
public boolean isBucketedWorkAborted() -
getPropertyRealValue
-
setItemRealValues
DO NOT use for setting work state items because of dynamic typing of the work state container value.- Throws:
ActivityRunException
-
setItemRealValuesCollection
public void setItemRealValuesCollection(ItemPath path, Collection<?> values) throws ActivityRunException DO NOT use for setting work state items because of dynamic typing of the work state container value.- Throws:
ActivityRunException
-
addDeleteItemRealValues
public void addDeleteItemRealValues(@NotNull @NotNull ItemPath path, @NotNull @NotNull Collection<?> valuesToAdd, @NotNull @NotNull Collection<?> valuesToDelete) throws ActivityRunException DO NOT use for setting work state items because of dynamic typing of the work state container value.- Throws:
ActivityRunException
-
flushPendingTaskModifications
public void flushPendingTaskModifications(OperationResult result) throws SchemaException, ObjectNotFoundException, ObjectAlreadyExistsException Flushes pending task modifications. Note for implementers: this method should be equivalent to a direct call toTask.flushPendingModifications(OperationResult). -
flushPendingTaskModificationsChecked
public void flushPendingTaskModificationsChecked(OperationResult result) throws ActivityRunException Flushes pending task modifications. Note for implementers: this method should be equivalent to a direct call toTask.flushPendingModifications(OperationResult).- Throws:
ActivityRunException
-
getWorkStateComplexTypeDefinition
-
getWorkStatePropertyRealValue
-
getWorkStateItemRealValueClone
-
getWorkStateReferenceRealValue
-
getWorkStateReferenceRealValues
-
setWorkStateItemRealValues
- Throws:
SchemaException
-
setWorkStateItemRealValues
public void setWorkStateItemRealValues(ItemPath path, ItemDefinition<?> explicitDefinition, Object... values) throws SchemaException - Parameters:
explicitDefinition- If present, we do not try to derive the definition from work state CTD.- Throws:
SchemaException
-
getTask
-
setSimulationResultOid
- Throws:
ActivityRunException
-
setSimulationResultCreated
- Throws:
ActivityRunException
-
getSimulationResultRef
-
getSimulationResultOid
-
isSimulationResultCreated
public boolean isSimulationResultCreated() -
getRawRunRecordsClone
-
isDelegating
Beware! May not be quite precise if the state was not set up yet. -
toString
-
debugDump
- Specified by:
debugDumpin interfaceDebugDumpable
-
debugDumpExtra
-
getEnhancedClassName
-
getParentActivityState
@NotNull public @NotNull ActivityState getParentActivityState(@Nullable @Nullable QName workStateTypeName, OperationResult result) throws SchemaException, ObjectNotFoundException Returns the state of the _parent activity_, e.g. operations completion sub-activity -> reconciliation activity. -
getActivityStatesUpwardsForParent
@Experimental public Iterable<ActivityState> getActivityStatesUpwardsForParent(OperationResult result) Returns an iterator over activity states, from the parent of the current activity to the root. Note that the _work_ states must either exist, or must not be modified by the caller after obtaining (as we don't know their type - at least for now). The idea is to encapsulate the crawling logic, while avoiding the (eventual) task fetch operations if they are not really needed. BEWARE: TheOperationResultinstance is buried into the iterator, and used withinIterator.next()calls. This is quite dangerous. Maybe we should not do this at all. The best use of this method is when the result is consumed (iterated through) just after it is obtained. That way you avoid the risk of usingOperationResultinstance at an unexpected place. -
getActivityStateUpwards
@NotNull public static @NotNull ActivityState getActivityStateUpwards(@NotNull @NotNull ActivityPath activityPath, @NotNull @NotNull Task task, @Nullable @Nullable QName workStateTypeName, OperationResult result) throws SchemaException, ObjectNotFoundException Returns activity state for given path, crawling from the current task upwards.- Parameters:
activityPath- Path to activity for which to obtain activity state.task- Task where to start searching.workStateTypeName- Expected type of the work state.- Throws:
SchemaExceptionObjectNotFoundException
-
getCurrentActivityStateInParentTask
@NotNull public @NotNull ActivityState getCurrentActivityStateInParentTask(boolean fresh, @NotNull @NotNull QName workStateTypeName, @Nullable @Nullable OperationResult result) throws SchemaException, ObjectNotFoundException Returns the state of the current activity in the parent task. Assumes that it exists.- Parameters:
fresh- true if we always need to load the parent task from repository; false if we can use cached version (created when the running task started)result- Can be null if we are 100% sure it will not be used.- Throws:
SchemaExceptionObjectNotFoundException
-
getActivityStateDownwards
@NotNull public static @NotNull ActivityState getActivityStateDownwards(@NotNull @NotNull ActivityPath activityPath, @NotNull @NotNull Task task, @NotNull @NotNull QName workStateTypeName, OperationResult result) throws SchemaException, ObjectNotFoundException Gets the state of the given activity, starting from the `task` and going downwards. UNTESTED. Use with care. TODO cleanup and test thoroughly -
getActivityPath
-
incrementCounters
public Map<String,Integer> incrementCounters(@NotNull @NotNull ExecutionSupport.CountersGroup counterGroup, @NotNull @NotNull Collection<String> countersIdentifiers, @NotNull @NotNull OperationResult result) throws SchemaException, ObjectNotFoundException, ObjectAlreadyExistsException -
getCounters
@NotNull public @NotNull Map<String,Integer> getCounters(@NotNull @NotNull ExecutionSupport.CountersGroup counterGroup) -
getAbortingInformation
-
getAbortingInformationRequired
-
updatePolicies
public Map<String,ActivityPolicyStateType> updatePolicies(@NotNull @NotNull Collection<ActivityPolicyStateType> policies, @NotNull @NotNull OperationResult result) throws SchemaException, ObjectNotFoundException, ObjectAlreadyExistsException -
getExecutionAttempt
public int getExecutionAttempt()
-