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
-
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.Iterable<ActivityState>
getActivityStatesUpwardsForParent(OperationResult result)
Returns an iterator over activity states, from the parent of the current activity to the root.static @NotNull ActivityState
getActivityStateUpwards(@NotNull ActivityPath activityPath, @NotNull Task task, @Nullable 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(@Nullable 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()
@Nullable String
getSimulationResultOid()
@Nullable ObjectReferenceType
getSimulationResultRef()
protected abstract @NotNull Task
getTask()
abstract @Nullable 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()
TODOboolean
isScavenger()
boolean
isSimulationResultCreated()
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
setSimulationResultCreated()
void
setSimulationResultOid(String oid)
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
-
-
Constructor Detail
-
ActivityState
protected ActivityState(@NotNull @NotNull CommonTaskBeans beans)
-
-
Method Detail
-
getRealizationState
public ActivityRealizationStateType getRealizationState()
-
isComplete
public boolean isComplete()
TODO
-
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
@Nullable public abstract @Nullable 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()
-
setSimulationResultOid
public void setSimulationResultOid(String oid) throws ActivityRunException
- Throws:
ActivityRunException
-
setSimulationResultCreated
public void setSimulationResultCreated() throws ActivityRunException
- Throws:
ActivityRunException
-
getSimulationResultRef
@Nullable public @Nullable ObjectReferenceType getSimulationResultRef()
-
getSimulationResultOid
@Nullable public @Nullable String getSimulationResultOid()
-
isSimulationResultCreated
public boolean isSimulationResultCreated()
-
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(@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: TheOperationResult
instance 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 usingOperationResult
instance at an unexpected place.
-
getActivityStateUpwards
@NotNull public static @NotNull ActivityState getActivityStateUpwards(@NotNull @NotNull ActivityPath activityPath, @NotNull @NotNull Task task, @Nullable @Nullable 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
-
-