Class ActivityState
- java.lang.Object
-
- com.evolveum.midpoint.repo.common.activity.run.state.ActivityState
-
- All Implemented Interfaces:
DebugDumpable
- Direct Known Subclasses:
CurrentActivityState
,OtherActivityState
public abstract class ActivityState extends Object implements DebugDumpable
-
-
Field Summary
Fields Modifier and Type Field Description protected @NotNull CommonTaskBeans
beans
protected ItemPath
stateItemPath
Path to the work state container value related to this run.-
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ActivityState(@NotNull CommonTaskBeans beans)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addDeleteItemRealValues(@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.String
debugDump(int indent)
protected abstract void
debugDumpExtra(StringBuilder sb, int indent)
void
flushPendingTaskModifications(OperationResult result)
Flushes pending task modifications.void
flushPendingTaskModificationsChecked(OperationResult result)
Flushes pending task modifications.abstract @NotNull ActivityPath
getActivityPath()
static @NotNull ActivityState
getActivityStateDownwards(@NotNull ActivityPath activityPath, @NotNull Task task, @NotNull QName workStateTypeName, @NotNull CommonTaskBeans beans, OperationResult result)
Gets the state of the given activity, starting from the `task` and going downwards.static @NotNull ActivityState
getActivityStateUpwards(@NotNull ActivityPath activityPath, @NotNull Task task, @NotNull QName workStateTypeName, @NotNull CommonTaskBeans beans, OperationResult result)
Returns activity state for given path, crawling from the current task upwards.BucketsProcessingRoleType
getBucketingRole()
@NotNull ActivityState
getCurrentActivityStateInParentTask(boolean fresh, @NotNull QName workStateTypeName, @Nullable OperationResult result)
Returns the state of the current activity in the parent task.protected @NotNull String
getEnhancedClassName()
@NotNull ActivityState
getParentActivityState(@NotNull QName workStateTypeName, OperationResult result)
Returns the state of the _parent activity_, e.g.<T> T
getPropertyRealValue(ItemPath path, Class<T> expectedType)
XMLGregorianCalendar
getRealizationStartTimestamp()
ActivityRealizationStateType
getRealizationState()
OperationResultStatus
getResultStatus()
protected abstract @NotNull Task
getTask()
abstract @NotNull ComplexTypeDefinition
getWorkStateComplexTypeDefinition()
<T> T
getWorkStateItemRealValueClone(ItemPath path, Class<T> expectedType)
<T> T
getWorkStatePropertyRealValue(ItemPath path, Class<T> expectedType)
ObjectReferenceType
getWorkStateReferenceRealValue(ItemPath path)
Collection<ObjectReferenceType>
getWorkStateReferenceRealValues(ItemPath path)
Map<String,Integer>
incrementCounters(ExecutionSupport.CountersGroup counterGroup, @NotNull Collection<String> countersIdentifiers, @NotNull OperationResult result)
boolean
isComplete()
boolean
isScavenger()
boolean
isWorker()
void
setItemRealValues(ItemPath path, Object... values)
DO NOT use for setting work state items because of dynamic typing of the work state container value.void
setItemRealValuesCollection(ItemPath path, Collection<?> values)
DO NOT use for setting work state items because of dynamic typing of the work state container value.void
setWorkStateItemRealValues(ItemPath path, ItemDefinition<?> explicitDefinition, Object... values)
void
setWorkStateItemRealValues(ItemPath path, Object... values)
String
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
-
-
-
-
Field Detail
-
beans
@NotNull protected final @NotNull CommonTaskBeans beans
-
stateItemPath
protected ItemPath stateItemPath
Path to the work state container value related to this run. Can be null if the state was not yet initialized (for theCurrentActivityState
) or if the state does not exist in a given task (for theOtherActivityState
).
-
-
Constructor Detail
-
ActivityState
protected ActivityState(@NotNull @NotNull CommonTaskBeans beans)
-
-
Method Detail
-
getRealizationState
public ActivityRealizationStateType getRealizationState()
-
isComplete
public boolean isComplete()
-
getRealizationStartTimestamp
public XMLGregorianCalendar getRealizationStartTimestamp()
-
getResultStatus
public OperationResultStatus getResultStatus()
-
getBucketingRole
public BucketsProcessingRoleType getBucketingRole()
-
isWorker
public boolean isWorker()
-
isScavenger
public boolean isScavenger()
-
setItemRealValues
public void setItemRealValues(ItemPath path, Object... values) throws ActivityRunException
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
@NotNull public abstract @NotNull ComplexTypeDefinition getWorkStateComplexTypeDefinition()
-
getWorkStatePropertyRealValue
public <T> T getWorkStatePropertyRealValue(ItemPath path, Class<T> expectedType)
-
getWorkStateItemRealValueClone
public <T> T getWorkStateItemRealValueClone(ItemPath path, Class<T> expectedType)
-
getWorkStateReferenceRealValue
public ObjectReferenceType getWorkStateReferenceRealValue(ItemPath path)
-
getWorkStateReferenceRealValues
public Collection<ObjectReferenceType> getWorkStateReferenceRealValues(ItemPath path)
-
setWorkStateItemRealValues
public void setWorkStateItemRealValues(ItemPath path, Object... values) throws SchemaException
- 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
@NotNull protected abstract @NotNull Task getTask()
-
debugDump
public String debugDump(int indent)
- Specified by:
debugDump
in interfaceDebugDumpable
-
debugDumpExtra
protected abstract void debugDumpExtra(StringBuilder sb, int indent)
-
getEnhancedClassName
@NotNull protected @NotNull String getEnhancedClassName()
-
getParentActivityState
@NotNull public @NotNull ActivityState getParentActivityState(@NotNull @NotNull QName workStateTypeName, OperationResult result) throws SchemaException, ObjectNotFoundException
Returns the state of the _parent activity_, e.g. operations completion sub-activity -> reconciliation activity. Note: the caller must know the work state type name. This can be resolved somehow in the future, e.g. by requiring that the work state already exists.
-
getActivityStateUpwards
@Experimental @NotNull public static @NotNull ActivityState getActivityStateUpwards(@NotNull @NotNull ActivityPath activityPath, @NotNull @NotNull Task task, @NotNull @NotNull QName workStateTypeName, @NotNull @NotNull CommonTaskBeans beans, 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:
SchemaException
ObjectNotFoundException
-
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:
SchemaException
ObjectNotFoundException
-
getActivityStateDownwards
@NotNull public static @NotNull ActivityState getActivityStateDownwards(@NotNull @NotNull ActivityPath activityPath, @NotNull @NotNull Task task, @NotNull @NotNull QName workStateTypeName, @NotNull @NotNull CommonTaskBeans beans, 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
@NotNull public abstract @NotNull ActivityPath getActivityPath()
-
incrementCounters
public Map<String,Integer> incrementCounters(@NotNull ExecutionSupport.CountersGroup counterGroup, @NotNull @NotNull Collection<String> countersIdentifiers, @NotNull @NotNull OperationResult result) throws SchemaException, ObjectNotFoundException, ObjectAlreadyExistsException
-
-