Class NullTaskImpl

    • Field Detail

      • INSTANCE

        public static final Task INSTANCE
    • Constructor Detail

      • NullTaskImpl

        public NullTaskImpl()
    • Method Detail

      • addDependent

        public void addDependent​(String taskIdentifier)
        Description copied from interface: Task
        Add a task as this task's dependent, i.e. the task denoted by taskIdentifier DEPENDS ON (waits for completion of) this task.
        Specified by:
        addDependent in interface Task
      • isAsynchronous

        public boolean isAsynchronous()
        Description copied from interface: Task
        Returns true if the task is asynchronous. The asynchronous task is not executing in foreground. Therefore any thread that is not explicitly allocated for the task can be discarded. E.g. if a GUI thread detects that the task is asynchronous it knows that there is no point in waiting for the task result. It can just display appropriate message to the user (e.g. "please come back later") and return control back to the web container. Usually, asynchronous means the same as persistent. However, there can are lightweight tasks that are asynchronous but not stored in repository.
        Specified by:
        isAsynchronous in interface Task
        Returns:
        true if the task is asynchronous.
      • setInitiallyWaitingForPrerequisites

        public void setInitiallyWaitingForPrerequisites()
        Description copied from interface: Task
        Sets the initial task execution and scheduling state to make task waiting (for prerequisite tasks).
        Specified by:
        setInitiallyWaitingForPrerequisites in interface Task
      • isTransient

        public boolean isTransient()
        Description copied from interface: Task
        Returns true if task is transient (i.e. not stored in repository).
        Specified by:
        isTransient in interface Task
      • isPersistent

        public boolean isPersistent()
        Description copied from interface: Task
        Returns true if task is persistent (i.e. stored in repository).
        Specified by:
        isPersistent in interface Task
      • getRecurrence

        @NotNull
        public @NotNull TaskRecurrenceType getRecurrence()
        Description copied from interface: Task
        Returns task recurrence status.
        Specified by:
        getRecurrence in interface Task
      • setSchedule

        public void setSchedule​(ScheduleType schedule)
        Description copied from interface: Task
        Sets the schedule for the task. Removes also the legacy recurrence flag.
        Specified by:
        setSchedule in interface Task
      • getSchedule

        public ScheduleType getSchedule()
        Description copied from interface: Task
        Returns the schedule.
        Specified by:
        getSchedule in interface Task
      • getScheduleInterval

        public Integer getScheduleInterval()
        Description copied from interface: Task
        Returns the schedule interval.
        Specified by:
        getScheduleInterval in interface Task
      • hasScheduleInterval

        public boolean hasScheduleInterval()
        Description copied from interface: Task
        Returns true if the schedule interval is set.
        Specified by:
        hasScheduleInterval in interface Task
      • getHandlerUri

        public String getHandlerUri()
        Description copied from interface: Task
        Returns handler URI. It indirectly specifies which class is responsible to handle the task. The handler will execute reaction to a task lifecycle events such as executing the task, task heartbeat, etc.
        Specified by:
        getHandlerUri in interface Task
      • setHandlerUri

        public void setHandlerUri​(String value)
        Description copied from interface: Task
        Sets handler URI.
        Specified by:
        setHandlerUri in interface Task
      • getTaskIdentifier

        public String getTaskIdentifier()
        Description copied from interface: Task
        Returns task (lightweight) identifier. This is an unique identification of any task, regardless whether it is persistent or transient (cf. OID). Therefore this can be used to identify all tasks, e.g. for the purposes of auditing and logging. Task identifier is assigned automatically when the task is created. It is immutable.
        Specified by:
        getTaskIdentifier in interface Task
      • getOwner

        public PrismObject<? extends FocusType> getOwner​(OperationResult result)
        Description copied from interface: Task
        Returns object that owns this task. It usually means the user that started the task or a system used that is used to execute the task. The owner will be used to determine access rights of the task, will be used for auditing, etc. The object is lazily fetched from repository.
        Specified by:
        getOwner in interface Task
      • setOwner

        public void setOwner​(PrismObject<? extends FocusType> owner)
        Description copied from interface: Task
        Sets the task owner. Precondition: Task is transient.
        Specified by:
        setOwner in interface Task
      • setOwnerRef

        public void setOwnerRef​(ObjectReferenceType ownerRef)
        Description copied from interface: Task
        Sets the task owner reference. Precondition: Task is transient.
        Specified by:
        setOwnerRef in interface Task
      • getChannel

        public String getChannel()
        Description copied from interface: Task
        Returns channel URI associated with this task.
        Specified by:
        getChannel in interface Task
      • setChannel

        public void setChannel​(String channelUri)
        Description copied from interface: Task
        Sets channel URI.
        Specified by:
        setChannel in interface Task
      • getRequestee

        public PrismObject<UserType> getRequestee()
        Description copied from interface: Task
        Gets the requestee OID - typically an identification of account owner (for notifications). Serves for communication between model and provisioning. It is a temporary feature - will be removed in midPoint 2.3.
        Specified by:
        getRequestee in interface Task
      • getModelOperationContext

        public LensContextType getModelOperationContext()
        Description copied from interface: Task
        Gets model operation context stored in task. NOT THREAD SAFE!
        Specified by:
        getModelOperationContext in interface Task
      • setModelOperationContext

        public void setModelOperationContext​(LensContextType modelOperationContext)
        Description copied from interface: Task
        Sets model operation context.
        Specified by:
        setModelOperationContext in interface Task
      • getOid

        public String getOid()
        Description copied from interface: Task
        Returns task OID. Only persistent tasks have OID. So this method returns null if the task is not persistent.
        Specified by:
        getOid in interface Task
      • getObject

        public <T extends ObjectTypePrismObject<T> getObject​(Class<T> type,
                                                               OperationResult result)
        Description copied from interface: Task
        Returns object that the task is associated with. Tasks may be associated with a particular objects. For example a "import from resource" task is associated with the resource definition object that it imports from. Similarly for synchronization and reconciliation tasks (cycles). User approval and modification task may be associated with that user. If the task contains a reference without full object, the object is fetched from the repository. (Authorizations are *not* checked.)
        Specified by:
        getObject in interface Task
      • getObjectRefOrClone

        public ObjectReferenceType getObjectRefOrClone()
        Description copied from interface: Task
        Returns reference to the object that the task is associated with. Tasks may be associated with a particular objects. For example a "import from resource" task is associated with the resource definition object that it imports from. Similarly for synchronization and reconciliation tasks (cycles). This is an optional property.
        Specified by:
        getObjectRefOrClone in interface Task
      • setObjectRef

        public void setObjectRef​(String oid,
                                 QName type)
        Description copied from interface: Task
        Sets the object reference.
        Specified by:
        setObjectRef in interface Task
      • getObjectOid

        public String getObjectOid()
        Description copied from interface: Task
        Returns OID of the object that the task is associated with. Convenience method. This will get the OID from the objectRef.
        Specified by:
        getObjectOid in interface Task
      • getResult

        public OperationResult getResult()
        Description copied from interface: Task
        Returns a top-level OperationResult stored in the task. Beware of thread safety. This is a live object!
        Specified by:
        getResult in interface Task
      • setResult

        public void setResult​(OperationResult result)
        Description copied from interface: Task
        Sets the top-level OperationResult stored in the task. Use with care!
        Specified by:
        setResult in interface Task
      • getLastRunStartTimestamp

        public Long getLastRunStartTimestamp()
        Description copied from interface: Task
        Returns the time when the task last run was started (or null if the task was never started). This is set only for asynchronously executing tasks. And it is set also for the current execution.
        Specified by:
        getLastRunStartTimestamp in interface Task
      • getLastRunFinishTimestamp

        public Long getLastRunFinishTimestamp()
        Description copied from interface: Task
        Returns the time when the task last run was finished (or null if the task was not finished yet). This is set only for asynchronously executing tasks.
        Specified by:
        getLastRunFinishTimestamp in interface Task
      • getNextRunStartTime

        public Long getNextRunStartTime​(OperationResult result)
        Description copied from interface: Task
        Returns the time when the task should start again. This is transient property, present only if explicitly requested.
        Specified by:
        getNextRunStartTime in interface Task
      • getName

        public PolyStringType getName()
        Description copied from interface: Task
        Returns human-readable name of the task.
        Specified by:
        getName in interface Task
      • setName

        public void setName​(PolyStringType value)
        Description copied from interface: Task
        Sets the human-readable name of the task.
        Specified by:
        setName in interface Task
      • setName

        public void setName​(String value)
        Description copied from interface: Task
        Sets the human-readable name of the task.
        Specified by:
        setName in interface Task
      • setNameImmediate

        public void setNameImmediate​(PolyStringType value,
                                     OperationResult parentResult)
        Description copied from interface: Task
        Sets the human-readable name of the task, immediately into repository.
        Specified by:
        setNameImmediate in interface Task
      • getExtensionItemOrClone

        public <IV extends PrismValue,​ID extends ItemDefinition<?>> Item<IV,​ID> getExtensionItemOrClone​(ItemName propertyName)
        Description copied from interface: Task
        Returns specified item (property, reference or container) from the extension. Cloned if running task. Null if extension or item does not exist.
        Specified by:
        getExtensionItemOrClone in interface Task
      • setExtensionContainer

        public <C extends Containerable> void setExtensionContainer​(PrismContainer<C> item)
        Description copied from interface: Task
        Sets a container in the extension - replaces existing value(s), if any, by the one(s) provided.
        Specified by:
        setExtensionContainer in interface Task
        Parameters:
        item - Container with value(s) to be put into task extension.
      • setExtensionReference

        public void setExtensionReference​(PrismReference reference)
        Description copied from interface: Task
        Sets a reference in the extension - replaces existing value(s), if any, by the one(s) provided.
        Specified by:
        setExtensionReference in interface Task
      • setExtensionProperty

        public void setExtensionProperty​(PrismProperty<?> property)
        Description copied from interface: Task
        Sets a property in the extension - replaces existing value(s), if any, by the one(s) provided.
        Specified by:
        setExtensionProperty in interface Task
      • addExtensionProperty

        public void addExtensionProperty​(PrismProperty<?> property)
        Description copied from interface: Task
        Adds value(s) to a given extension property.
        Specified by:
        addExtensionProperty in interface Task
        Parameters:
        property - holder of the value(s) to be added into task extension property
      • setExtensionContainerValue

        public <T extends Containerable> void setExtensionContainerValue​(QName containerName,
                                                                         T value)
        Description copied from interface: Task
        Sets a container value in the extension - replaces existing value(s), if any, by the one provided.
        Specified by:
        setExtensionContainerValue in interface Task
        Parameters:
        containerName - name of the container
        value - value to be put into extension
      • setExtensionItem

        public void setExtensionItem​(Item<?,​?> item)
        Description copied from interface: Task
        Puts generic item into extension.
        Specified by:
        setExtensionItem in interface Task
      • getLegacyProgress

        public long getLegacyProgress()
        Description copied from interface: Task
        Returns task progress, as reported by task handler.
        Specified by:
        getLegacyProgress in interface Task
      • setLegacyProgress

        public void setLegacyProgress​(Long value)
        Description copied from interface: Task
        Records _legacy_ progress of the task, storing it persistently if needed.
        Specified by:
        setLegacyProgress in interface Task
      • incrementLegacyProgressTransient

        public void incrementLegacyProgressTransient()
        Description copied from interface: Task
        Increments legacy progress without creating a pending modification.
        Specified by:
        incrementLegacyProgressTransient in interface Task
      • getUpdatedTaskObject

        @NotNull
        public @NotNull PrismObject<TaskType> getUpdatedTaskObject()
        Description copied from interface: Task
        Returns backing task prism object UPDATED with current operation result. Assumes that task is not running. (Otherwise IllegalStateException is thrown.)
        Specified by:
        getUpdatedTaskObject in interface Task
      • getRawTaskObjectClone

        @NotNull
        public @NotNull PrismObject<TaskType> getRawTaskObjectClone()
        Description copied from interface: Task
        Returns CLONE of backing task prism object without updating with current operation result.
        Specified by:
        getRawTaskObjectClone in interface Task
      • refresh

        public void refresh​(OperationResult result)
        Description copied from interface: Task
        Re-reads the task state from the persistent storage. The task state may be synchronized with the repository all the time. But the specified timing is implementation-specific. Call to this method will make sure that the task contains fresh data. This has no effect on transient tasks.
        Specified by:
        refresh in interface Task
      • debugDump

        public String debugDump()
        Description copied from interface: DebugDumpable
        Show the content of the object intended for diagnostics by system administrator. The out put should be suitable to use in system logs at "debug" level. It may be multi-line, but in that case it should be well indented and quite terse. As it is intended to be used by system administrator, it should not use any developer terms such as class names, exceptions or stack traces.
        Specified by:
        debugDump in interface DebugDumpable
        Returns:
        content of the object intended for diagnostics by system administrator.
      • flushPendingModifications

        public void flushPendingModifications​(OperationResult parentResult)
        Description copied from interface: Task
        Saves modifications done against the in-memory version of the task into the repository.
        Specified by:
        flushPendingModifications in interface Task
      • getCategory

        public String getCategory()
        Description copied from interface: Task
        Task category is a user-oriented term, hinting on what 'kind' of task is the one being considered (system task, workflow, live sync, ...). In most cases, category can be derived from the task handler. Category can be set directly; but if not set directly, it is set automatically on first task execution, determined based on task handler URI. List of categories is in the TaskCategory class.
        Specified by:
        getCategory in interface Task
      • getNode

        public String getNode()
        Description copied from interface: Task
        Returns the node the task is currently executing at, based on repository information. This is present in all cases, however, it might be out-of-date, e.g. when node crashes.
        Specified by:
        getNode in interface Task
      • getNodeAsObserved

        public String getNodeAsObserved()
        Description copied from interface: Task
        Returns the node as really observed. This is a transient information that has to be requested explicitly.
        Specified by:
        getNodeAsObserved in interface Task
      • getResultStatus

        public OperationResultStatusType getResultStatus()
        Description copied from interface: Task
        Returns the status of top-level OperationResult stored in the task. If "live" operation result is present, the status it taken from it. Otherwise, resultStatus from task prism is fetched. TODO reconsider this method
        Specified by:
        getResultStatus in interface Task
      • getThreadStopAction

        public ThreadStopActionType getThreadStopAction()
        Description copied from interface: Task
        Returns thread stop action (what happens when the task thread is stopped e.g. because of node going down).
        Specified by:
        getThreadStopAction in interface Task
      • setCategory

        public void setCategory​(String category)
        Description copied from interface: Task
        Sets the task category.
        Specified by:
        setCategory in interface Task
      • addArchetypeInformation

        public void addArchetypeInformation​(String archetypeOid)
        Description copied from interface: Task
        Adds an archetype for the task. Assumes that the task will NOT undergo full model processing, so this method will do everything by itself: creates an assignment, roleMembershipRef and archetypeRef. Throws an exception if an archetype is already assigned. This is temporary/experimental implementation. It was not tested for persistent tasks (although it should work also for them).
        Specified by:
        addArchetypeInformation in interface Task
      • getExtensionOrClone

        public PrismContainer<? extends ExtensionType> getExtensionOrClone()
        Description copied from interface: Task
        Returns task extension. The extension is a part of task that can store arbitrary data. It usually holds data specific to a task type, internal task state, business state or similar data that are out of scope of this interface definition. To maintain thread safety, for RunningTask this method returns extension clone. (So don't use the return value to modify the task extension if not sure whether the task is running.)
        Specified by:
        getExtensionOrClone in interface Task
      • getExtensionPropertyOrClone

        public <T> PrismProperty<T> getExtensionPropertyOrClone​(ItemName propertyName)
        Description copied from interface: Task
        Returns specified property from the extension; or null if extension or property does not exist. Cloned if task is running.
        Specified by:
        getExtensionPropertyOrClone in interface Task
      • getExtensionContainerRealValueOrClone

        public <T extends Containerable> T getExtensionContainerRealValueOrClone​(ItemName containerName)
        Description copied from interface: Task
        Returns specified single-valued container real value from the extension To ensure thread safety, in the case of running tasks the returned value is a clone of the live one. Returns null if extension or container does not exist.
        Specified by:
        getExtensionContainerRealValueOrClone in interface Task
      • getExtensionReferenceOrClone

        public PrismReference getExtensionReferenceOrClone​(ItemName name)
        Description copied from interface: Task
        Returns specified reference from the extension. Cloned if running task. Null if extension or reference does not exist.
        Specified by:
        getExtensionReferenceOrClone in interface Task
      • setDescriptionImmediate

        public void setDescriptionImmediate​(String value,
                                            OperationResult result)
        Description copied from interface: Task
        Sets task description, immediately storing it into the repo.
        Specified by:
        setDescriptionImmediate in interface Task
      • setDescription

        public void setDescription​(String value)
        Description copied from interface: Task
        Sets task description.
        Specified by:
        setDescription in interface Task
      • getDescription

        public String getDescription()
        Description copied from interface: Task
        Returns task description.
        Specified by:
        getDescription in interface Task
      • deleteExtensionProperty

        public void deleteExtensionProperty​(PrismProperty<?> property)
        Description copied from interface: Task
        Removes specified VALUES of this extension property (not all of its values).
        Specified by:
        deleteExtensionProperty in interface Task
      • createSubtask

        public Task createSubtask()
        Description copied from interface: Task
        Creates a transient subtask. Owner is inherited from parent task to subtask.
        Specified by:
        createSubtask in interface Task
      • getParent

        public String getParent()
        Description copied from interface: Task
        Returns the identifier of the task's parent (or null of there is no parent task).
        Specified by:
        getParent in interface Task
      • listPrerequisiteTasks

        public List<Task> listPrerequisiteTasks​(OperationResult parentResult)
        Description copied from interface: Task
        List all prerequisite tasks for the current tasks, i.e. tasks that must complete before this one can proceed. If A is on the list of prerequisites of B (THIS), it means that B is on list of dependents of A (i.e. B waits for A to complete). Again, implicit prerequisites (children) are not listed here.
        Specified by:
        listPrerequisiteTasks in interface Task
      • getRawTaskObjectClonedIfNecessary

        @NotNull
        public @NotNull PrismObject<TaskType> getRawTaskObjectClonedIfNecessary()
        Description copied from interface: Task
        Returns backing task prism object without updating with current operation result. If the task is running, a clone is returned.
        Specified by:
        getRawTaskObjectClonedIfNecessary in interface Task
      • getDependents

        public List<String> getDependents()
        Description copied from interface: Task
        Lists all explicit dependents' identifiers.
        Specified by:
        getDependents in interface Task
      • listDependents

        public List<Task> listDependents​(OperationResult result)
        Description copied from interface: Task
        Lists all explicit dependents, i.e. tasks that wait for the completion of this tasks (that depend on it). Implicit dependents, i.e. task's parent, grandparent, etc are NOT listed here.
        Specified by:
        listDependents in interface Task
      • getCompletionTimestamp

        public Long getCompletionTimestamp()
        Description copied from interface: Task
        Returns the completion timestamp - time when the task was closed (or null if it is not closed).
        Specified by:
        getCompletionTimestamp in interface Task
      • addExtensionReference

        public void addExtensionReference​(PrismReference reference)
        Description copied from interface: Task
        Adds value(s) to a given extension reference.
        Specified by:
        addExtensionReference in interface Task
        Parameters:
        reference - holder of the value(s) to be added into task extension reference
      • listSubtasksDeeply

        public List<Task> listSubtasksDeeply​(boolean persistentOnly,
                                             OperationResult result)
        Description copied from interface: Task
        Lists all tasks in subtasks tree.
        Specified by:
        listSubtasksDeeply in interface Task
        Parameters:
        persistentOnly - If true, transient subtasks (i.e. lightweight asynchronous tasks) are ignored.
      • getPolicyRule

        public PolicyRuleType getPolicyRule()
        Description copied from interface: Task
        Gets the policy rule defined for the task (for running task the returned value is a clone).
        Specified by:
        getPolicyRule in interface Task
      • getExpectedTotal

        public Long getExpectedTotal()
        Description copied from interface: Task
        Returns expected total progress.
        Specified by:
        getExpectedTotal in interface Task
      • setExpectedTotal

        public void setExpectedTotal​(Long value)
        Description copied from interface: Task
        Stores expected total progress of the task, storing it persistently if needed.
        Specified by:
        setExpectedTotal in interface Task
      • getStoredOperationStatsOrClone

        public OperationStatsType getStoredOperationStatsOrClone()
        Description copied from interface: Task
        Returns operation statistics from the task prism object (i.e. not the live ones). Clones if running task.
        Specified by:
        getStoredOperationStatsOrClone in interface Task
      • modify

        public void modify​(@NotNull
                           @NotNull ItemDelta<?,​?> delta)
        Description copied from interface: Task
        Changes in-memory representation immediately and schedules a corresponding batched modification.
        Specified by:
        modify in interface Task
      • getGroup

        public String getGroup()
        Description copied from interface: Task
        Gets the execution group name (i.e. executionConstraints/group).
        Specified by:
        getGroup in interface Task
      • getGroups

        @NotNull
        public @NotNull Collection<String> getGroups()
        Description copied from interface: Task
        Returns names of all groups (primary plus all secondary ones).
        Specified by:
        getGroups in interface Task
      • getGroupsWithLimits

        @NotNull
        public @NotNull Map<String,​Integer> getGroupsWithLimits()
        Description copied from interface: Task
        Returns all groups (primary plus all secondary ones) along with task count limits.
        Specified by:
        getGroupsWithLimits in interface Task
      • getWorkState

        public TaskActivityStateType getWorkState()
        Description copied from interface: Task
        Gets task work state. NOT THREAD SAFE! TODO throw exception for RunningTask. (After revising of all uses.)
        Specified by:
        getWorkState in interface Task
      • doesItemExist

        public boolean doesItemExist​(ItemPath path)
        Description copied from interface: Task
        TODO
        Specified by:
        doesItemExist in interface Task
      • getAggregatedLiveOperationStats

        public OperationStatsType getAggregatedLiveOperationStats()
        Description copied from interface: Task
        Gets information from the current task and - for running task - its transient subtasks (aka worker threads). Clients beware: Update thread-local statistics before! They are not updated inside this method.
        Specified by:
        getAggregatedLiveOperationStats in interface Task
      • getSelfReferenceFull

        @NotNull
        public @NotNull ObjectReferenceType getSelfReferenceFull()
        Description copied from interface: Task
        Returns a full (object-bearing) reference to the task prism. Precondition: Task must be persistent.
        Specified by:
        getSelfReferenceFull in interface Task
      • getSelfReference

        @NotNull
        public @NotNull ObjectReferenceType getSelfReference()
        Description copied from interface: Task
        Returns a reference to the task prism. Precondition: Task must be persistent.
        Specified by:
        getSelfReference in interface Task
      • getVersion

        public String getVersion()
        Description copied from interface: Task
        Returns the version of underlying prism object.
        Specified by:
        getVersion in interface Task
      • getOwnerRef

        public ObjectReferenceType getOwnerRef()
        Description copied from interface: Task
        Returns a reference to the task owner. (Cloned if the task is running.)
        Specified by:
        getOwnerRef in interface Task
      • getCachingProfiles

        @NotNull
        public @NotNull Collection<String> getCachingProfiles()
        Description copied from interface: Task
        Returns an immutable collection of caching profiles. (From execution environment.)
        Specified by:
        getCachingProfiles in interface Task
      • addTracingRequest

        public void addTracingRequest​(TracingRootType point)
        Description copied from interface: Task
        Requests (future) tracing for given tracing point - for this task.
        Specified by:
        addTracingRequest in interface Task
      • removeTracingRequests

        public void removeTracingRequests()
        Description copied from interface: Task
        Removes all tracing requests for this task.
        Specified by:
        removeTracingRequests in interface Task
      • getTracingProfile

        public TracingProfileType getTracingProfile()
        Description copied from interface: Task
        Returns (reference to tracing profile) that was defined for the tracing started by this task. NOT THREAD SAFE!
        Specified by:
        getTracingProfile in interface Task
      • setTracingProfile

        public void setTracingProfile​(TracingProfileType tracingProfile)
        Description copied from interface: Task
        Sets the profile to be used for future tracing within this task.
        Specified by:
        setTracingProfile in interface Task
      • hasAssignments

        public boolean hasAssignments()
        Description copied from interface: Task
        Returns true if the task has any assignments.
        Specified by:
        hasAssignments in interface Task