<?xml version="1.0" encoding="UTF-8" standalone="no"?><!--
  ~ Copyright (c) 2010-2017 Evolveum and contributors
  ~
  ~ Licensed under the EUPL-1.2 or later.
  --><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:a="http://prism.evolveum.com/xml/ns/public/annotation-3" xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xmlns:jaxb="https://jakarta.ee/xml/ns/jaxb" xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3" xmlns:s="http://midpoint.evolveum.com/xml/ns/public/model/scripting-3" xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3" xmlns:tns="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" elementFormDefault="qualified" jaxb:extensionBindingPrefixes="xjc" jaxb:version="3.0" targetNamespace="http://midpoint.evolveum.com/xml/ns/public/common/common-3">

    <xsd:annotation>
        <xsd:documentation>
            Part of common-3 schema that deals with tasks and nodes.
        </xsd:documentation>
    </xsd:annotation>

    <!-- Don't provide schemaLocation here, as it causes xjc to really contact the URIs (!) -->
    <xsd:import namespace="http://prism.evolveum.com/xml/ns/public/annotation-3" schemaLocation="../annotation-3.xsd"/>
    <xsd:import namespace="http://prism.evolveum.com/xml/ns/public/types-3" schemaLocation="../types-3.xsd"/>
    <xsd:import namespace="http://prism.evolveum.com/xml/ns/public/query-3" schemaLocation="../query-3.xsd"/>
    <xsd:import namespace="http://midpoint.evolveum.com/xml/ns/public/model/scripting-3" schemaLocation="../model/scripting/scripting-3.xsd"/>
    <xsd:import namespace="http://midpoint.evolveum.com/xml/ns/public/model/scripting/extension-3" schemaLocation="../model/scripting/extension-3.xsd"/>

    <xsd:include schemaLocation="common-core-3.xsd"/>
    <xsd:include schemaLocation="common-case-management-3.xsd"/>
    <xsd:include schemaLocation="common-model-context-3.xsd"/>

    <xsd:complexType name="TaskType">
        <xsd:annotation>
            <xsd:documentation>
                TaskType contains information about a task (either transient or persistent).
                For background information and clarification of various terms used here, please see
                <a href="https://docs.evolveum.com/midpoint/reference/tasks/task-manager/">Task Manager</a>
                and
                <a href="https://docs.evolveum.com/midpoint/architecture/concepts/task/">Task</a>.
            </xsd:documentation>
            <xsd:appinfo>
                <a:schemaMigration>
                    <a:element>tns:canRunOnNode</a:element>
                    <a:version>4.0</a:version>
                    <a:operation>removed</a:operation>
                </a:schemaMigration>
                <a:schemaMigration>
                    <a:element>tns:otherHandlersUriStack</a:element>
                    <a:version>4.4</a:version>
                    <a:operation>removed</a:operation>
                </a:schemaMigration>
                <a:schemaMigration>
                    <a:element>tns:structuredProgress</a:element>
                    <a:version>4.4</a:version>
                    <a:operation>removed</a:operation>
                </a:schemaMigration>
                <a:schemaMigration>
                    <a:element>tns:workState</a:element>
                    <a:version>4.4</a:version>
                    <a:operation>removed</a:operation>
                </a:schemaMigration>
                <a:schemaMigration>
                    <a:element>tns:executionStatus</a:element>
                    <a:version>4.4</a:version>
                    <a:operation>moved</a:operation>
                    <a:replacement>tns:executionState</a:replacement>
                </a:schemaMigration>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AssignmentHolderType">
                <xsd:sequence>
                    <xsd:element minOccurs="0" name="taskIdentifier" type="xsd:string">
                        <xsd:annotation>
                            <xsd:documentation>
                                <p>
                                    Task (lightweight) identifier. This is a 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.
                                </p>
                                <p>
                                    Task identifier is assigned automatically when the task is created. It is immutable.
                                    It is formally set as optional, however it is mandatory for any task to work. Setting
                                    it to optional allows creating a task without identifier and generating the identifier
                                    during import. However any tasks that live inside midPoint (running or stored in repository)
                                    must have valid task identifier.
                                </p>
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:displayName>TaskType.taskIdentifier</a:displayName>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element maxOccurs="unbounded" minOccurs="0" name="taskRunRecord" type="tns:TaskRunRecordType"/>
                    <xsd:element minOccurs="0" name="ownerRef" type="tns:ObjectReferenceType">
                        <xsd:annotation>
                            <xsd:documentation>
                                The user that owns this task. It usually means the user that started the task
                                or a system user 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. If owner
                                isn't set, currently logged in user is used.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:objectReferenceTargetType>tns:UserType</a:objectReferenceTargetType>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="channel" type="xsd:anyURI"/>
                    <xsd:element minOccurs="0" name="parent" type="xsd:string">
                        <xsd:annotation>
                            <xsd:documentation>
                                <p>
                                    Parent task. This property is used to implement task hierarchies. A task can have
                                    a number of children (subtasks) that carry out some of the work. A typical example
                                    is when multi-node tasks are used: There is a parent task representing the whole operation
                                    (e.g. import from resource), and its children - worker tasks - that acquire buckets
                                    of work and carrying them out. The parent waits for the children to finish and then
                                    finishes itself.
                                </p>
                                <p>
                                    If this property is null, this task is a "root-level" task that has no parent.
                                </p>
                                <p>
                                    Note that the task identifier (not OID) is used here.
                                </p>
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element maxOccurs="unbounded" minOccurs="0" name="subtaskRef" type="c:ObjectReferenceType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Set of task's subtasks references.
                                TRANSIENT attribute. In the repository the parent-child relationship is stored using "parent" property.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:objectReferenceTargetType>tns:TaskType</a:objectReferenceTargetType>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element maxOccurs="unbounded" minOccurs="0" name="dependent" type="xsd:string">
                        <xsd:annotation>
                            <xsd:documentation>
                                Dependent tasks, i.e. tasks that wait for the completion of this task.
                                Task identifiers (not OIDs) are used here.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element maxOccurs="unbounded" minOccurs="0" name="dependentTaskRef" type="c:ObjectReferenceType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Dependent tasks references, i.e. tasks that wait for the completion of this task.
                                TRANSIENT attribute. In the repository only the identifiers are stored (see "dependent" attribute).
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:objectReferenceTargetType>tns:TaskType</a:objectReferenceTargetType>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="executionState" type="tns:TaskExecutionStateType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Provides information about the task overall high-level execution state.
                                It tells whether the task is running/runnable, waits for something or is done.
                                This state is to be displayed to the user.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:displayName>TaskType.executionState</a:displayName>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="schedulingState" type="tns:TaskSchedulingStateType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Scheduling state informs about the state of the task regarding its scheduling.
                                It is generally the same as execution state, but can differ from it e.g. when
                                task trees are involved: When a task tree is executing, the root task is technically
                                waiting for the children (so scheduling state is WAITING) but from the high level point
                                of view it is executing (so execution state is RUNNING).
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:displayName>TaskType.schedulingState</a:displayName>
                                <a:since>4.3</a:since>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="waitingReason" type="tns:TaskWaitingReasonType">
                        <xsd:annotation>
                            <xsd:documentation>
                                If the task is waiting (i.e. schedulingState = WAITING), what is this task waiting for?
                                Must be null if the task is not waiting for anything.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:operational>true</a:operational>
                                <a:displayHint>regular</a:displayHint>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="unpauseAction" type="tns:TaskUnpauseActionType">
                        <xsd:annotation>
                            <xsd:documentation>
                                What to do after task is unpaused (i.e. stopped waiting)?
                                The default for single-run tasks is executeImmediately (mainly for backwards compatibility
                                reasons); the default for recurring tasks is reschedule. It is expected that this item is
                                set by the code that puts the task into waiting state.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:since>3.8</a:since>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="stateBeforeSuspend" type="tns:TaskExecutionStateType">
                        <xsd:annotation>
                            <xsd:documentation>
                                What was the task execution state before it was suspended?
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:since>3.8</a:since>
                                <a:operational>true</a:operational>
                                <a:displayHint>regular</a:displayHint>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="schedulingStateBeforeSuspend" type="tns:TaskSchedulingStateType">
                        <xsd:annotation>
                            <xsd:documentation>
                                What was the task scheduling state before it was suspended? It could be either runnable or waiting.
                                This is important because we want to restore the correct state on resume.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:since>4.3</a:since>
                                <a:operational>true</a:operational>
                                <a:displayHint>regular</a:displayHint>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="node" type="xsd:string">
                        <xsd:annotation>
                            <xsd:documentation>
                                Identifier of the node that currently executes this task.
                                (In case of node crash, the value here may be out-of-date.)
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:operational>true</a:operational>
                                <a:displayHint>regular</a:displayHint>
                                <xsd:appinfo>
                                    <a:displayName>TaskType.node</a:displayName>
                                </xsd:appinfo>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="nodeAsObserved" type="xsd:string">
                        <xsd:annotation>
                            <xsd:documentation>
                                Identifier of the node that executes this task, as observed by querying cluster nodes
                                about tasks that are currently executing.
                                TRANSIENT. This value is not stored in the repository.
                                (It is currently not possible to use it for filtering or sorting.)
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:displayName>TaskType.nodeAsObserved</a:displayName>
                                <a:operational>true</a:operational>
                                <a:displayHint>regular</a:displayHint>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="category" type="xsd:string">
                        <xsd:annotation>
                            <xsd:documentation>
                                Kind of the task, e.g. live sync, reconciliation, workflow, import from resource.
                                Used mainly for the GUI.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:displayName>TaskType.category</a:displayName>
                                <a:removed>true</a:removed>
                                <a:removedSince>4.8</a:removedSince>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="handlerUri" type="xsd:anyURI">
                        <xsd:annotation>
                            <xsd:documentation>
                                Handler URI 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.

                                Note that activity-based tasks do not need a handler URI. They are executed under
                                the activity-based task handler.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="result" type="tns:OperationResultType">
                        <xsd:annotation>
                            <xsd:documentation>
                                OperationResult that is used to compile task results (parent result).
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:operational>true</a:operational>
                                <a:displayHint>regular</a:displayHint>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="resultStatus" type="tns:OperationResultStatusType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Top-level state of the 'result' (OperationResultType).
                                It is put here for ease of use - mainly filtering, displaying, and so on.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:displayName>TaskType.resultStatus</a:displayName>
                                <a:operational>true</a:operational>
                                <a:displayHint>regular</a:displayHint>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="objectRef" type="tns:ObjectReferenceType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Object that the task is associated with. Tasks may be associated with a particular
                                objects. This item is either filled-in by the client (when using pre-4.4 configuration),
                                or it is filled-in automatically by the activity handler at the start of the activity run.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:displayName>TaskType.objectRef</a:displayName>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="lastRunStartTimestamp" type="xsd:dateTime">
                        <xsd:annotation>
                            <xsd:documentation>
                                The time when the task run was last started.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:operational>true</a:operational>
                                <a:displayHint>regular</a:displayHint>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="lastRunFinishTimestamp" type="xsd:dateTime">
                        <xsd:annotation>
                            <xsd:documentation>
                                The time when the (last) task run was finished, successfully or unsuccessfully.
                                (If node crashes, this attribute is not updated.)
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:operational>true</a:operational>
                                <a:displayHint>regular</a:displayHint>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="completionTimestamp" type="xsd:dateTime">
                        <xsd:annotation>
                            <xsd:documentation>
                                The moment when the task was marked as closed. (May be different from
                                lastRunFinishTimestamp, e.g. when task waits for its children to finish
                                and then closes automatically.)
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:operational>true</a:operational>
                                <a:displayHint>regular</a:displayHint>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="cleanupAfterCompletion" type="xsd:duration">
                        <xsd:annotation>
                            <xsd:documentation>
                                If set, the task is automatically cleaned up after this time following its completion.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:since>3.7</a:since>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="nextRunStartTimestamp" type="xsd:dateTime">
                        <xsd:annotation>
                            <xsd:documentation>
                                The time when the task should start again, according to the task's defined schedule.
                                (Null if no further run is scheduled.)
                                Ad-hoc (retry) run times, like those stemming from unsatisfied execution constraints, are NOT
                                considered here. They are covered by nextRetryTimestamp property.

                                TRANSIENT. This value is not stored in the repo, it is queried dynamically.
                                (It is currently not possible to use it for filtering or sorting.)
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:operational>true</a:operational>
                                <a:displayHint>regular</a:displayHint>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="nextRetryTimestamp" type="xsd:dateTime">
                        <xsd:annotation>
                            <xsd:documentation>
                                If the start of a task was delayed (typically because of unsatisfied execution constraints),
                                the planned retry time is reported here.

                                TRANSIENT. This value is not stored in the repo, it is queried dynamically.
                                (It is currently not possible to use it for filtering or sorting.)
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:since>3.5</a:since>
                                <a:operational>true</a:operational>
                                <a:displayHint>regular</a:displayHint>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="progress" type="xsd:long">
                        <xsd:annotation>
                            <xsd:documentation>
                                Relative metric of task progress. The meaning of this attribute
                                is specific to particular task handler. Mostly obsoleted by the activity framework.
                                The progress is now stored in .../activityState/progress/committed and uncommitted.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:displayName>TaskType.progress</a:displayName>
                                <a:operational>true</a:operational>
                                <a:displayHint>regular</a:displayHint>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="operationStats" type="tns:OperationStatsType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Task-level operation statistics.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:operational>true</a:operational>
                                <a:displayHint>regular</a:displayHint>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="stalledSince" type="xsd:dateTime">
                        <xsd:annotation>
                            <xsd:documentation>
                                From which moment is this task stalled (if applicable)?
                                TRANSIENT. This value is not stored in the repo, it is queried dynamically.
                                (It is currently not possible to use it for filtering or sorting.)
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:operational>true</a:operational>
                                <a:displayHint>regular</a:displayHint>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="expectedTotal" type="xsd:long">
                        <xsd:annotation>
                            <xsd:documentation>
                                Expected target (goal) value of task progress. Perceived progress
                                is computed as a ratio of progress/expectedTotal. May be null; in that
                                case we just do not know how much progress we should expect.

                                DEPRECATED. This property is not used by standard (activity-based) tasks.
                                It will be eventually removed, after all tasks are migrated to activities.

                                For activity-based tasks, it is replaced by .../activityState/progress/expectedInCurrentBucket
                                and - if requested - .../activityState/progress/expectedTotal.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:deprecated>true</a:deprecated>
                                <a:deprecatedSince>4.4</a:deprecatedSince>
                                <a:operational>true</a:operational>
                                <a:displayHint>regular</a:displayHint>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="recurrence" type="tns:TaskRecurrenceType">
                        <xsd:annotation>
                            <xsd:documentation>
                                DEPRECATED. Moved to schedule/recurrence and made optional.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:removed>true</a:removed>
                                <a:deprecatedSince>4.4</a:deprecatedSince>
                                <a:removedSince>4.8</a:removedSince>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="binding" type="tns:TaskBindingType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Whether a recurring task is bound tightly to one node (having allocated
                                a thread on this node for the whole time of task run) or it should
                                by dynamically placed on any suitable node when its run time comes.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="executionConstraints" type="tns:TaskExecutionConstraintsType">
                        <xsd:annotation>
                            <xsd:documentation>
                                <p>
                                    Constraints on task execution, e.g. a execution group, allowed/disallowed nodes, etc.
                                </p>
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:since>3.5</a:since>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="executionEnvironment" type="tns:TaskExecutionEnvironmentType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Specification of the environment in which the task should execute.
                                An example is caching profile that should be used.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:experimental>true</a:experimental>
                                <a:since>4.0</a:since>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="schedule" type="tns:ScheduleType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Task schedule. Specifies when and how often to execute the task.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="threadStopAction" type="tns:ThreadStopActionType">
                        <xsd:annotation>
                            <xsd:documentation>
                                What is to be done when the thread allocated to this task stops
                                (e.g. via node shutdown or node crash).
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="modelOperationContext" type="tns:LensContextType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Model context of the operation that is to be executed within this task.
                                This is NOT a live information: it is a serialized form of a model context.
                                Currently there is a specialized task handler that takes this context,
                                unmarshalls and executes it.

                                Note: This item will be moved to an activity definition in the future.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:removed>true</a:removed>
                                <a:deprecatedSince>4.4</a:deprecatedSince>
                                <a:removedSince>4.8</a:removedSince>
                                <a:operational>true</a:operational>
                                <a:displayHint>regular</a:displayHint>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="policyRule" type="tns:PolicyRuleType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Policy rule for the task. E.g notify user 5 days before their account expires.

                                DEPRECATED. Moved to the FocusValidityScanWorkDefinitionType.validityConstraint.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:removed>true</a:removed>
                                <a:deprecatedSince>4.4</a:deprecatedSince>
                                <a:removedSince>4.8</a:removedSince>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="errorHandlingStrategy" type="tns:ActivityErrorHandlingStrategyType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Error handling strategy for this task. EXPERIMENTAL.
                                DEPRECATED. Set error handling strategy in activity instead.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:experimental>true</a:experimental>
                                <a:since>4.3</a:since>
                                <a:removed>true</a:removed>
                                <a:deprecatedSince>4.4</a:deprecatedSince>
                                <a:removedSince>4.8</a:removedSince>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="autoScaling" type="tns:TaskAutoScalingType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Auto-scaling related options.

                                Eventually, this item will be marked as operational and filled-in dynamically based
                                on information in activities.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:experimental>true</a:experimental>
                                <a:since>4.4</a:since>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <!-- This is just an idea for the future. -->
                    <!--<xsd:element name="preActivity" type="tns:ActivityDefinitionType" minOccurs="0" maxOccurs="unbounded">-->
                    <!--    <xsd:annotation>-->
                    <!--        <xsd:documentation>-->
                    <!--            Definition of an activity or activities that should be executed before the main task activity.-->
                    <!--            Not implemented yet.-->
                    <!--        </xsd:documentation>-->
                    <!--        <xsd:appinfo>-->
                    <!--            <a:since>4.4</a:since>-->
                    <!--            <a:experimental>true</a:experimental>-->
                    <!--        </xsd:appinfo>-->
                    <!--    </xsd:annotation>-->
                    <!--</xsd:element>-->
                    <xsd:element minOccurs="0" name="activity" type="tns:ActivityDefinitionType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Definition of the main activity that should be executed within this task.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:since>4.4</a:since>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <!-- This is just an idea for the future. -->
                    <!--<xsd:element name="postActivity" type="tns:ActivityDefinitionType" minOccurs="0" maxOccurs="unbounded">-->
                    <!--    <xsd:annotation>-->
                    <!--        <xsd:documentation>-->
                    <!--            Definition of an activity or activities that should be executed after the main task activity.-->
                    <!--            Not implemented yet.-->
                    <!--        </xsd:documentation>-->
                    <!--        <xsd:appinfo>-->
                    <!--            <a:since>4.4</a:since>-->
                    <!--            <a:experimental>true</a:experimental>-->
                    <!--        </xsd:appinfo>-->
                    <!--    </xsd:annotation>-->
                    <!--</xsd:element>-->
                    <xsd:element minOccurs="0" name="activityState" type="tns:TaskActivityStateType">
                        <xsd:annotation>
                            <xsd:documentation>
                                State of the activity or activities embedded in the task.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:since>3.8</a:since>
                                <a:operational>true</a:operational>
                                <a:displayHint>regular</a:displayHint>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="affectedObjects" type="tns:TaskAffectedObjectsType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Searchable set of object set coordinates (e.g., resource + kind + intent for resource objects,
                                or type + archetype for repository objects) for objects which are directly affected
                                by the execution of this task. Includes information about execution mode.

                                NOTE: This data are only for task indexing and searching purposes derived from activity definitions.
                                This data are not canonical and for some edge-cases they may not be computed.

                                Please never change this information directly, except for in raw mode. It is maintained
                                by the system automatically, so the result will be unpredictable if you do.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:since>4.8</a:since>
                                <a:operational>true</a:operational>
                                <a:displayHint>regular</a:displayHint>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="task" substitutionGroup="c:object" type="tns:TaskType"/>

    <xsd:complexType name="TaskRunRecordType">
        <xsd:annotation>
            <xsd:documentation>
                Information about a single task run.
                Contains just task run identifier, start and end timestamps.

                Can be used to search for operation executions created by this task during different runs.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.10</a:since>
                <a:container>true</a:container>
                <a:operational>true</a:operational>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element name="taskRunIdentifier" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        Identifier that represents single execution of the task.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element name="runStartTimestamp" type="xsd:dateTime">
                <xsd:annotation>
                    <xsd:documentation>
                        The time when the task run was started.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="runEndTimestamp" type="xsd:dateTime">
                <xsd:annotation>
                    <xsd:documentation>
                        The time when the task run was finished, successfully or unsuccessfully.
                        (If node crashes, this attribute is not updated.)
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>
    <xsd:element name="taskRunRecord" type="tns:TaskRunRecordType"/>

    <xsd:complexType name="TaskExecutionEnvironmentType">
        <xsd:annotation>
            <xsd:documentation>
                Specification of the environment in which the task should execute.
                An example is caching profile that should be used.
                EXPERIMENTAL.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.0</a:since>
                <a:experimental>true</a:experimental>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="cachingProfile" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        Caching profile(s) that are to be applied to this task.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="operationResultHandlingStrategy" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        Operation result handling strategy that is to be applied to this task.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>

    <xsd:complexType name="TaskExecutionConstraintsType">
        <xsd:annotation>
            <xsd:documentation>
                Constraints on task execution, e.g. a execution group, allowed/disallowed nodes, etc.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>3.5</a:since>
                <a:container>true</a:container>
                <a:schemaMigration>
                    <a:element>tns:allowedNode</a:element>
                    <a:version>4.0</a:version>
                    <a:operation>removed</a:operation>
                </a:schemaMigration>
                <a:schemaMigration>
                    <a:element>tns:disallowedNode</a:element>
                    <a:version>4.0</a:version>
                    <a:operation>removed</a:operation>
                </a:schemaMigration>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="group" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        A group this task is a part of. In the future, task execution groups will probably have more
                        complex parameters. But for now, their only parameter is the (cluster-wide) member tasks limit.
                        They are also referenced from NodeType when specifying execution limitations for them.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:displayName>TaskExecutionConstraintsType.group</a:displayName>
                        <a:displayOrder>100</a:displayOrder>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="groupTaskLimit" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        Number of tasks within the group that can be executed at once (cluster-wide). Default is "unlimited".
                        This parameter will be moved into separate task group object in a later version of midPoint.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:displayName>TaskExecutionConstraintsType.groupTaskLimit</a:displayName>
                        <a:displayOrder>110</a:displayOrder>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="secondaryGroup" type="tns:TaskExecutionGroupConstraintType">
                <xsd:annotation>
                    <xsd:documentation>
                        Other limitations for the task.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:displayName>TaskExecutionConstraintsType.secondaryGroup</a:displayName>
                        <a:displayOrder>120</a:displayOrder>
                        <a:since>3.7.1</a:since>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="retryAfter" type="xsd:duration">
                <xsd:annotation>
                    <xsd:documentation>
                        In what time to retry after cluster-wide execution constraints are not met. The default is 1 minute.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:displayName>TaskExecutionConstraintsType.retryAfter</a:displayName>
                        <a:displayOrder>130</a:displayOrder>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>

    <xsd:complexType name="TaskExecutionGroupConstraintType">  <!-- TODO type name -->
        <xsd:annotation>
            <xsd:documentation>
                TODO
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>3.7</a:since>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element name="group" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        TODO
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:displayName>TaskExecutionGroupConstraintType.group</a:displayName>
                        <a:displayOrder>100</a:displayOrder>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="groupTaskLimit" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        Number of tasks within the group that can be executed at once (cluster-wide). Default is "unlimited".
                        This parameter will be moved into separate task group object in a later version of midPoint.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:displayName>TaskExecutionGroupConstraintType.groupTaskLimit</a:displayName>
                        <a:displayOrder>110</a:displayOrder>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>

    <xsd:complexType name="ActivityProgressType">
        <xsd:annotation>
            <xsd:documentation>
                Progress of an activity.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.3</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="committed" type="tns:OutcomeKeyedCounterType">
                <xsd:annotation>
                    <xsd:documentation>
                        Counters representing items that were processed and will not be processed again even if the activity
                        is re-run, e.g. because they are stored in completed buckets. (Or because the live sync token was
                        updated.)
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="uncommitted" type="tns:OutcomeKeyedCounterType">
                <xsd:annotation>
                    <xsd:documentation>
                        Counters representing items that were processed but they may be processed again if the activity is
                        re-run, e.g. their bucket is not completed yet. (Or because the live sync token was not yet updated.)
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="expectedTotal" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        Expected total progress for this activity (comprising all buckets, if the activity is bucketed).
                        May or may not be known. Currently only very experimental. (Must be explicitly turned on,
                        and not supported for worker tasks.)
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="expectedInCurrentBucket" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        Expected progress (i.e. number of items) in the current bucket.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>
    <xsd:element name="activityProgress" type="tns:ActivityProgressType"/>

    <!-- If needed, please create subtypes of this for particular uses. -->
    <xsd:complexType name="OutcomeKeyedCounterType">
        <xsd:annotation>
            <xsd:documentation>
                Counter keyed by a qualified outcome. Used e.g. for structured progress or synchronization situation transitions.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.3</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="outcome" type="tns:QualifiedItemProcessingOutcomeType">
                <xsd:annotation>
                    <xsd:documentation>
                        Outcome of the processing (success, failure, skip) + optional qualification.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="count" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        Count of items/situations/whatever for given qualified outcome.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>
    <xsd:element name="outcomeKeyedCounter" type="tns:OutcomeKeyedCounterType"/>

    <xsd:complexType name="OperationStatsType">
        <xsd:annotation>
            <xsd:documentation>
                Operation execution statistics/state. Contains various statistical and state information about execution
                of the operation or operations that are carried out in the scope of the task.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:schemaMigration>
                    <a:element>tns:iterationInformation</a:element>
                    <a:version>4.4</a:version>
                    <a:operation>removed</a:operation>
                </a:schemaMigration>
                <a:schemaMigration>
                    <a:element>tns:iterativeTaskInformation</a:element>
                    <a:version>4.4</a:version>
                    <a:operation>removed</a:operation>
                </a:schemaMigration>
                <a:schemaMigration>
                    <a:element>tns:synchronizationInformation</a:element>
                    <a:version>4.4</a:version>
                    <a:operation>removed</a:operation>
                </a:schemaMigration>
                <a:schemaMigration>
                    <a:element>tns:actionsExecutedInformation</a:element>
                    <a:version>4.4</a:version>
                    <a:operation>removed</a:operation>
                </a:schemaMigration>
                <a:schemaMigration>
                    <a:element>tns:workBucketManagementPerformanceInformation</a:element>
                    <a:version>4.4</a:version>
                    <a:operation>removed</a:operation>
                </a:schemaMigration>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="environmentalPerformanceInformation" type="tns:EnvironmentalPerformanceInformationType"/>
            <xsd:element minOccurs="0" name="repositoryPerformanceInformation" type="tns:RepositoryPerformanceInformationType">
                <xsd:annotation>
                    <xsd:appinfo>
                        <a:since>4.0</a:since>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="cachesPerformanceInformation" type="tns:CachesPerformanceInformationType">
                <xsd:annotation>
                    <xsd:appinfo>
                        <a:since>4.0</a:since>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="operationsPerformanceInformation" type="tns:OperationsPerformanceInformationType">
                <xsd:annotation>
                    <xsd:appinfo>
                        <a:since>4.0</a:since>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="cachingConfiguration" type="xsd:string">
                <xsd:annotation>
                    <xsd:appinfo>
                        <a:since>4.0</a:since>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="timestamp" type="xsd:dateTime">
                <xsd:annotation>
                    <xsd:documentation>
                        When this information was collected from the "living" task.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="liveInformation" type="xsd:boolean">
                <xsd:annotation>
                    <xsd:documentation>
                        Source of the information - is it from repository or directly from the "living" task?
                        TRANSIENT INFORMATION, not stored in the repository. Filled in by task manager when fetching the task.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>
    <xsd:element name="operationStats" type="tns:OperationStatsType"/>

    <xsd:complexType name="ActivityStatisticsType">
        <xsd:annotation>
            <xsd:documentation>
                Statistical information for individual activities.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="identifier" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        Identifier of the activity to which this information is related.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="itemProcessing" type="tns:ActivityItemProcessingStatisticsType"/>
            <xsd:element minOccurs="0" name="synchronization" type="tns:ActivitySynchronizationStatisticsType"/>
            <xsd:element minOccurs="0" name="actionsExecuted" type="tns:ActivityActionsExecutedType"/>
            <xsd:element minOccurs="0" name="bucketManagement" type="tns:ActivityBucketManagementStatisticsType"/>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="activity" type="tns:ActivityStatisticsType">
                <xsd:annotation>
                    <xsd:documentation>
                        Statistics for child activities.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>
    <xsd:element name="activityStatistics" type="tns:ActivityStatisticsType"/>

    <xsd:complexType name="RepositoryPerformanceInformationType">
        <xsd:annotation>
            <xsd:documentation>
                Information about repository performance.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.0</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="operation" type="tns:RepositoryOperationPerformanceInformationType"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="RepositoryOperationPerformanceInformationType">
        <xsd:annotation>
            <xsd:documentation>
                Information about single repository operation kind (e.g. getObject) performance.

                It is strongly related to the internal implementation of the repository, so it may change at any time.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.0</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element name="name" type="xsd:string"/>
            <xsd:element minOccurs="0" name="invocationCount" type="xsd:int"/>
            <xsd:element minOccurs="0" name="executionCount" type="xsd:int"/>
            <xsd:element minOccurs="0" name="totalTime" type="xsd:long"/>
            <xsd:element minOccurs="0" name="minTime" type="xsd:long"/>
            <xsd:element minOccurs="0" name="maxTime" type="xsd:long"/>
            <xsd:element minOccurs="0" name="totalWastedTime" type="xsd:long"/>
            <xsd:element minOccurs="0" name="minWastedTime" type="xsd:long"/>
            <xsd:element minOccurs="0" name="maxWastedTime" type="xsd:long"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="OperationsPerformanceInformationType">
        <xsd:annotation>
            <xsd:documentation>
                Information about methods performance.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.0</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="operation" type="tns:SingleOperationPerformanceInformationType"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="SingleOperationPerformanceInformationType">
        <xsd:annotation>
            <xsd:documentation>
                Information about single method performance.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.0</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element name="name" type="xsd:string"/>
            <xsd:element minOccurs="0" name="invocationCount" type="xsd:int"/>
            <xsd:element minOccurs="0" name="totalTime" type="xsd:long"/>
            <xsd:element minOccurs="0" name="minTime" type="xsd:long"/>
            <xsd:element minOccurs="0" name="maxTime" type="xsd:long"/>
            <xsd:element minOccurs="0" name="ownTime" type="xsd:long"/>
            <xsd:element minOccurs="0" name="minOwnTime" type="xsd:long"/>
            <xsd:element minOccurs="0" name="maxOwnTime" type="xsd:long"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="ComponentsPerformanceInformationType">
        <xsd:annotation>
            <xsd:documentation>
                Information about the time spent in individual components.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.10</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="component" type="tns:SingleComponentPerformanceInformationType"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="SingleComponentPerformanceInformationType">
        <xsd:annotation>
            <xsd:documentation>
                Information about the time spent in a single component.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.10</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element name="name" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        The component name (or other identification). The content depends on the component classification used.
                        For example, we may be interested in coarse-grained components (model, provisioning, repository), or
                        finer-grained ones (model-mappings, model-scripts, model-assignments, and so on).
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="invocationCount" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        Number of invocations of methods in this component.
                        May not be very informative, as there are potentially very heterogeneous methods in the component,
                        and some of them are called from within the component itself; but it provides at least some indication
                        about the volume of calls.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="totalTime" type="xsd:long">
                <xsd:annotation>
                    <xsd:documentation>
                        Time spent in the component - in microseconds.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="ActivityBucketManagementStatisticsType">
        <xsd:annotation>
            <xsd:documentation>
                Information about bucket management operations performance within an activity.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.0</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="operation" type="tns:BucketManagementOperationStatisticsType"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="BucketManagementOperationStatisticsType">
        <xsd:annotation>
            <xsd:documentation>
                Information about specific kind of work bucket management operation performance.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.0</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="name" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        Name of the operation, possibly qualified by the result kind.
                        E.g. completeWorkBucket, getWorkBucket.createdNew, getWorkBucket.noMoreBucketsDefinite,
                        getWorkBucket.InterruptedException.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="count" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        Number of times this operation (optionally with the specified result) was invoked.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="totalTime" type="xsd:long">
                <xsd:annotation>
                    <xsd:documentation>
                        Total time spent in these operations.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="minTime" type="xsd:long"/>
            <xsd:element minOccurs="0" name="maxTime" type="xsd:long"/>
            <xsd:element minOccurs="0" name="conflictCount" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        Number of times a conflict occurred. Only write-write conflicts consisting of two tasks trying
                        to overwrite each other's data (detected by precondition violations) are counted here; DBMS-detected
                        transaction aborts are counted in repository-level statistics.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="totalWastedTime" type="xsd:long">
                <xsd:annotation>
                    <xsd:documentation>
                        Total time wasted by retrying operations because of write-write conflicts.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="minWastedTime" type="xsd:long"/>
            <xsd:element minOccurs="0" name="maxWastedTime" type="xsd:long"/>
            <xsd:element minOccurs="0" name="bucketWaitCount" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        Number of times a wait-state was entered because of no free bucket could be obtained but some buckets
                        are still not done. (This occurs only in scavengers.)
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="bucketsReclaimed" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        Number of buckets reclaimed from dead (closed or missing) workers. Under normal circumstances
                        this number should be zero.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="totalWaitTime" type="xsd:long">
                <xsd:annotation>
                    <xsd:documentation>
                        Total time spent by waiting for buckets to be processed or reclaimed.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="minWaitTime" type="xsd:long"/>
            <xsd:element minOccurs="0" name="maxWaitTime" type="xsd:long"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="CachesPerformanceInformationType">
        <xsd:annotation>
            <xsd:documentation>
                Information about performance of various caches present in midPoint.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.0</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="cache" type="tns:SingleCachePerformanceInformationType"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="SingleCachePerformanceInformationType">
        <xsd:annotation>
            <xsd:documentation>
                Information about performance of a given (single) cache.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.0</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element name="name" type="xsd:string"/>
            <xsd:element minOccurs="0" name="hitCount" type="xsd:int"/>
            <xsd:element minOccurs="0" name="weakHitCount" type="xsd:int"/>
            <xsd:element minOccurs="0" name="missCount" type="xsd:int"/>
            <xsd:element minOccurs="0" name="passCount" type="xsd:int"/>
            <xsd:element minOccurs="0" name="notAvailableCount" type="xsd:int"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:simpleType name="TaskExecutionStateType">
        <xsd:annotation>
            <xsd:documentation>
                Execution state provides information about the task overall high-level execution state. It tells
                whether the task is running, runnable, suspended, waits for something or is done.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="running">
                <xsd:annotation>
                    <xsd:documentation>
                        The task is running.

                        If this is a child-less task, it means that there is a thread on one of the nodes
                        that executes this task. (An exception is when a node crashes. Then previously running
                        tasks are left in "running" state - until the state is updated by some of the remaining nodes.)

                        For tasks with children, the RUNNING state means that either this task is executing in a thread,
                        or any of its children (transitively) is running. This is to ensure that user sees the task states
                        consistently.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="RUNNING"/>
                        <a:since>4.3</a:since>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="runnable">
                <xsd:annotation>
                    <xsd:documentation>
                        The task is ready to be executed by the scheduler. It just waits either for the defined time to come,
                        or for available thread or node to execute the task.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="RUNNABLE"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="waiting">
                <xsd:annotation>
                    <xsd:documentation>
                        The task is waiting, typically for some other task. Note that this DOES NOT cover parent tasks waiting
                        for their running children. Such parents are in RUNNING state as well. Also, if all children are suspended,
                        then the parent is suspended as well.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="WAITING"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="suspended">
                <xsd:annotation>
                    <xsd:documentation>
                        The task has been suspended. It waits until resumed.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="SUSPENDED"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="closed">
                <xsd:annotation>
                    <xsd:documentation>
                        The task is done. No other changes or progress will happen. The task in this state is considered
                        immutable and the only things that can happen to it is a delete by a cleanup code.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="CLOSED"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="TaskSchedulingStateType">
        <xsd:annotation>
            <xsd:documentation>
                Scheduling state informs about the state of the task regarding its scheduling.
                It is generally related to the execution state, but can differ.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="ready">
                <xsd:annotation>
                    <xsd:documentation>
                        The task is running or is ready to run. Being ready means that it waits only for the scheduler
                        to start it: e.g. when the scheduled time comes, or when a thread becomes available, and so on.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="READY"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="waiting">
                <xsd:annotation>
                    <xsd:documentation>
                        Something prevents the task from execution. Typically it is dependent on other task(s)
                        so it must wait for their completion before it becomes runnable.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="WAITING"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="suspended">
                <xsd:annotation>
                    <xsd:documentation>
                        The task has been suspended. It waits until resumed (usually by system administrator).
                        After resume it goes to specified state - see stateBeforeSuspend property.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="SUSPENDED"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="closed">
                <xsd:annotation>
                    <xsd:documentation>
                        The task is done. It is not going to be scheduled again. (Unless it is revived
                        by system administrator.)
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="CLOSED"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="TaskRecurrenceType">
        <xsd:annotation>
            <xsd:documentation>
                Whether the task activity is to be executed only once (single-run tasks)
                or periodically (recurring tasks).
            </xsd:documentation>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="single">
                <xsd:annotation>
                    <xsd:documentation>
                        The task is executed only once, at the first moment that the schedule
                        specifies. If that moment is in the past, the task will be executed as
                        soon as any execution environment (node) is available.
                        Once the task is finished, it will not be executed again.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="SINGLE"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="recurring">
                <xsd:annotation>
                    <xsd:documentation>
                        The task is executed as many times as the schedule specifies.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="RECURRING"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="TaskBindingType">
        <xsd:annotation>
            <xsd:documentation>
                Whether a recurring task is bound tightly to one node (having allocated
                a thread on this node for the whole time of task run) or it should
                by dynamically placed on any suitable node when its execution time comes.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="loose">
                <xsd:annotation>
                    <xsd:documentation>
                        The task is exclusively assigned to a specific node only during its run.

                        The thread is allocated only for the minimal amount of time.

                        It does not matter which node will execute the task as long as there is an appropriate handler.

                        This is efficient for tasks that take long time to execute and the execution mostly waits
                        (e.g. approvals) or for tasks which have long interval between executions (e.g. reconciliation).
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="LOOSE"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="tight">
                <xsd:annotation>
                    <xsd:documentation>
                        Task is exclusively assigned to a specific node from its start to its finish.

                        A thread will be running and allocated for the task all the time.
                        The thread may go to sleep as needed, but during that time the task remains assigned
                        to the node.

                        This is efficient for recurring tasks executed in short intervals, such as live synchronization.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="TIGHT"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="TaskWaitingReasonType">
        <xsd:annotation>
            <xsd:documentation>
                Why is the task in the waiting state?
            </xsd:documentation>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="otherTasks">
                <xsd:annotation>
                    <xsd:documentation>
                        The task is waiting for other (dependent) tasks - either its subtasks, or tasks explicitly marked
                        as "prerequisites" for this task (via dependentTask property)
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="OTHER_TASKS"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="other">
                <xsd:annotation>
                    <xsd:documentation>
                        The task is waiting because of other reason.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="OTHER"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="TaskUnpauseActionType">
        <xsd:annotation>
            <xsd:documentation>
                What to do after task is unpaused (i.e. stopped waiting)?
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>3.8</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="executeImmediately">
                <xsd:annotation>
                    <xsd:documentation>
                        Execute current handler immediately (if there is any). This is the default for single-run tasks.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="EXECUTE_IMMEDIATELY"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="reschedule">
                <xsd:annotation>
                    <xsd:documentation>
                        Execute current handler (if there is any) on next scheduled time. This is the default for recurring tasks.
                        For single-run tasks this means the task is closed, as there is no next scheduled time.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="RESCHEDULE"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="close">
                <xsd:annotation>
                    <xsd:documentation>
                        The task will be closed.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="CLOSE"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="ThreadStopActionType">
        <xsd:annotation>
            <xsd:documentation>
                What is to be done when the thread allocated to this task stops
                (e.g. via node shutdown or node crash).
            </xsd:documentation>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="restart">
                <xsd:annotation>
                    <xsd:documentation>
                        The task will be restarted on first node available
                        (i.e. either immediately, if there is a suitable node in the cluster,
                        or later, when a suitable node becomes available).
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="RESTART"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="reschedule">
                <xsd:annotation>
                    <xsd:documentation>
                        The task will be rescheduled according to its schedule
                        (for single-run tasks this is the same as 'restart').
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="RESCHEDULE"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="suspend">
                <xsd:annotation>
                    <xsd:documentation>
                        The task will be suspended.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="SUSPEND"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="close">
                <xsd:annotation>
                    <xsd:documentation>
                        The task will be closed.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="CLOSE"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="MisfireActionType">
        <xsd:annotation>
            <xsd:documentation>
                What is to be done when the planned start time arrives without
                the task actually starting.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="executeImmediately">
                <xsd:annotation>
                    <xsd:documentation>
                        The task will be executed immediately.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="EXECUTE_IMMEDIATELY"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="reschedule">
                <xsd:annotation>
                    <xsd:documentation>
                        The task will be rescheduled according to its schedule.
                        This is to be used only for loosely-bound recurring tasks.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="RESCHEDULE"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:complexType name="ScheduleType">
        <xsd:annotation>
            <xsd:documentation>
                Task schedule. Specifies when and how often something should happen.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="recurrence" type="tns:TaskRecurrenceType">
                <xsd:annotation>
                    <xsd:documentation>
                        Whether the task activity is to be executed only once (single-run tasks)
                        or periodically (recurring tasks). Default value is "recurring" for tasks that have
                        interval or cronLikePattern set, and "single" otherwise. However, there may be tasks
                        with explicitly set recurrence=recurring, with neither interval or cronLikePattern set.
                        Such tasks are to be started manually.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="earliestStartTime" type="xsd:dateTime">
                <xsd:annotation>
                    <xsd:documentation>
                        Earliest time when the task is allowed to start.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:displayOrder>200</a:displayOrder>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="latestStartTime" type="xsd:dateTime">
                <xsd:annotation>
                    <xsd:documentation>
                        Latest time when the task is allowed to start.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:displayOrder>210</a:displayOrder>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="latestFinishTime" type="xsd:dateTime">
                <xsd:annotation>
                    <xsd:documentation>
                        Latest time when the task is allowed to run.
                        It is the responsibility of the task handler to finish
                        working when this time arrives.

                        NOTE: This attribute is currently not used; its use is planned.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:displayOrder>220</a:displayOrder>
                        <a:ignore>true</a:ignore>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="interval" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        Interval in seconds between task runs.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:displayOrder>100</a:displayOrder>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="cronLikePattern" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        Cron-like pattern specifying time(s) when the task is to be run.
                        Currently, only loosely-bound recurring tasks can use this feature.

                        See http://www.quartz-scheduler.org/documentation/quartz-2.3.0/tutorials/crontrigger.html.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:displayOrder>110</a:displayOrder>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="misfireAction" type="tns:MisfireActionType">
                <xsd:annotation>
                    <xsd:documentation>
                        What is to be done when the planned start time arrives without
                        the task actually starting.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:displayOrder>300</a:displayOrder>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>

    <xsd:complexType name="WorkersDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                How to create and manage worker tasks.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>3.8</a:since>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="taskName" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        How to derive names for worker tasks. It is possible to use substitution strings of {coordinatorTaskName},
                        {node} and {index} here. CoordinatorTaskName is the name of the coordinator task, node is the node
                        identifier and index numbers workers created for particular node, starting at 1. The default value is
                        "{coordinatorTaskName} ({node}:{index})".
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="otherDeltas" type="t:ItemDeltaType">
                <xsd:annotation>
                    <xsd:documentation>
                        Other deltas to be applied to newly created worker task.

                        BEWARE! These are applied only to newly created tasks. During further workers reconciliation
                        runs they are ignored.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="workersPerNode" type="tns:WorkersPerNodeDefinitionType">
                <xsd:annotation>
                    <xsd:documentation>
                        How many tasks to create?
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>

    <xsd:complexType name="WorkersPerNodeDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                How to create worker tasks per node.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>3.8</a:since>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="nodeIdentifier" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        Node identifier(s) for which we are going to generate the tasks.
                        Empty list means all nodes that are currently defined in the repository.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="count" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        How many workers to create for given node(s). Default is 1 per node.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="scavengers" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        How many scavengers to appoint for given node(s). Default is 1 per node.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element default="Worker {node}:{index} for {activity} in {rootTaskName}" minOccurs="0" name="taskName" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        How to derive names for the tasks. It is possible to use substitution strings of {node} (identifier of
                        the node executing the worker task), {index} (number of worker at particular node, starting at 1),
                        {activity} (name of the activity), {rootTaskName} (name of the root task), {rootTaskOid} (OID of the
                        root task), {coordinatorTaskName} (name of the coordinator task), {coordinatorTaskOid} (OID of the
                        coordinator task).
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="executionGroup" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        Execution group for created workers. It is possible to use substitution strings of {node} and {index}
                        here. Node is the node identifier and index numbers workers created for particular node, starting at 1.
                        Default is "{node}".
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="otherDeltas" type="t:ItemDeltaType">
                <xsd:annotation>
                    <xsd:documentation>
                        Other deltas to be applied to newly created worker task in this group.

                        BEWARE! These are applied only to newly created tasks. During further workers reconciliation
                        runs they are ignored.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>

    <xsd:complexType name="ActivityDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Describes an activity, i.e. something that has to be carried out within a task.
                It can be either simple (i.e. single action executed on a set of objects) or complex,
                i.e. a sequence of sub-activities.

                Note that in 4.4 midPoint supports only a plain list of activities. This means that a root activity
                can have sub-activities, but none of these can have any.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.4</a:since>
                <a:container>true</a:container>
                <a:elaborate>true</a:elaborate>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="order" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        Relative order of this activity in a list. Relevant for sequential execution of activities
                        (which is the default mode of execution). Activities without order are executed last.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="identifier" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        Identifier of this activity. If omitted, a reasonable default is generated.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:choice>
                <xsd:element minOccurs="0" name="work" type="tns:WorkDefinitionsType">
                    <xsd:annotation>
                        <xsd:documentation>
                            Describes the work that has to be done within this activity, e.g. recomputation, reconciliation,
                            scripting expression execution, and so on. This contains also the necessary parameters,
                            like resource reference, object class, object query, etc.
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="composition" type="tns:ActivityCompositionType">
                    <xsd:annotation>
                        <xsd:documentation>
                            The current activity cannot be described by simple work specification.
                            It is instead a composition of smaller, completely specified activities.
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
            </xsd:choice>
            <xsd:element minOccurs="0" name="executionMode" type="tns:ExecutionModeType">
                <xsd:annotation>
                    <xsd:documentation>
                        Execution mode for this activity: full, preview, dryRun, none, bucketAnalysis.
                        Deprecated. Please use execution/mode instead.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:deprecated>true</a:deprecated>
                        <a:deprecatedSince>4.7</a:deprecatedSince>
                        <a:plannedRemoval>5.0</a:plannedRemoval>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="execution" type="tns:ActivityExecutionModeDefinitionType">
                <xsd:annotation>
                    <xsd:documentation>
                        Detailed definition of the execution mode.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:since>4.7</a:since>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="controlFlow" type="tns:ActivityControlFlowDefinitionType">
                <xsd:annotation>
                    <xsd:documentation>
                        Items like prerequisites, preconditions, error handling strategy, and so on.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="distribution" type="tns:ActivityDistributionDefinitionType">
                <xsd:annotation>
                    <xsd:documentation>
                        Distribution of the work executed as part of this activity.
                        Directly applicable to simple activities. For complex ones it serves as a default value for the children.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="reporting" type="tns:ActivityReportingDefinitionType">
                <xsd:annotation>
                    <xsd:documentation>
                        How various aspects of activity run are reported, using logging, tracing,
                        profiling, reporting, and so on.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="policies" type="tns:ActivityPoliciesType">
                <xsd:annotation>
                    <xsd:documentation>
                        Policies for the activity.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="tailoring" type="tns:ActivitiesTailoringType">
                <xsd:annotation>
                    <xsd:documentation>
                        How should be predefined child activities tailored (i.e. modified)?
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>

    <xsd:complexType name="ActivityPoliciesType">
        <xsd:annotation>
            <xsd:documentation>
                Policies for the activity.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.10</a:since>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="policy" type="tns:ActivityPolicyType"/>
        </xsd:sequence>
    </xsd:complexType>
    <xsd:element name="activityPolicies" type="tns:ActivityPoliciesType"/>

    <xsd:complexType name="ActivityPolicyType">
        <xsd:annotation>
            <xsd:documentation>
                Policy for the activity execution.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.10</a:since>
                <a:container>true</a:container>
                <a:naturalKey>tns:name</a:naturalKey>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element name="name" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        Unique identifier of the policy rule. It's used for diagnostic purposes
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="description" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        Free-form description of the rule (comment).
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element default="true" minOccurs="0" name="enabled" type="xsd:boolean">
                <xsd:annotation>
                    <xsd:documentation>
                        Whether the policy rule is enabled.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" ref="tns:documentation"/>
            <xsd:element minOccurs="0" name="policyConstraints" type="tns:ActivityPolicyConstraintsType"/>
            <xsd:element minOccurs="0" name="policyThreshold" type="tns:PolicyThresholdType"/>
            <xsd:element minOccurs="0" name="policyActions" type="tns:ActivityPolicyActionsType"/>
            <xsd:element minOccurs="0" name="order" type="xsd:int"/>
        </xsd:sequence>
    </xsd:complexType>
    <xsd:element name="activityPolicy" type="tns:ActivityPolicyType"/>

    <xsd:complexType name="ActivityPolicyConstraintsType">
        <xsd:annotation>
            <xsd:documentation>
                Set of governance, risk management, compliance (GRC) and similar policy constraints
                related to tasks. These constraints act as triggers for the rules.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.10</a:since>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractPolicyConstraintType">
                <xsd:sequence>
                    <xsd:element minOccurs="0" name="executionTime" type="tns:DurationThresholdPolicyConstraintType">
                        <xsd:annotation>
                            <xsd:documentation>
                                The execution time constrain evaluates activity execution time.

                                When the exceeds element is specified, constraint will trigger if the task execution
                                time exceeds the specified value. When the below element is specified, constraint will
                                trigger if the task execution time is below the specified value.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="executionAttempts" type="tns:NumericThresholdPolicyConstraintType">
                        <xsd:annotation>
                            <xsd:documentation>
                                This constraint evaluates how many times the activity realization was attempted.

                                When the "exceeds" element is specified, constraint will trigger if the number of attempts
                                exceeds the specified value. When the "below" element is specified, constraint will trigger
                                if the number of attempts is below the specified value.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="itemProcessingResult" type="tns:ItemProcessingResultPolicyConstraintType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Constraint that evaluates result of one item (object) that was processed by activity.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element maxOccurs="unbounded" minOccurs="0" name="and" type="tns:ActivityPolicyConstraintsType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Constraints that must all apply. (But note that if there are more values of this item,
                                they are interpreted according to the enclosing operator.)
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:since>4.10</a:since>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element maxOccurs="unbounded" minOccurs="0" name="or" type="tns:ActivityPolicyConstraintsType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Constraints from which at least one must apply. (But note that if there are more values of this item,
                                they are interpreted according to the enclosing operator.)
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:since>4.10</a:since>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element maxOccurs="unbounded" minOccurs="0" name="not" type="tns:ActivityPolicyConstraintsType">
                        <xsd:annotation>
                            <xsd:documentation>
                                The inner constraint must not apply.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:since>4.10</a:since>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="activityPolicyConstraints" type="tns:ActivityPolicyConstraintsType"/>

    <xsd:complexType name="ItemProcessingResultPolicyConstraintType">
        <xsd:annotation>
            <xsd:documentation>
                Constraint based on the result of the processing for one object that is processed by the activity.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.10</a:since>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractPolicyConstraintType">
                <xsd:sequence>
                    <xsd:element maxOccurs="unbounded" minOccurs="0" name="status" type="tns:OperationResultStatusType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Operation result status to match. It can be either PARTIAL_ERROR or FATAL_ERROR.
                                If not present, we decide solely on error category. If error categories are not specified,
                                any error matches.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element maxOccurs="unbounded" minOccurs="0" name="errorCategory" type="tns:ErrorCategoryType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Error category (network, security, policy, ...) to match.

                                NOTE: that some errors are not propagated to the level where they can be recognized
                                by this selector.

                                If not present, we decide solely on the status.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="itemProcessingResultPolicyConstraint" type="tns:ItemProcessingResultPolicyConstraintType"/>

    <xsd:complexType name="NumericThresholdPolicyConstraintType">
        <xsd:annotation>
            <xsd:documentation>
                Constraints based on numeric value (integer).
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.10</a:since>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractPolicyConstraintType">
                <xsd:sequence>
                    <xsd:sequence>
                        <xsd:element minOccurs="0" name="below" type="xsd:int">
                            <xsd:annotation>
                                <xsd:documentation>
                                    If constraint metric value is smaller than "below" value for activity, the constraint is triggered.
                                </xsd:documentation>
                            </xsd:annotation>
                        </xsd:element>
                        <xsd:element minOccurs="0" name="exceeds" type="xsd:int">
                            <xsd:annotation>
                                <xsd:documentation>
                                    If constraint metric value is greater than "exceeds" value for activity, the constraint is triggered.
                                </xsd:documentation>
                            </xsd:annotation>
                        </xsd:element>
                    </xsd:sequence>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="numericThresholdPolicyConstraint" type="tns:NumericThresholdPolicyConstraintType"/>

    <xsd:complexType name="DurationThresholdPolicyConstraintType">
        <xsd:annotation>
            <xsd:documentation>
                Constraint based on duration and its threshold.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.10</a:since>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractPolicyConstraintType">
                <xsd:sequence>
                    <xsd:element minOccurs="0" name="below" type="xsd:duration">
                        <xsd:annotation>
                            <xsd:documentation>
                                If constraint metric value is smaller than "below" duration for activity, the policy action is triggered.
                                E.g. If the activity execution time is below this duration, the policy action is triggered.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="exceeds" type="xsd:duration">
                        <xsd:annotation>
                            <xsd:documentation>
                                If constraint metric value is greater than "exceeds" duration for activity, the policy action is triggered.
                                E.g. If the activity execution time exceeds this duration, the policy action is triggered.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="durationThresholdPolicyConstraint" type="tns:DurationThresholdPolicyConstraintType"/>

    <xsd:complexType name="ActivityPolicyActionsType">
        <xsd:annotation>
            <xsd:documentation>
                Actions to be taken when the activity is executed.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.10</a:since>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <!-- Currently only suspendTask/notify are supported -->
            <!-- markRef will be a part of the record action later on -->
            <xsd:element minOccurs="0" name="notification" type="tns:NotificationActivityPolicyActionType"/>
            <xsd:element minOccurs="0" name="suspendTask" type="tns:SuspendTaskActivityPolicyActionType"/>
            <xsd:element minOccurs="0" name="restartActivity" type="tns:RestartActivityPolicyActionType"/>
            <xsd:element minOccurs="0" name="skipActivity" type="tns:SkipActivityPolicyActionType"/>
        </xsd:sequence>
    </xsd:complexType>
    <xsd:element name="activityPolicyActions" type="tns:ActivityPolicyActionsType"/>

    <xsd:complexType name="SkipActivityPolicyActionType">
        <xsd:annotation>
            <xsd:documentation>
                Skip activity that triggered policy constraint, continue with next activity.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.10</a:since>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:ActivityPolicyActionType"/>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="skipActivityPolicyAction" type="tns:SkipActivityPolicyActionType"/>

    <xsd:complexType name="RestartActivityPolicyActionType">
        <xsd:annotation>
            <xsd:documentation>
                Restart the run and realization of the activity that triggered policy constraint.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.10</a:since>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:ActivityPolicyActionType">
                <xsd:sequence>
                    <xsd:element default="PT5S" minOccurs="0" name="delay" type="xsd:duration">
                        <xsd:annotation>
                            <xsd:documentation>
                                What delay to introduce between attempts. Actual delay is taken as a random
                                number between 0 and delay*(2^(n-1)), where n is the number attempts so far.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="restartActivityPolicyAction" type="tns:RestartActivityPolicyActionType"/>

    <xsd:complexType abstract="true" name="ActivityPolicyActionType">
        <xsd:annotation>
            <xsd:documentation>
                Action to be taken when the activity policy is triggered.

                Similar to PolicyActionType, however no condition for now.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.10</a:since>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
    </xsd:complexType>
    <xsd:element name="activityPolicyAction" type="tns:ActivityPolicyActionType"/>

    <xsd:complexType name="NotificationActivityPolicyActionType">
        <xsd:annotation>
            <xsd:documentation>
                Notification action.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.10</a:since>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:ActivityPolicyActionType"/>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="notificationActivityPolicyAction" type="tns:NotificationActivityPolicyActionType"/>

    <xsd:complexType name="SuspendTaskActivityPolicyActionType">
        <xsd:annotation>
            <xsd:documentation>
                Suspend task action.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.10</a:since>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:ActivityPolicyActionType"/>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="suspendTaskActivityPolicyAction" type="tns:SuspendTaskActivityPolicyActionType"/>

    <xsd:complexType name="WorkDefinitionsType">
        <xsd:annotation>
            <xsd:documentation>
                Definition of the work that has to be done within an activity.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.4</a:since>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:choice>
                <xsd:element minOccurs="0" name="recomputation" type="tns:RecomputationWorkDefinitionType">
                    <xsd:annotation>
                        <xsd:documentation>
                            Recomputes specified objects.
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="import" type="tns:ImportWorkDefinitionType">
                    <xsd:annotation>
                        <xsd:documentation>
                            Imports specified resource objects.
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="shadowReclassification" type="tns:ShadowReclassificationWorkDefinitionType">
                    <xsd:annotation>
                        <xsd:documentation>
                            Shadow reclassification specified resource objects.
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="reconciliation" type="tns:ReconciliationWorkDefinitionType">
                    <xsd:annotation>
                        <xsd:documentation>
                            Reconciles specified resource objects.
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="asynchronousUpdate" type="tns:AsyncUpdateWorkDefinitionType">
                    <xsd:annotation>
                        <xsd:documentation>
                            Processes asynchronous updates for given resource objects
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="liveSynchronization" type="tns:LiveSyncWorkDefinitionType">
                    <xsd:annotation>
                        <xsd:documentation>
                            Processes live synchronization events for give resource objects.
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="cleanup" type="tns:CleanupWorkDefinitionType">
                    <xsd:annotation>
                        <xsd:documentation>
                            Cleans up obsolete objects like tasks, nodes, cases, certification campaigns,
                            report outputs, or audit records.
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="deletion" type="tns:DeletionWorkDefinitionType">
                    <xsd:annotation>
                        <xsd:documentation>
                            Deletes specified objects.
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="reportExport" type="tns:ClassicReportExportWorkDefinitionType">
                    <xsd:annotation>
                        <xsd:documentation>
                            Exports any report in a "classical" way. Supports multithreading but not bucketing (multi-node mode).
                        </xsd:documentation>
                        <xsd:appinfo>
                            <a:displayName>WorkDefinitionsType.reportExport</a:displayName>
                        </xsd:appinfo>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="reportImport" type="tns:ClassicReportImportWorkDefinitionType">
                    <xsd:annotation>
                        <xsd:documentation>
                            Imports a report. Supports multithreading.
                        </xsd:documentation>
                        <xsd:appinfo>
                            <a:displayName>WorkDefinitionsType.reportImport</a:displayName>
                        </xsd:appinfo>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="distributedReportExport" type="tns:DistributedReportExportWorkDefinitionType">
                    <xsd:annotation>
                        <xsd:documentation>
                            Exports report of repository objects or audit reports. Supports bucketing (multi-node mode) and multithreading.
                        </xsd:documentation>
                        <xsd:appinfo>
                            <a:displayName>WorkDefinitionsType.distributedReportExport</a:displayName>
                        </xsd:appinfo>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="iterativeScripting" type="tns:IterativeScriptingWorkDefinitionType">
                    <xsd:annotation>
                        <xsd:documentation>
                            Executes a script (a.k.a. action) over a set of objects.
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="nonIterativeScripting" type="tns:NonIterativeScriptingWorkDefinitionType">
                    <xsd:annotation>
                        <xsd:documentation>
                            Executes a script (a.k.a. action) on an empty or explicitly specified input.
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="focusValidityScan" type="tns:FocusValidityScanWorkDefinitionType">
                    <xsd:annotation>
                        <xsd:documentation>
                            Executes validity scan on focal objects.
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="triggerScan" type="tns:TriggerScanWorkDefinitionType">
                    <xsd:annotation>
                        <xsd:documentation>
                            Executes trigger scan on repository objects.
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="shadowRefresh" type="tns:ShadowRefreshWorkDefinitionType">
                    <xsd:annotation>
                        <xsd:documentation>
                            Looks for pending operations in shadows and updates their status.
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="iterativeChangeExecution" type="tns:IterativeChangeExecutionWorkDefinitionType">
                    <xsd:annotation>
                        <xsd:documentation>
                            Executes given changes on objects match the given query.
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="explicitChangeExecution" type="tns:ExplicitChangeExecutionWorkDefinitionType">
                    <xsd:annotation>
                        <xsd:documentation>
                            Executes given changes. Each change explicitly specifies the object(s) on which it is to be executed.
                        </xsd:documentation>
                        <xsd:appinfo>
                            <a:since>4.6</a:since>
                        </xsd:appinfo>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="nonIterativeChangeExecution" type="tns:ExplicitChangeExecutionWorkDefinitionType">
                    <xsd:annotation>
                        <xsd:documentation>
                            Executes given changes. Each change explicitly specifies the object(s) on which it is to be executed.
                            DEPRECATED: the legacy name.
                        </xsd:documentation>
                        <xsd:appinfo>
                            <a:deprecated>true</a:deprecated>
                            <a:deprecatedSince>4.6</a:deprecatedSince>
                            <a:plannedRemoval>5.0</a:plannedRemoval>
                        </xsd:appinfo>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="reindexing" type="tns:ReindexingWorkDefinitionType">
                    <xsd:annotation>
                        <xsd:documentation>
                            Re-indexes specified repository objects.
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="repartitioning" type="tns:RepartitioningWorkDefinitionType">
                    <xsd:annotation>
                        <xsd:documentation>
                            Re-parititions specified repository objects. Creates new table partiations
                            for objects if they according to policy should be in separate partition.
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="shadowCleanup" type="tns:ShadowCleanupWorkDefinitionType">
                    <xsd:annotation>
                        <xsd:documentation>
                            Deletes all shadows that have not been updated for given time.
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="objectIntegrityCheck" type="tns:ObjectIntegrityCheckWorkDefinitionType">
                    <xsd:annotation>
                        <xsd:documentation>
                            TODO
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="shadowIntegrityCheck" type="tns:ShadowIntegrityCheckWorkDefinitionType">
                    <xsd:annotation>
                        <xsd:documentation>
                            TODO
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="activityAutoScaling" type="tns:ActivityAutoScalingWorkDefinitionType">
                    <xsd:annotation>
                        <xsd:documentation>
                            TODO
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="noOp" type="tns:NoOpWorkDefinitionType">
                    <xsd:annotation>
                        <xsd:documentation>
                            TODO
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="propagation" type="tns:PropagationWorkDefinitionType">
                    <xsd:annotation>
                        <xsd:documentation>
                            Executes the propagation activity.
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="multiPropagation" type="tns:MultiPropagationWorkDefinitionType">
                    <xsd:annotation>
                        <xsd:documentation>
                            Executes the multi-propagation activity.
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="roleMembershipManagement" type="tns:RoleMembershipManagementWorkDefinitionType">
                    <xsd:annotation>
                        <xsd:documentation>
                            Executes the "role membership management" activity.
                        </xsd:documentation>
                        <xsd:appinfo>
                            <a:since>4.8</a:since>
                        </xsd:appinfo>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="roleAnalysisClustering" type="tns:RoleAnalysisClusteringWorkDefinitionType">
                    <xsd:annotation>
                        <xsd:documentation>
                            TODO
                        </xsd:documentation>
                        <xsd:appinfo>
                            <a:since>4.8</a:since>
                        </xsd:appinfo>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="roleAnalysisPatternDetection" type="tns:RoleAnalysisPatternDetectionWorkDefinitionType">
                    <xsd:annotation>
                        <xsd:documentation>
                            TODO
                        </xsd:documentation>
                        <xsd:appinfo>
                            <a:since>4.8</a:since>
                        </xsd:appinfo>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="certificationRemediation" type="tns:CertificationRemediationWorkDefinitionType">
                    <xsd:annotation>
                        <xsd:documentation>
                            Specified certification campaign for remediation.
                        </xsd:documentation>
                        <xsd:appinfo>
                            <a:since>4.9</a:since>
                            <a:displayName>WorkDefinitionsType.certificationRemediation</a:displayName>
                        </xsd:appinfo>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="certificationOpenNextStage" type="tns:CertificationOpenNextStageWorkDefinitionType">
                    <xsd:annotation>
                        <xsd:documentation>
                            Specified certification campaign for next stage operation.
                        </xsd:documentation>
                        <xsd:appinfo>
                            <a:since>4.9</a:since>
                            <a:displayName>WorkDefinitionsType.certificationOpenNextStage</a:displayName>
                        </xsd:appinfo>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="certificationStartCampaign" type="tns:CertificationStartCampaignWorkDefinitionType">
                    <xsd:annotation>
                        <xsd:documentation>
                            Specified certification campaign for next stage operation.
                        </xsd:documentation>
                        <xsd:appinfo>
                            <a:since>4.9</a:since>
                            <a:displayName>WorkDefinitionsType.certificationStartCampaign</a:displayName>
                        </xsd:appinfo>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="certificationCloseCurrentStage" type="tns:CertificationCloseCurrentStageWorkDefinitionType">
                    <xsd:annotation>
                        <xsd:documentation>
                            Specified certification campaign for next stage operation.
                        </xsd:documentation>
                        <xsd:appinfo>
                            <a:since>4.9</a:since>
                            <a:displayName>WorkDefinitionsType.certificationCloseCurrentStage</a:displayName>
                        </xsd:appinfo>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="certificationReiterateCampaign" type="tns:CertificationReiterateCampaignWorkDefinitionType">
                    <xsd:annotation>
                        <xsd:documentation>
                            Specified certification campaign for next stage operation.
                        </xsd:documentation>
                        <xsd:appinfo>
                            <a:since>4.9</a:since>
                            <a:displayName>WorkDefinitionsType.certificationReiterateCampaign</a:displayName>
                        </xsd:appinfo>
                    </xsd:annotation>
                </xsd:element>
            </xsd:choice>
            <xsd:element minOccurs="0" name="extension" type="tns:ExtensionType">
                <xsd:annotation>
                    <xsd:documentation>
                        TODO
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>

    <xsd:complexType name="ActivitiesTailoringType">
        <xsd:annotation>
            <xsd:documentation>
                Tailors the work specification by adding activity or activities before or after existing ones,
                or by changing specification (execution mode, flow of control, distribution) of existing activities.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.4</a:since>
                <a:container>true</a:container>
                <a:experimental>true</a:experimental>
                <a:elaborate>true</a:elaborate> <!-- maybe -->
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <!--<xsd:element name="insertBefore" type="tns:ActivityBeforeType" minOccurs="0" maxOccurs="unbounded">-->
            <!--    <xsd:annotation>-->
            <!--        <xsd:documentation>-->
            <!--            Not implemented yet.-->
            <!--        </xsd:documentation>-->
            <!--        <xsd:appinfo>-->
            <!--            <a:experimental>true</a:experimental>-->
            <!--            <a:displayName>ActivitiesTailoringType.insertBefore</a:displayName>-->
            <!--        </xsd:appinfo>-->
            <!--    </xsd:annotation>-->
            <!--</xsd:element>-->
            <!--<xsd:element name="insertAfter" type="tns:ActivityAfterType" minOccurs="0" maxOccurs="unbounded">-->
            <!--    <xsd:annotation>-->
            <!--        <xsd:documentation>-->
            <!--            Not implemented yet.-->
            <!--        </xsd:documentation>-->
            <!--        <xsd:appinfo>-->
            <!--            <a:experimental>true</a:experimental>-->
            <!--            <a:displayName>ActivitiesTailoringType.insertAfter</a:displayName>-->
            <!--        </xsd:appinfo>-->
            <!--    </xsd:annotation>-->
            <!--</xsd:element>-->
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="change" type="tns:ActivityTailoringType">
                <xsd:annotation>
                    <xsd:documentation>
                        TODO
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:displayName>ActivitiesTailoringType.change</a:displayName>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>

    <xsd:complexType name="ActivityBeforeAfterType">
        <xsd:annotation>
            <xsd:documentation>
                TODO
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.4</a:since>
                <a:container>true</a:container>
                <a:experimental>true</a:experimental>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="reference" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        Identifier of existing activity before/after which the current one has to be inserted.
                        Null means the first or the last one, respectively.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="activity" type="tns:ActivityDefinitionType">
                <xsd:annotation>
                    <xsd:documentation>
                        Activity or activities that are to be inserted.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>

    <xsd:complexType name="ActivityBeforeType">
        <xsd:annotation>
            <xsd:documentation>
                TODO
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.4</a:since>
                <a:container>true</a:container>
                <a:experimental>true</a:experimental>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:ActivityBeforeAfterType"/>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:complexType name="ActivityAfterType">
        <xsd:annotation>
            <xsd:documentation>
                TODO
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.4</a:since>
                <a:container>true</a:container>
                <a:experimental>true</a:experimental>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:ActivityBeforeAfterType"/>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:complexType name="ActivityTailoringType">
        <xsd:annotation>
            <xsd:documentation>
                TODO
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.4</a:since>
                <a:container>true</a:container>
                <a:experimental>true</a:experimental>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="reference" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        Identifier of existing activity or activities that are to be tailored.
                        No value means all activities.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="executionMode" type="tns:ExecutionModeType">
                <xsd:annotation>
                    <xsd:documentation>
                        Execution mode for this activity: dryRun, simulate, execute, bucketsAnalysis.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="controlFlow" type="tns:ActivityControlFlowDefinitionTailoringType">
                <xsd:annotation>
                    <xsd:documentation>
                        Items like prerequisites, preconditions, error handling strategy, and so on.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="distribution" type="tns:ActivityDistributionDefinitionTailoringType">
                <xsd:annotation>
                    <xsd:documentation>
                        Distribution of the work executed as part of this activity.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <!-- TODO maybe we should create reporting definition tailoring type -->
            <xsd:element minOccurs="0" name="reporting" type="tns:ActivityReportingDefinitionType">
                <xsd:annotation>
                    <xsd:documentation>
                        How the activity is reported (logging, tracing, profiling, reporting, etc).
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="policies" type="tns:ActivityPoliciesDefinitionTailoringType">
                <xsd:annotation>
                    <xsd:documentation>
                        Policies specific for this activity.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>

    <xsd:complexType name="ActivityPoliciesDefinitionTailoringType">
        <xsd:annotation>
            <xsd:documentation>
                TODO
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.10</a:since>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:ActivityPoliciesType">
                <xsd:sequence>
                    <xsd:element default="overwrite" minOccurs="0" name="tailoringMode" type="tns:TailoringModeType">
                        <xsd:annotation>
                            <xsd:documentation>
                                How the tailoring is applied.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="activityPoliciesDefinitionTailoring" type="tns:ActivityPoliciesDefinitionTailoringType"/>

    <xsd:complexType name="ActivityControlFlowDefinitionTailoringType">
        <xsd:annotation>
            <xsd:documentation>
                TODO
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.4</a:since>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:ActivityControlFlowDefinitionType">
                <xsd:sequence>
                    <xsd:element default="overwrite" minOccurs="0" name="tailoringMode" type="tns:TailoringModeType">
                        <xsd:annotation>
                            <xsd:documentation>
                                How the tailoring is applied.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:complexType name="ActivityDistributionDefinitionTailoringType">
        <xsd:annotation>
            <xsd:documentation>
                TODO
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.4</a:since>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:ActivityDistributionDefinitionType">
                <xsd:sequence>
                    <xsd:element default="overwrite" minOccurs="0" name="tailoringMode" type="tns:TailoringModeType">
                        <xsd:annotation>
                            <xsd:documentation>
                                How the tailoring is applied.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:simpleType name="TailoringModeType">
        <xsd:annotation>
            <xsd:documentation>
                How the tailoring is applied.
            </xsd:documentation>
            <xsd:appinfo>
                <jaxb:typesafeEnumClass/>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="overwrite">
                <xsd:annotation>
                    <xsd:documentation>
                        <p>
                            Specified container value overwrites everything that was configured for an activity.
                            This is the default.
                        </p>
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="OVERWRITE"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="overwriteSpecified">
                <xsd:annotation>
                    <xsd:documentation>
                        <p>
                            Only specified (first-level) items are overwritten.
                        </p>
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="OVERWRITE_SPECIFIED"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:complexType name="ActivityCompositionType">
        <xsd:annotation>
            <xsd:documentation>
                TODO
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.4</a:since>
                <a:container>true</a:container>
                <a:experimental>true</a:experimental>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <!-- not implemented yet -->
            <!--<xsd:element name="defaultWorkDefinition" type="tns:WorkDefinitionsType" minOccurs="0">-->
            <!--    <xsd:annotation>-->
            <!--        <xsd:documentation>-->
            <!--            Describes the work that has to be done, e.g. recomputation, reconciliation, scripting expression-->
            <!--            execution, and so on. This contains also the necessary parameters, like resource reference,-->
            <!--            object class, object query, etc.-->
            <!--        </xsd:documentation>-->
            <!--    </xsd:annotation>-->
            <!--</xsd:element>-->
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="activity" type="tns:ActivityDefinitionType">
                <xsd:annotation>
                    <xsd:documentation>
                        TODO
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>

    <xsd:complexType name="ActivityControlFlowDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Defines the features related to the flow of control within an activity (simple or composite).
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.4</a:since>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="bucketProcessingCondition" type="tns:ExpressionType">
                <xsd:annotation>
                    <xsd:documentation>
                        Condition for processing or analysing specific buckets. Currently supported for iterative activities.
                        (If present and if returns false, the bucket is marked as complete without any processing.)
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="itemProcessingCondition" type="tns:ExpressionType">
                <xsd:annotation>
                    <xsd:documentation>
                        Condition for processing specific items. Currently supported for iterative activities.
                        (If present and if returns false, the item processing is skipped.)
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element default="automatic" minOccurs="0" name="processingOption" type="tns:PartialProcessingTypeType">
                <xsd:annotation>
                    <xsd:documentation>
                        Controls whether the specified activity is executed.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <!--<xsd:element name="activityPrecondition" type="tns:ExpressionType" minOccurs="0">-->
            <!--    <xsd:annotation>-->
            <!--        <xsd:documentation>-->
            <!--            Precondition: an expression that governs whether the current activity should be executed or skipped,-->
            <!--            or whether the task should stop altogether. Should return a single value-->
            <!--            of ActivityPreconditionOutputType.-->

            <!--            NOT SUPPORTED YET.-->
            <!--        </xsd:documentation>-->
            <!--    </xsd:annotation>-->
            <!--</xsd:element>-->
            <!--<xsd:element name="prerequisite" type="xsd:string" minOccurs="0" maxOccurs="unbounded">-->
            <!--    <xsd:annotation>-->
            <!--        <xsd:documentation>-->
            <!--            Set of prerequisites i.e. activities that must be complete before this one can start. NOT SUPPORTED YET.-->
            <!--        </xsd:documentation>-->
            <!--    </xsd:annotation>-->
            <!--</xsd:element>-->
            <xsd:element minOccurs="0" name="errorHandling" type="tns:ActivityErrorHandlingStrategyType">
                <xsd:annotation>
                    <xsd:documentation>
                        Error handling strategy for this activity.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <!--<xsd:element name="repeatedExecution" type="tns:ActivityRepeatedExecutionStrategyType" minOccurs="0" default="never">-->
            <!--    <xsd:annotation>-->
            <!--        <xsd:documentation>-->
            <!--            Should be the activity re-executed when the task is restarted (e.g. resumed)?-->
            <!--            NOT IMPLEMENTED YET.-->
            <!--        </xsd:documentation>-->
            <!--    </xsd:annotation>-->
            <!--</xsd:element>-->
            <xsd:element default="false" minOccurs="0" name="parallelExecution" type="xsd:boolean">
                <xsd:annotation>
                    <xsd:documentation>
                        Whether the child activities should be executed in parallel.
                        (This is applicable only to composite activities.)
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:experimental>true</a:experimental>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>

    <xsd:simpleType name="ActivityRepeatedExecutionStrategyType">
        <xsd:annotation>
            <xsd:documentation>
                Should be an activity re-executed when the task is restarted (e.g. resumed)?
                NOT IMPLEMENTED YET.
            </xsd:documentation>
            <xsd:appinfo>
                <jaxb:typesafeEnumClass/>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="never">
                <xsd:annotation>
                    <xsd:documentation>
                        <p>
                            Once executed, the activity should not be re-executed again.
                        </p>
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="NEVER"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="always">
                <xsd:annotation>
                    <xsd:documentation>
                        <p>
                            The activity should be always executed.
                        </p>
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="ALWAYS"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="ifError">
                <xsd:annotation>
                    <xsd:documentation>
                        <p>
                            The activity should be re-executed if it ended with partial or fatal error before.
                        </p>
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="IF_ERROR"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="ifFatalError">
                <xsd:annotation>
                    <xsd:documentation>
                        <p>
                            The activity should be re-executed if it ended with fatal error before.
                        </p>
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="IF_FATAL_ERROR"/>
                        <a:since>4.4</a:since>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:complexType name="ActivitySubtaskDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                How the part is realized via subtask.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.4</a:since>
                <a:container>true</a:container>
                <a:experimental>true</a:experimental>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="taskName" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        How to derive names for the partition task. It is possible to use substitution strings of {masterTaskName},
                        {masterTaskHandlerUri} and {index} here. Overrides the pattern specified for all parts.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="executionEnvironment" type="tns:TaskExecutionEnvironmentType">
                <xsd:annotation>
                    <xsd:documentation>
                        Execution environment configuration to use for partition task.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:since>4.0</a:since>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="copyMasterExtension" type="xsd:boolean">
                <xsd:annotation>
                    <xsd:documentation>
                        Whether to copy task extension from the master task.
                        Overrides the value specified in the parent element.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element default="false" minOccurs="0" name="durable" type="xsd:boolean">
                <xsd:annotation>
                    <xsd:documentation>
                        Whether the subtasks for parts should be durable i.e. whether they should persist
                        through master task restarts. This is useful e.g. for partitioned validity scanner
                        because each partition keeps its own last scan timestamp.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>

    <xsd:simpleType name="ExecutionModeType">
        <xsd:annotation>
            <xsd:documentation>
                TODO
            </xsd:documentation>
            <xsd:appinfo>
                <jaxb:typesafeEnumClass/>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="full">
                <xsd:annotation>
                    <xsd:documentation>
                        <p>
                            Full execution mode. Changes are computed and also executed.
                        </p>
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="FULL"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="preview">
                <xsd:annotation>
                    <xsd:documentation>
                        <p>
                            A preview (simulation) of changes: Changes are computed, but nothing is executed.
                            Used for example to check the thresholds before the full (real) execution.
                            In the future midPoint may also store the computed changes for later analysis.

                            TODO we use also the term "simulation"

                            corresponds to TaskExecutionMode.persistenceMode = SHADOWS
                        </p>
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="PREVIEW"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="shadowManagementPreview">
                <xsd:annotation>
                    <xsd:documentation>
                        <p>
                            TODO ... preview of shadow classification or correlation
                            corresponds to TaskExecutionMode.persistenceMode = NONE
                        </p>
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="SHADOW_MANAGEMENT_PREVIEW"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="dryRun">
                <xsd:annotation>
                    <xsd:documentation>
                        <p>
                            Nothing is executed. Just metadata are handled. E.g. during reconciliation
                            only situations in shadows are set.
                        </p>
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="DRY_RUN"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="none">
                <xsd:annotation>
                    <xsd:documentation>
                        <p>
                            Items are fetched from repository or resource, but no specific processing
                            is executed. This is very similar to dryRun, but - technically speaking -
                            items are discarded right after being fetched from the source. Provisioning
                            pre-processing of shadows may or may not be done, depending on the implementation.
                            This mode is used just to test the object retrieval process.
                        </p>
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="NONE"/>
                        <a:since>4.4</a:since>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="bucketAnalysis">
                <xsd:annotation>
                    <xsd:documentation>
                        <p>
                            In this mode no items are really fetched. Only the size of individual buckets
                            is measured.
                        </p>
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="BUCKET_ANALYSIS"/>
                        <a:since>4.4</a:since>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="ActivityPreconditionOutputType">
        <xsd:annotation>
            <xsd:documentation>
                Output of activity precondition expression. Describes how to continue with parent activity run.

                THIS IS AN UNIMPLEMENTED DRAFT.
            </xsd:documentation>
            <xsd:appinfo>
                <jaxb:typesafeEnumClass/>
                <a:experimental>true</a:experimental>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="execute">
                <xsd:annotation>
                    <xsd:documentation>
                        <p>
                            Activity should be executed. This is the default value.
                        </p>
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="EXECUTE"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="skip">
                <xsd:annotation>
                    <xsd:documentation>
                        <p>
                            Activity run should be skipped.
                        </p>
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="SKIP"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="permanentError">
                <xsd:annotation>
                    <xsd:documentation>
                        <p>
                            Parent activity should stop with a permanent error.
                        </p>
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="PERMANENT_ERROR"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="temporaryError">
                <xsd:annotation>
                    <xsd:documentation>
                        <p>
                            Parent activity should stop with a temporary error.
                        </p>
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="TEMPORARY_ERROR"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
        </xsd:restriction>
    </xsd:simpleType>

    <!-- TODO better term should be found; "execution mode" is just too vague. -->
    <xsd:complexType name="ActivityExecutionModeDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Detailed definition of the execution mode.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.7</a:since>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="mode" type="tns:ExecutionModeType">
                <xsd:annotation>
                    <xsd:documentation>
                        Execution mode for this activity: full, preview, dryRun, none, bucketAnalysis, ...
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="configurationToUse" type="tns:ConfigurationSpecificationType">
                <xsd:annotation>
                    <xsd:documentation>
                        What configuration should be used? Currently, this is to be used only when simulation (preview) mode is selected.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>

    <xsd:complexType name="SchedulerInformationType">
        <xsd:annotation>
            <xsd:documentation>
                Describes the state of the (local) scheduler.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.0</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="node" type="tns:NodeType">
                <xsd:annotation>
                    <xsd:documentation>
                        Information on the current node. Some security-sensitive or potentially large items might be omitted.
                        (Currently this means secret, secret update timestamp, and task execution limitations.)
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="executingTask" type="tns:TaskType">
                <xsd:annotation>
                    <xsd:documentation>
                        Locally executing tasks. Currently only task OIDs are filled-in here due to performance optimization.
                        But later we may provide more information.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>
    <xsd:element name="schedulerInformation" type="tns:SchedulerInformationType"/>

    <xsd:complexType name="TaskActivityStateType">
        <xsd:annotation>
            <xsd:documentation>
                Describes the state of the activity or activities embedded in the task (and its subtasks - in the
                case of a root task).
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>3.8</a:since>
                <a:schemaMigration>
                    <a:element>tns:bucket</a:element>
                    <a:version>4.4</a:version>
                    <a:operation>removed</a:operation>
                </a:schemaMigration>
                <a:schemaMigration>
                    <a:element>tns:numberOfBuckets</a:element>
                    <a:version>4.4</a:version>
                    <a:operation>removed</a:operation>
                </a:schemaMigration>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="localRoot" type="tns:ActivityPathType">
                <xsd:annotation>
                    <xsd:documentation>
                        Activity that is the local root for this task. I.e. what part of the activity tree
                        is executed within this task.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="taskRole" type="tns:TaskRoleType">
                <xsd:annotation>
                    <xsd:documentation>
                        Role of the task in the run of the local root activity.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="activity" type="tns:ActivityStateType">
                <xsd:annotation>
                    <xsd:documentation>
                        State of individual activities, organized in a tree. Rooted at local root activity.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="tree" type="tns:ActivityTreeStateType">
                <xsd:annotation>
                    <xsd:documentation>
                        Describes the state of an activity tree. Present only in the root task.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>

    <xsd:complexType name="ActivityStateType">
        <xsd:annotation>
            <xsd:documentation>
                Describes the state of an activity: everything the activity needs to record in the repository in order to
                function properly. Most parts are maintained by the activity framework. The "workState" is a business state
                specific to the particular activity type.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
                <a:elaborate>true</a:elaborate>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="identifier" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        Identifier of the activity.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="taskRunIdentifier" type="xsd:string"/>
            <xsd:element default="1" minOccurs="0" name="executionAttempt" type="xsd:int"/>
            <xsd:element minOccurs="0" name="realizationState" type="tns:ActivityRealizationStateType">
                <xsd:annotation>
                    <xsd:documentation>
                        State of the activity realization: in progress local/delegated/distributed, complete, or aborted.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="abortingInformation" type="tns:ActivityAbortingInformationType">
                <xsd:annotation>
                    <xsd:documentation>
                        More details about why and how was the activity aborted. Used when realizationState = ABORTED.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="resultStatus" type="tns:OperationResultStatusType">
                <xsd:annotation>
                    <xsd:documentation>
                        Operation result status of this activity.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="realizationStartTimestamp" type="xsd:dateTime">
                <xsd:annotation>
                    <xsd:documentation>
                        When did the current (or last) realization start?

                        For workers, this information is copied from the coordinator when the worker starts.
                        For delegates, this information describes when the realization started in the delegate.
                        (Can be a moment after it started in the delegator task.)
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="realizationEndTimestamp" type="xsd:dateTime">
                <xsd:annotation>
                    <xsd:documentation>
                        When did the current (or last) realization end? If null, this means that the current realization
                        is in progress.

                        The meaning in workers is undefined.

                        The meaning in delegates is "the realization end from the point of view of the delegate",
                        i.e. just a moment before the realization ends from the point of view of the delegator.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="runStartTimestamp" type="xsd:dateTime">
                <xsd:annotation>
                    <xsd:documentation>
                        When did the current (or last) run start?
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="runEndTimestamp" type="xsd:dateTime">
                <xsd:annotation>
                    <xsd:documentation>
                        When did the current (or last) run end? If null, this means that the current run is in progress.
                        Note that this is different from the last finish timestamp in tasks, which is set to the previous
                        run value even if the new run is in progress.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="progress" type="tns:ActivityProgressType">
                <xsd:annotation>
                    <xsd:documentation>
                        Progress of this activity. Relevant for worker and standalone tasks.
                        (Can be copied to coordinator e.g. if workers are deleted.)
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="statistics" type="tns:ActivityStatisticsType">
                <xsd:annotation>
                    <xsd:documentation>
                        Statistical information related to activity execution.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="bucketing" type="tns:ActivityBucketingStateType">
                <xsd:annotation>
                    <xsd:documentation>
                        Information about the bucket processing within the activity.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="counters" type="tns:ActivityCounterGroupsType">
                <xsd:annotation>
                    <xsd:documentation>
                        Counters related to the execution of the activity, grouped into related categories.
                        One of the categories are counters needed to implement thresholds for policy rules.

                        Note: The counters may be moved to separate repository object later to improve performance.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <!-- TODO group by execution full/simulation, same as counters [viliam] -->
            <xsd:element minOccurs="0" name="policies" type="tns:ActivityPoliciesStateType">
                <xsd:annotation>
                    <xsd:documentation>
                        State of the policies related to the execution of the activity, grouped into related categories.

                        Note: The policies may be moved to separate repository object later to improve performance.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="simulation" type="tns:ActivitySimulationStateType">
                <xsd:annotation>
                    <xsd:documentation>
                        State related to the "simulated" execution of this activity (and its children).
                        Contains e.g. the OID of the simulation result object after it is created.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:since>4.7</a:since>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="reports" type="tns:ActivityReportsType">
                <xsd:annotation>
                    <xsd:documentation>
                        Reports related to activity execution.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="workState" type="tns:AbstractActivityWorkStateType">
                <xsd:annotation>
                    <xsd:documentation>
                        Work (business) state of the activity.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="persistence" type="tns:ActivityStatePersistenceType">
                <xsd:annotation>
                    <xsd:documentation>
                        How much is this state information persistent?
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="activity" type="tns:ActivityStateType">
                <xsd:annotation>
                    <xsd:documentation>
                        Work state of child activities.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>

    <xsd:complexType name="ActivityAbortingInformationType">
        <xsd:annotation>
            <xsd:documentation>
                More details why an activity was aborted.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.10</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="activityPath" type="tns:ActivityPathType">
                <xsd:annotation>
                    <xsd:documentation>
                        Which is the topmost activity has to be aborted? (Because if a composite activity is aborted, it means
                        that all its descendants that have been started but not finished have to be aborted as well.)

                        This information is used when propagating the aborting information upwards the tree.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="policyAction" type="tns:ActivityPolicyActionType">
                <xsd:annotation>
                    <xsd:documentation>
                        Policy action that caused the activity to be aborted.
                        Currently supported are SkipActivityPolicyActionType and RestartActivityPolicyActionType.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="ActivityTreeStateType">
        <xsd:annotation>
            <xsd:documentation>
                Describes the state of an activity tree.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
                <a:elaborate>true</a:elaborate>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="realizationState" type="tns:ActivityTreeRealizationStateType">
                <xsd:annotation>
                    <xsd:documentation>
                        Realization state of the activity tree.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="taskRunIdentifier" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        <p>
                            Task run identifier. This is a unique identification of specific task run.
                            Task run identifier can be useful when one wants to distinguish between different
                            executions of a recurrent task.
                        </p>
                        <p>
                            Task run identifier is assigned automatically when the task starts after it was
                            previously finished. Start from suspended unfinished state does not change the
                            task run identifier (e.g. when the task is resumed).
                        </p>
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="activity" type="tns:ActivityStateOverviewType">
                <xsd:annotation>
                    <xsd:documentation>
                        Overview of the root activity state (and other activities as well, recursively).
                        The whole tree is present here.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>

    <xsd:complexType name="ActivityStateOverviewType">
        <xsd:annotation>
            <xsd:documentation>
                Describes an overview of the state of an activity. This information is maintained in the root task only,
                and is an excerpt from state information distributed throughout the tree.

                The idea is to provide all important information (needed e.g. in the task list) directly in the root
                task, to avoid the need to fetch subtasks.

                This structure is intentionally not a container (currently).
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.4</a:since>
                <a:elaborate>true</a:elaborate>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="identifier" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        Identifier of the activity.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="taskRunIdentifier" type="xsd:string"/>
            <xsd:element default="1" minOccurs="0" name="executionAttempt" type="xsd:int"/>
            <xsd:element minOccurs="0" name="realizationState" type="tns:ActivitySimplifiedRealizationStateType">
                <xsd:annotation>
                    <xsd:documentation>
                        State of the activity processing: null (not started), in progress, complete.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:since>4.10</a:since>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="resultStatus" type="tns:OperationResultStatusType">
                <xsd:annotation>
                    <xsd:documentation>
                        Operation result status of this activity run.

                        If an activity realization is in progress (all tasks being run, or some of them stopped, or even
                        all of the tasks stopped - but with work not being complete), here is either IN_PROGRESS
                        (if there are no known errors, or if the activity handler does not report them),
                        or PARTIAL_ERROR or FATAL_ERROR (if there are known errors, either partial or fatal).

                        In a situations where the processing is stopped because of some fatal error (e.g. a "master" query
                        cannot be issued against a resource in a synchronization activity, or a threshold was reached, etc.),
                        usually FATAL_ERROR is present here. (Not IN_PROGRESS, although the activity - technically speaking -
                        did not finish yet.)

                        After the realization is complete, the status can no longer be IN_PROGRESS. It is
                        usually either SUCCESS, PARTIAL_ERROR, or FATAL_ERROR. Other states (WARNING, HANDLED_ERROR)
                        are possible but uncommon.

                        For a distributed activity here is the aggregated result covering the whole activity.
                        (May or may not be a simple aggregation of individual workers' results. For example,
                        the result can be determined by taking into account success/failure status of items
                        processed.)

                        For a delegated activity here is the result of the delegate run (not the delegating one).

                        For a simple (non-distributed, non-delegated) activity the result stored here is related
                        to the result in the "task" field. However, there can be situations where this result is IN_PROGRESS,
                        but the result in the "task" field is not IN_PROGRESS (because the activity run stopped).
                        In any case, these results should not contradict each other.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="bucketProgress" type="tns:BucketProgressOverviewType">
                <xsd:annotation>
                    <xsd:documentation>
                        Activity progress in the terms of buckets.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="task" type="tns:ActivityTaskStateOverviewType">
                <xsd:annotation>
                    <xsd:documentation>
                        Information about activity run within a task or tasks.

                        However, not all runs are represented here: Delegating and distributing runs
                        are not mentioned. Only local ones have their representation here.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="progressInformationVisibility" type="tns:ActivityStateOverviewProgressInformationVisibilityType">
                <xsd:annotation>
                    <xsd:documentation>
                        Is progress information hidden e.g. because of redundancy
                        (if the activity runs directly in the root task)?
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="persistence" type="tns:ActivityStatePersistenceType">
                <xsd:annotation>
                    <xsd:documentation>
                        How much is this state information persistent (between individual realizations)?
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="activity" type="tns:ActivityStateOverviewType">
                <xsd:annotation>
                    <xsd:documentation>
                        State overview of child activities.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:simpleType name="ActivityRealizationStateType">
        <xsd:annotation>
            <xsd:documentation>
                Realization state of an activity.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="inProgressLocal">
                <xsd:annotation>
                    <xsd:documentation>
                        Activity is in progress, treated by the current task.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="IN_PROGRESS_LOCAL"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="inProgressDelegated">
                <xsd:annotation>
                    <xsd:documentation>
                        Activity is in progress and it was delegated to a subtask or subtasks.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="IN_PROGRESS_DELEGATED"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="inProgressDistributed">
                <xsd:annotation>
                    <xsd:documentation>
                        Activity is in progress and it was distributed to worker subtasks.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="IN_PROGRESS_DISTRIBUTED"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="complete">
                <xsd:annotation>
                    <xsd:documentation>
                        Activity is complete.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="COMPLETE"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="aborted">
                <xsd:annotation>
                    <xsd:documentation>
                        Activity execution was aborted before completion. Usually because of a policy rule requesting
                        to skip or restart an activity.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="ABORTED"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="ActivityStateOverviewProgressInformationVisibilityType">
        <xsd:annotation>
            <xsd:documentation>
                Is progress information present?
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="visible">
                <xsd:annotation>
                    <xsd:documentation>
                        Progress is visible (if there is any).
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="VISIBLE"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="hidden">
                <xsd:annotation>
                    <xsd:documentation>
                        Progress is intentionally hidden (usually to avoid unnecessary task updates).
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="HIDDEN"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="ActivityStateOverviewProgressUpdateModeType">
        <xsd:annotation>
            <xsd:documentation>
                How is the progress updated?
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.4</a:since>
                <a:experimental>true</a:experimental>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="always">
                <xsd:annotation>
                    <xsd:documentation>
                        Progress is always updated, even for the activities residing in the root task.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="ALWAYS"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="forNonLocalActivities">
                <xsd:annotation>
                    <xsd:documentation>
                        Progress is updated only for activities that do not reside in the root task.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="FOR_NON_LOCAL_ACTIVITIES"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="never">
                <xsd:annotation>
                    <xsd:documentation>
                        Progress is never updated.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="NEVER"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:complexType name="BucketProgressOverviewType">
        <xsd:annotation>
            <xsd:documentation>
                Information on buckets processing (for activity state overview).
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.4</a:since>
                <a:experimental>true</a:experimental>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="totalBuckets" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        How many buckets are there? (if known)
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="completeBuckets" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        How many buckets are complete?
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="ItemsProgressOverviewType">
        <xsd:annotation>
            <xsd:documentation>
                Information on items processing (for activity state overview).
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.4</a:since>
                <a:experimental>true</a:experimental>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="expectedTotal" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        Expected total progress for an activity, if known.
                        (Always null for worker tasks.)
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="successfullyProcessed" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        How many items have been successfully processed?
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="failed" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        How many items have failed to be processed?
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="skipped" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        How many items have been skipped?
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="ActivityTaskStateOverviewType">
        <xsd:annotation>
            <xsd:documentation>
                State of the local activity run in an individual task.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.4</a:since>
                <a:experimental>true</a:experimental>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="taskRef" type="tns:ObjectReferenceType">
                <xsd:annotation>
                    <xsd:documentation>
                        Reference to the task.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:objectReferenceTargetType>tns:TaskType</a:objectReferenceTargetType>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="node" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        Identifier of a node where the task is executing or was executing last.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="bucketsProcessingRole" type="tns:BucketsProcessingRoleType">
                <xsd:annotation>
                    <xsd:documentation>
                        Role of this task in the processing of the buckets: standalone executor, coordinator, or worker.
                        Null if not applicable.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="executionState" type="tns:ActivityTaskExecutionStateType">
                <xsd:annotation>
                    <xsd:documentation>
                        Is the activity really running now?
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="stalledSince" type="xsd:dateTime">
                <xsd:annotation>
                    <xsd:documentation>
                        If not null, this property denotes since what time is this activity run (in given task) stalled.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="progress" type="tns:ItemsProgressOverviewType">
                <xsd:annotation>
                    <xsd:documentation>
                        Simplified items progress information.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="resultStatus" type="tns:OperationResultStatusType">
                <xsd:annotation>
                    <xsd:documentation>
                        Result of this run. Regarding IN_PROGRESS interpretation: it is currently
                        similar to the one in "resultStatus" field of the containing activity entry.
                        (I.e. as long as an activity is not complete, it may indicate this fact using IN_PROGRESS
                        status here. However, it may also indicate errors using PARTIAL/FATAL ERROR status.)
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="message" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        Error or warning message.

                        Message related to the task execution.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:since>4.10</a:since>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="userFriendlyMessage" type="tns:LocalizableMessageType">
                <xsd:annotation>
                    <xsd:documentation>
                        Error or warning message.

                        User-friendly variant of message related to the task execution.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:since>4.10</a:since>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:simpleType name="ActivityStatePersistenceType">
        <xsd:annotation>
            <xsd:documentation>
                How much is the activity state (full / overview) persistent across individual realizations?
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.4</a:since>
                <a:experimental>true</a:experimental>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="perpetual">
                <xsd:annotation>
                    <xsd:documentation>
                        The state should be preserved across activity realizations.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="PERPETUAL"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="perpetualExceptStatistics">
                <xsd:annotation>
                    <xsd:documentation>
                        The state should be preserved across activity realizations.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="PERPETUAL_EXCEPT_STATISTICS"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="singleRealization">
                <xsd:annotation>
                    <xsd:documentation>
                        The state should be preserved for single activity realizations.
                        This is the default.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="SINGLE_REALIZATION"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="ActivityTreeRealizationStateType">
        <xsd:annotation>
            <xsd:documentation>
                Realization state of an activity tree.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.4</a:since>
                <a:experimental>true</a:experimental>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="inPreparation">
                <xsd:annotation>
                    <xsd:documentation>
                        Realization of activity tree is being prepared. For example, state stored during
                        the previous realization is being deleted.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="IN_PREPARATION"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="inProgress">
                <xsd:annotation>
                    <xsd:documentation>
                        Activity tree realization is in progress.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="IN_PROGRESS"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="complete">
                <xsd:annotation>
                    <xsd:documentation>
                        Activity tree realization is complete.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="COMPLETE"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="TaskRoleType">
        <xsd:annotation>
            <xsd:documentation>
                Role of the task in the execution of the local root activity.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="delegate">
                <xsd:annotation>
                    <xsd:documentation>
                        The activity execution was fully delegated to the current task.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="DELEGATE"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="worker">
                <xsd:annotation>
                    <xsd:documentation>
                        The activity execution was distributed to a set of workers, and this is one of them.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="WORKER"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="ActivityTaskExecutionStateType">
        <xsd:annotation>
            <xsd:documentation>
                Execution state of an activity task - to be used in activity overview.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="running">
                <xsd:annotation>
                    <xsd:documentation>
                        Activity in the task is running. (Or stalled.)
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="RUNNING"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="notRunning">
                <xsd:annotation>
                    <xsd:documentation>
                        Activity in the task is not running. (Might be complete or just interrupted.)
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="NOT_RUNNING"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="ActivitySimplifiedRealizationStateType">
        <xsd:annotation>
            <xsd:documentation>
                Realization state of an activity - simplified for the sake of activity overview.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="inProgress">
                <xsd:annotation>
                    <xsd:documentation>
                        Activity is in progress.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="IN_PROGRESS"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="complete">
                <xsd:annotation>
                    <xsd:documentation>
                        Activity is complete.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="COMPLETE"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:complexType name="ActivityBucketingStateType">
        <xsd:annotation>
            <xsd:documentation>
                Information about the bucket processing within an activity. It is present in both coordinator/standalone tasks
                ("buckets-holding" for short) and worker tasks.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="bucket" type="tns:WorkBucketType">
                <xsd:annotation>
                    <xsd:documentation>
                        Current buckets of work.

                        Some buckets might be present implicitly: if a bucket with sequence number of N is present,
                        it is expected that all unlisted buckets with numbers lower than N are complete.
                        In a similar way, if no free bucket is available and we are not at the end it is expected that some
                        free buckets are yet to be created.

                        Present only in buckets-holding tasks (coordinator or standalone).
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="numberOfBuckets" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        How many buckets are there? This is an indicative information, e.g. to be used when
                        estimating total progress. Present only in buckets-holding tasks.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="bucketsProcessingRole" type="tns:BucketsProcessingRoleType">
                <xsd:annotation>
                    <xsd:documentation>
                        Role of this task in the processing of the buckets: standalone executor, coordinator, or worker.
                        (This is somewhat duplicate to TaskActivityStateType.role but has slightly different meaning, so
                        we keep it here.)
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="scavenging" type="xsd:boolean">
                <xsd:annotation>
                    <xsd:documentation>
                        Are we in the scavenging phase? Present only in buckets-holding tasks,
                        relevant only in coordinator-workers scenarios.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="scavenger" type="xsd:boolean">
                <xsd:annotation>
                    <xsd:documentation>
                        Is this task a scavenger i.e. will it wait until the work is done, looking
                        for buckets that could be reclaimed? Present only in worker tasks.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="workComplete" type="xsd:boolean">
                <xsd:annotation>
                    <xsd:documentation>
                        True if all the work is complete: there are no more buckets to be processed.
                        Present only in buckets-holding tasks.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="abortingWorkerRef" type="tns:ObjectReferenceType">
                <xsd:annotation>
                    <xsd:documentation>
                        Worker that aborted the work. This signals that any work in progress in other workers should be cancelled.
                        The activity will not be resumed, only restarted (if appropriate).
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:since>4.10</a:since>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>

    <xsd:complexType name="ActivityDistributionDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Describes how we are going to distribute the work that is to be done:
                how to divide it into work buckets, and how to distribute these buckets to worker tasks.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>3.8</a:since>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="buckets" type="tns:BucketsDefinitionType">
                <xsd:annotation>
                    <xsd:documentation>
                        How to create and manage buckets.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="workers" type="tns:WorkersDefinitionType">
                <xsd:annotation>
                    <xsd:documentation>
                        How to create and manage workers.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="workerThreads" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        TODO
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:since>4.4</a:since>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="subtask" type="tns:ActivitySubtaskDefinitionType">
                <xsd:annotation>
                    <xsd:documentation>
                        How is the activity executed in separate subtask(s).
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="subtasks" type="tns:ActivitySubtaskDefinitionType">
                <xsd:annotation>
                    <xsd:documentation>
                        How are the activities executed in separate subtask(s). This is actually a shortcut for tailoring
                        the sub-activities: it does not apply to the activity itself, but to its children. TODO reconsider.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="autoScaling" type="tns:AutoScalingDefinitionType">
                <xsd:annotation>
                    <xsd:documentation>
                        Whether and how is this activity work distribution auto-scaled.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>

    <xsd:complexType name="BucketsDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Defines how buckets should be created.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>3.8</a:since>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:choice>
                <xsd:element minOccurs="0" name="numericSegmentation" type="tns:NumericWorkSegmentationType">
                    <xsd:annotation>
                        <xsd:documentation>
                            How to partition the work into numeric interval based buckets and manage them.
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="stringSegmentation" type="tns:StringWorkSegmentationType">
                    <xsd:annotation>
                        <xsd:documentation>
                            How to partition the work into string value based buckets and manage them.
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="oidSegmentation" type="tns:OidWorkSegmentationType">
                    <xsd:annotation>
                        <xsd:documentation>
                            How to partition the work into string value based buckets and manage them.
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="explicitSegmentation" type="tns:ExplicitWorkSegmentationType">
                    <xsd:annotation>
                        <xsd:documentation>
                            How to partition the work into filter based buckets and manage them.
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="implicitSegmentation" type="tns:ImplicitWorkSegmentationType">
                    <xsd:annotation>
                        <xsd:documentation>
                            Uses segmentation that is implicit for given kind of activity.
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="segmentation" type="tns:AbstractWorkSegmentationType">
                    <xsd:annotation>
                        <xsd:documentation>
                            How to partition the work into buckets and manage them.
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
            </xsd:choice>
            <xsd:element minOccurs="0" name="allocation" type="tns:WorkAllocationDefinitionType">
                <xsd:annotation>
                    <xsd:documentation>
                        Parameters related to buckets allocation process.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="sampling" type="tns:BucketsSamplingDefinitionType">
                <xsd:annotation>
                    <xsd:documentation>
                        If set, we process only a sample of all buckets.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>

    <xsd:complexType name="BucketsSamplingDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Defines the sampling of buckets.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.4</a:since>
                <a:container>true</a:container>
                <a:experimental>true</a:experimental>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:choice>
                <xsd:element minOccurs="0" name="regular" type="tns:RegularBucketsSamplingDefinitionType">
                    <xsd:annotation>
                        <xsd:documentation>
                            Sampling using regular distribution of samples.
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="random" type="tns:RandomBucketsSamplingDefinitionType">
                    <xsd:annotation>
                        <xsd:documentation>
                            Sampling using random distribution of samples.
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
            </xsd:choice>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>

    <xsd:complexType name="RegularBucketsSamplingDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Sampling using regular distribution of samples.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.4</a:since>
                <a:container>true</a:container>
                <a:experimental>true</a:experimental>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:choice>
                <xsd:element minOccurs="0" name="interval" type="xsd:int">
                    <xsd:annotation>
                        <xsd:documentation>
                            Interval of buckets in the sample (i.e. N means that each N-th bucket is selected).
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="sampleSize" type="xsd:int">
                    <xsd:annotation>
                        <xsd:documentation>
                            Number of buckets in the sample. It is converted to an interval
                            by dividing the the total number of buckets (if known) by the sample size.
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
            </xsd:choice>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>

    <xsd:complexType name="RandomBucketsSamplingDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Sampling using random distribution of samples.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.4</a:since>
                <a:container>true</a:container>
                <a:experimental>true</a:experimental>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:choice>
                <xsd:element minOccurs="0" name="probability" type="xsd:double">
                    <xsd:annotation>
                        <xsd:documentation>
                            Probability of including a bucket in the sample (a number between 0 and 1).
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="sampleSize" type="xsd:int">
                    <xsd:annotation>
                        <xsd:documentation>
                            Approximate number of buckets in the sample. It is converted to a probability
                            by dividing the sample size by the total number of buckets (if known).
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
            </xsd:choice>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>

    <xsd:complexType name="WorkAllocationDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Parameters related to buckets allocation process.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>3.8</a:since>
                <a:container>true</a:container>
                <a:schemaMigration>
                    <a:element>tns:allocateFirst</a:element>
                    <a:version>4.4</a:version>
                    <a:operation>removed</a:operation>
                </a:schemaMigration>
                <a:schemaMigration>
                    <a:element>tns:workAllocationMaxRetries</a:element>
                    <a:version>4.4</a:version>
                    <a:operation>removed</a:operation>
                </a:schemaMigration>
                <a:schemaMigration>
                    <a:element>tns:workAllocationRetryIntervalBase</a:element>
                    <a:version>4.4</a:version>
                    <a:operation>removed</a:operation>
                </a:schemaMigration>
                <a:schemaMigration>
                    <a:element>tns:workAllocationRetryExponentialThreshold</a:element>
                    <a:version>4.4</a:version>
                    <a:operation>removed</a:operation>
                </a:schemaMigration>
                <a:schemaMigration>
                    <a:element>tns:workAllocationRetryIntervalLimit</a:element>
                    <a:version>4.4</a:version>
                    <a:operation>removed</a:operation>
                </a:schemaMigration>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element default="1" minOccurs="0" name="bucketCreationBatch" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        How many buckets are to be created at once (when needed)?
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="workAllocationInitialDelay" type="xsd:long">
                <xsd:annotation>
                    <xsd:documentation>
                        Size of random interval for the initial delay.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="workAllocationFreeBucketWaitInterval" type="xsd:long">
                <xsd:annotation>
                    <xsd:documentation>
                        If specified, overrides the time used to wait for free bucket(s) reclamation. This is applied when
                        no free buckets are available but the work is not completely done.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>

    <xsd:complexType name="AbstractWorkSegmentationType">
        <xsd:annotation>
            <xsd:documentation>
                Describes how to segment the work into buckets and manage them.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>3.8</a:since>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="discriminator" type="t:ItemPathType">
                <xsd:annotation>
                    <xsd:documentation>
                        Item or OID whose values will used to divide objects into buckets - if applicable.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="matchingRule" type="xsd:anyURI">
                <xsd:annotation>
                    <xsd:documentation>
                        Matching rule to be applied when creating filters - if applicable.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="numberOfBuckets" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        Configurable number of buckets. Optional.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>

    <xsd:complexType name="NumericWorkSegmentationType">
        <xsd:annotation>
            <xsd:documentation>
                Segmentation strategy that divides the processing space (represented by an interval of numeric
                values) into a number of work buckets. Each bucket itself is defined as an interval of values.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>3.8</a:since>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractWorkSegmentationType">
                <xsd:sequence>
                    <xsd:element minOccurs="0" name="from" type="xsd:integer">
                        <xsd:annotation>
                            <xsd:documentation>
                                Start of the processing space (inclusive). If omitted, 0 is assumed.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="to" type="xsd:integer">
                        <xsd:annotation>
                            <xsd:documentation>
                                End of the processing space (exclusive). If not present, both bucketSize and numberOfBuckets
                                must be defined and the upper boundary is determined as their product.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="bucketSize" type="xsd:integer">
                        <xsd:annotation>
                            <xsd:documentation>
                                Size of one bucket. If not present it is computed as the total processing space divided by
                                number of buckets (i.e. 'to' and 'numberOfBuckets' must be present).
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:complexType name="StringWorkSegmentationType">
        <xsd:annotation>
            <xsd:documentation>
                Segmentation strategy that divides the processing space (represented by a set of string
                values) into a number of work buckets; either based on intervals, prefixes or exact value matching.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>3.8</a:since>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractWorkSegmentationType">
                <xsd:sequence>
                    <xsd:element maxOccurs="unbounded" minOccurs="0" name="boundary" type="tns:BoundarySpecificationType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Characters that make up the boundaries at given string position(s).
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:since>4.3</a:since>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element maxOccurs="unbounded" minOccurs="0" name="boundaryCharacters" type="xsd:string">
                        <xsd:annotation>
                            <xsd:documentation>
                                Characters that make up the boundaries. These characters must be sorted.
                                Reserved characters: '-', '$' (to be implemented later)
                                Escaping character: '\'

                                DEPRECATED. Please use boundary instead.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:removed>true</a:removed>
                                <a:deprecatedSince>4.3</a:deprecatedSince>
                                <a:removedSince>4.8</a:removedSince>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element default="1" minOccurs="0" name="depth" type="xsd:int">
                        <xsd:annotation>
                            <xsd:documentation>
                                If a value N greater than 1 is specified here, values specified by boundary or boundaryCharacters
                                are repeated N times (if values of V1, V2, ..., Vk are specified, the resulting sequence
                                is V1, V2, ..., Vk, V1, V2, ... Vk, etc, with N repetitions - so N*k values in total).
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="comparisonMethod" type="tns:StringWorkBucketsBoundaryMarkingType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Whether to use intervals, prefixes or exact value match. Interval matching is the default.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:complexType name="BoundarySpecificationType">
        <xsd:annotation>
            <xsd:documentation>
                Specification of how string-based segments are delineated.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.3</a:since>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="position" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        Position(s) to which the boundary characters apply.

                        Should be specified, because (1) the ordering of boundary specifications is undefined,
                        (2) multiple definitions of the same boundary characters is not possible.

                        Starts at 1.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="characters" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        Characters that make up the boundaries. These characters must be sorted.
                        Reserved characters: '-', '$' (to be implemented later)
                        Escaping character: '\'
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>
    <xsd:element name="boundarySpecification" type="tns:BoundarySpecificationType"/>

    <xsd:complexType name="OidWorkSegmentationType">
        <xsd:annotation>
            <xsd:documentation>
                Segmentation strategy that divides the processing space into a number of buckets based on OID values.
                When specified, it provides default values of discriminator=#, boundaryCharacters=0-9a-f.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>3.8</a:since>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:StringWorkSegmentationType">
                <xsd:sequence>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:simpleType name="StringWorkBucketsBoundaryMarkingType">
        <xsd:annotation>
            <xsd:documentation>
                How to construct work bucket filters based on defined boundary values.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>3.8</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="interval">
                <xsd:annotation>
                    <xsd:documentation>
                        Use greater-than/less-than comparison.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="INTERVAL"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="prefix">
                <xsd:annotation>
                    <xsd:documentation>
                        Use prefix matching.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="PREFIX"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="exactMatch">
                <xsd:annotation>
                    <xsd:documentation>
                        Use exact value matching. This is quite risky and should be used only when you are absolutely sure that
                        boundary values cover all possible values of the discriminator.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="EXACT_MATCH"/>
                        <a:since>4.0</a:since>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:complexType name="ExplicitWorkSegmentationType">
        <xsd:annotation>
            <xsd:documentation>
                Segmentation strategy that explicitly enumerates the buckets.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>3.8</a:since>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractWorkSegmentationType">
                <xsd:sequence>
                    <xsd:element maxOccurs="unbounded" minOccurs="0" name="content" type="tns:AbstractWorkBucketContentType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Work buckets content.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:complexType name="ImplicitWorkSegmentationType">
        <xsd:annotation>
            <xsd:documentation>
                A segmentation strategy that is interpreted by the specific activity run. It usually needs to contain
                only the number of buckets. The boundaries are determined automatically, e.g. for event report export
                activity.

                Currently supported only by a couple of activities: event report export, no-op.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.4</a:since>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractWorkSegmentationType">
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:complexType name="WorkBucketType">
        <xsd:annotation>
            <xsd:documentation>
                Description of a state and content of a work bucket. Buckets are used e.g. to distribute workload
                in multi-node tasks or to implement stateful suspend+resume.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>3.8</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element name="sequentialNumber" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        Sequential number of given work bucket. Starting at 1.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element name="state" type="tns:WorkBucketStateType">
                <xsd:annotation>
                    <xsd:documentation>
                        State of the work bucket: ready, delegated or complete.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element name="content" type="tns:AbstractWorkBucketContentType">
                <xsd:annotation>
                    <xsd:documentation>
                        Content of the bucket described e.g. as a numeric interval of discriminator values.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="workerRef" type="tns:ObjectReferenceType">
                <xsd:annotation>
                    <xsd:documentation>
                        Worker task to which this bucket is delegated.
                        Must be set for buckets in DELEGATED state.
                        May be set for buckets in COMPLETE state.
                        Must not be set for buckets in READY state.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:objectReferenceTargetType>tns:TaskType</a:objectReferenceTargetType>
                        <a:since>4.0</a:since>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>

    <xsd:complexType name="AbstractWorkBucketContentType">
        <xsd:annotation>
            <xsd:documentation>
                Abstract supertype for description of bucket contents.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>3.8</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="NumericIntervalWorkBucketContentType">
        <xsd:annotation>
            <xsd:documentation>
                Work bucket content defined as an interval of numeric values of discriminator item.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>3.8</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractWorkBucketContentType">
                <xsd:sequence>
                    <xsd:element minOccurs="0" name="from" type="xsd:integer">
                        <xsd:annotation>
                            <xsd:documentation>
                                Start of the processing space belonging to this bucket (inclusive). If not present, 0 is assumed.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="to" type="xsd:integer">
                        <xsd:annotation>
                            <xsd:documentation>
                                End of the processing space belonging to this bucket (exclusive). If not present, it is assumed
                                that this is the last bucket.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:complexType name="StringPrefixWorkBucketContentType">
        <xsd:annotation>
            <xsd:documentation>
                Work bucket content defined using string value prefix.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>3.8</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractWorkBucketContentType">
                <xsd:sequence>
                    <xsd:element maxOccurs="unbounded" minOccurs="0" name="prefix" type="xsd:string">
                        <xsd:annotation>
                            <xsd:documentation>
                                Prefix(es) that are part of this bucket.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <!-- Currently the same content as StringPrefixWorkBucketContentType but let's keep these separate fro conceptual
         as well as for practical reasons (the latter ones being mainly backwards compatibility). -->
    <xsd:complexType name="StringValueWorkBucketContentType">
        <xsd:annotation>
            <xsd:documentation>
                Work bucket content defined using string value.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.0</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractWorkBucketContentType">
                <xsd:sequence>
                    <xsd:element maxOccurs="unbounded" minOccurs="0" name="value" type="xsd:string">
                        <xsd:annotation>
                            <xsd:documentation>
                                Value(s) that are part of this bucket.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:complexType name="StringIntervalWorkBucketContentType">
        <xsd:annotation>
            <xsd:documentation>
                Work bucket content defined as interval of string values.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>3.8</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractWorkBucketContentType">
                <xsd:sequence>
                    <xsd:element minOccurs="0" name="from" type="xsd:string">
                        <xsd:annotation>
                            <xsd:documentation>
                                Start of the processing space belonging to this bucket (inclusive). If not present, empty string is assumed.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="to" type="xsd:string">
                        <xsd:annotation>
                            <xsd:documentation>
                                End of the processing space belonging to this bucket (exclusive). If not present, it is assumed
                                that this is the last bucket.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:complexType name="FilterWorkBucketContentType">
        <xsd:annotation>
            <xsd:documentation>
                Work bucket content defined explicitly by a filter.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>3.8</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractWorkBucketContentType">
                <xsd:sequence>
                    <xsd:element maxOccurs="unbounded" minOccurs="0" ref="q:filter">
                        <xsd:annotation>
                            <xsd:documentation>
                                Filter(s) to be used to define the bucket.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:complexType name="NullWorkBucketContentType">
        <xsd:annotation>
            <xsd:documentation>
                "Null" work bucket content: does not restrict the query in any way.
                Used when no bucketing configuration is specified. In that case, a single "null" bucket is created.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractWorkBucketContentType">
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:simpleType name="BucketsProcessingRoleType">
        <xsd:annotation>
            <xsd:documentation>
                Role in the work buckets processing.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="standalone">
                <xsd:annotation>
                    <xsd:documentation>
                        The task is standalone: it executes all the work itself (single- or multi-threaded).
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="STANDALONE"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="coordinator">
                <xsd:annotation>
                    <xsd:documentation>
                        The task is a coordinator task in a multi-node execution.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="COORDINATOR"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="worker">
                <xsd:annotation>
                    <xsd:documentation>
                        The task is a worker task in a multi-node execution.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="WORKER"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="WorkBucketStateType">
        <xsd:annotation>
            <xsd:documentation>
                State of the work bucket.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>3.8</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="ready">
                <xsd:annotation>
                    <xsd:documentation>
                        The bucket is ready to be delegated (when in coordinator) or to be directly processed (when in worker
                        or standalone task).
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="READY"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="delegated">
                <xsd:annotation>
                    <xsd:documentation>
                        The bucket has been delegated for processing by a worker task. (May occur in coordinator only.)
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="DELEGATED"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="complete">
                <xsd:annotation>
                    <xsd:documentation>
                        The bucket has been processed.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="COMPLETE"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:complexType name="NodeType">
        <xsd:annotation>
            <xsd:documentation>
                Node describes a single installation of midPoint. MidPoint installations can work in cluster.
                The Node objects are the way how the nodes in cluster know about each other.
            </xsd:documentation>
            <xsd:appinfo>
                <a:schemaMigration>
                    <a:element>tns:operationalStatus</a:element>
                    <a:version>4.4</a:version>
                    <a:operation>moved</a:operation>
                    <a:replacement>tns:operationalState</a:replacement>
                </a:schemaMigration>
                <a:schemaMigration>
                    <a:element>tns:running</a:element>
                    <a:version>4.4</a:version>
                    <a:operation>removed</a:operation>
                </a:schemaMigration>
                <a:schemaMigration>
                    <a:element>tns:jmxPort</a:element>
                    <a:version>4.4</a:version>
                    <a:operation>removed</a:operation>
                </a:schemaMigration>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AssignmentHolderType">
                <xsd:sequence>
                    <xsd:element minOccurs="0" name="nodeIdentifier" type="xsd:string">
                        <xsd:annotation>
                            <xsd:documentation>
                                Short, cluster-wide identifier of the node. It may be a hostname, a number, or a short string.
                                It should be short as it is used e.g. in audit records. Its use is planned also
                                for lightweight IDs.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="hostname" type="xsd:string">
                        <xsd:annotation>
                            <xsd:documentation>
                                Hostname of the node that can be used by other nodes to contact this node over the
                                network. It is automatically determined and updated.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="url" type="xsd:string">
                        <xsd:annotation>
                            <xsd:documentation>
                                URL of midPoint that can be used by other nodes to contact this node over the network.
                                It is either provided manually (see urlOverride), constructed using
                                infrastructure/intraClusterHttpUrlPattern configuration property, or determined
                                automatically.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:since>3.9</a:since>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="urlOverride" type="xsd:string">
                        <xsd:annotation>
                            <xsd:documentation>
                                Value to override constructed or determined URL.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:since>4.0</a:since>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element maxOccurs="unbounded" minOccurs="0" name="ipAddress" type="xsd:string">
                        <xsd:annotation>
                            <xsd:documentation>
                                IP addresses of the node (both IPv4 and IPv6 addresses in textual notation).
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="lastCheckInTime" type="xsd:dateTime">
                        <xsd:annotation>
                            <xsd:documentation>
                                The time when this node last checked-in.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <!-- We could consider adding "administrativeState" (status?) to allow nodes being permanently off.
                    Just a safeguard for mistakenly turning the node on. But it's probably not much needed now. -->
                    <xsd:element minOccurs="0" name="operationalState" type="tns:NodeOperationalStateType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Basic node operational state: whether it is up (e.g. should be accepting REST queries),
                                or it is down (known to be turned off or just not checking-in for a longer time), or starting.
                                Does NOT indicate anything about the scheduler status.

                                Supersedes "running" property. Renamed from "operationalStatus" property in 4.4.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:since>4.1</a:since>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <!-- We could add "schedulerState" property with two possible meanings: either 1) current state
                    of the Quartz scheduler (on/off), or 2) intended state of the scheduler. In the latter case we could
                    skip creating worker tasks for such node. But let us wait until it's really needed. -->
                    <xsd:element minOccurs="0" name="clustered" type="xsd:boolean">
                        <xsd:annotation>
                            <xsd:documentation>
                                Whether this node is a part of a cluster. Used to detect misconfigurations.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="internalNodeIdentifier" type="xsd:string">
                        <xsd:annotation>
                            <xsd:documentation>
                                Internal (generated) node identifier, used primarily to detect whether
                                the node information was not overwritten by another node.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="executionState" type="tns:NodeExecutionStateType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Actual node state from the point of executing tasks.
                                This field is TRANSIENT. It must only be used in runtime. It should
                                never be stored in the repository.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="errorState" type="tns:NodeErrorStateType">
                        <xsd:annotation>
                            <xsd:documentation>
                                More detailed characterization of the error state.
                                This field is TRANSIENT. It must only be used in runtime. It should
                                never be stored in the repository.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="connectionResult" type="tns:OperationResultType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Result of the operation that connected to this node.
                                This field is TRANSIENT. It must only be used in runtime. It should
                                never be stored in the repository.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="build" type="tns:BuildInformationType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Information about midPoint build running on this node.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="secret" type="t:ProtectedStringType">
                        <xsd:annotation>
                            <xsd:documentation>
                                The secret used for intra-cluster authentication.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:since>4.0</a:since>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="secretUpdateTimestamp" type="xsd:dateTime">
                        <xsd:annotation>
                            <xsd:documentation>
                                When was the secret created or last changed.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:since>4.0</a:since>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="taskExecutionLimitations" type="tns:TaskExecutionLimitationsType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Limitations for execution of tasks on this node.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:since>3.7</a:since>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="node" substitutionGroup="c:object" type="tns:NodeType"/>

    <xsd:complexType name="TaskExecutionLimitationsType">
        <xsd:annotation>
            <xsd:documentation>
                Limitations for execution of tasks on a given node.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>3.7</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="groupLimitation" type="tns:TaskGroupExecutionLimitationType">
                <xsd:annotation>
                    <xsd:documentation>
                        Limitations of execution for individual task groups.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="TaskGroupExecutionLimitationType">
        <xsd:annotation>
            <xsd:documentation>
                Limitations for execution of a task group on a given node.
                (Will probably change in the future, when task groups will be created as regular midPoint objects.)
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>3.7</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="groupName" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        Name of the group to apply limitation to. Null or empty means "tasks with no specified group". Asterisk (*) means
                        that the limit applies to each groups not listed here (individually).
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="limit" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        How many threads can be allocated to tasks within the given group. 0 means such tasks cannot be run
                        on the current node. Null (i.e. no "limit" property) means this group can run on this node without
                        explicit limitations; bound only by the total number of available threads.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:simpleType name="NodeOperationalStateType">
        <xsd:annotation>
            <xsd:documentation>
                Basic node operational state: whether it is up (e.g. accepting REST queries),
                or it is down (known to be turned off or just not checking-in for a longer time), or starting.
                Does NOT indicate anything about the scheduler state.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="up">
                <xsd:annotation>
                    <xsd:documentation>
                        Node is up and should respond to REST queries.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="UP"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="down">
                <xsd:annotation>
                    <xsd:documentation>
                        Node is down. Either it was turned off or it has not checked in for a longer time.
                        There's no point in trying to contact it via REST.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="DOWN"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="starting">
                <xsd:annotation>
                    <xsd:documentation>
                        Node is starting. It is expected it will be alive soon but should not be contacted via REST yet.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="STARTING"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="NodeExecutionStateType">
        <xsd:annotation>
            <xsd:documentation>
                Node state from the user's point of view.
                TODO decide what to do with this data type.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="running">
                <xsd:annotation>
                    <xsd:documentation>
                        Node is running, task scheduler is running.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="RUNNING"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="paused">
                <xsd:annotation>
                    <xsd:documentation>
                        Node is running, scheduler is paused.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="PAUSED"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="notCheckingIn">
                <xsd:annotation>
                    <xsd:documentation>
                        Node has not checked in for at least "nodeTimeout" seconds (default is 30).
                        But it has not declared itself as turned off.

                        Note that other nodes can declare a node as turned off after not checking in for
                        "nodeAlivenessTimeout" seconds (default is 900).

                        This state is available only for remote nodes, of course.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="NOT_CHECKING_IN"/>
                        <a:since>4.1</a:since>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="starting">
                <xsd:annotation>
                    <xsd:documentation>
                        Node is starting. It is expected it will be alive soon but should not be contacted via REST yet.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="STARTING"/>
                        <a:since>4.1</a:since>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="down">
                <xsd:annotation>
                    <xsd:documentation>
                        Node is turned off (its "running" flag is set to false). It either declares itself to be in this state
                        when going down, or other nodes can do it after it does not check in for "nodeAlivenessTimeout" seconds
                        (default is 900).
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="DOWN"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="error">
                <xsd:annotation>
                    <xsd:documentation>
                        Node error (see NodeErrorStateType for more details).
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="ERROR"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="communicationError">
                <xsd:annotation>
                    <xsd:documentation>
                        State unknown due to communication error.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="COMMUNICATION_ERROR"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="NodeErrorStateType">
        <xsd:annotation>
            <xsd:documentation>
                State of this node w.r.t. error conditions.
                Generally speaking, if node errorState != OK, tasks cannot be scheduled on this node.
                This is a dynamic information, not stored in the repository.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="ok">
                <xsd:annotation>
                    <xsd:documentation>
                        Everything is OK.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="OK"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="duplicateNodeIdOrName">
                <xsd:annotation>
                    <xsd:documentation>
                        More nodes with the same ID or name (currently ID is the same as name, but in the future they might be different).
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="DUPLICATE_NODE_ID_OR_NAME"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="nonClusteredNodeWithOthers">
                <xsd:annotation>
                    <xsd:documentation>
                        A non-clustered node runs along other (clustered or non-clustered) nodes.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="NON_CLUSTERED_NODE_WITH_OTHERS"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="localConfigurationError">
                <xsd:annotation>
                    <xsd:documentation>
                        Local task manager is not configured properly, so it cannot even be started.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="LOCAL_CONFIGURATION_ERROR"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="localInitializationError">
                <xsd:annotation>
                    <xsd:documentation>
                        Other kind of initialization error.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="LOCAL_INITIALIZATION_ERROR"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="nodeRegistrationFailed">
                <xsd:annotation>
                    <xsd:documentation>
                        It was not possible to register node in repository due to a permanent error.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="NODE_REGISTRATION_FAILED"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:complexType name="EnvironmentalPerformanceInformationType">
        <xsd:annotation>
            <xsd:documentation>
                Statistics related to performance and state of external environment, namely provisioning via connectors,
                mappings (as these might contain code that invokes external systems), and notifications.

                These are meant to diagnose performance problems that could stem from factors that are outside midPoint.

                LastMessage can be used to diagnose seemingly "frozen" midPoint that waits e.g. for completion of an external operation.
                These messages contain information about start and end of external calls: ICF operations, mappings invocation, notification
                invocation.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="provisioningStatistics" type="tns:ProvisioningStatisticsType"/>
            <xsd:element minOccurs="0" name="mappingsStatistics" type="tns:MappingsStatisticsType"/>
            <xsd:element minOccurs="0" name="notificationsStatistics" type="tns:NotificationsStatisticsType"/>
            <xsd:element minOccurs="0" name="lastMessageTimestamp" type="xsd:dateTime"/>
            <xsd:element minOccurs="0" name="lastMessage" type="xsd:string"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="ProvisioningStatisticsType">
        <xsd:annotation>
            <xsd:documentation>
                Statistical information on operations executed on resources.
                It is meant to help diagnose performance problems induced by specific source or target resources.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="entry" type="tns:ProvisioningStatisticsEntryType">
                <xsd:annotation>
                    <xsd:documentation>
                        Entries related to individual resources and their object classes.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="ProvisioningStatisticsEntryType">
        <xsd:annotation>
            <xsd:documentation>
                Statistical information on operations executed on a specified resource, dealing with given object class.
            </xsd:documentation>
            <xsd:appinfo>
                <a:schemaMigration>
                    <a:element>tns:resource</a:element>
                    <a:version>4.4</a:version>
                    <a:operation>removed</a:operation>
                </a:schemaMigration>
                <a:schemaMigration>
                    <a:element>tns:getSuccess</a:element>
                    <a:version>4.4</a:version>
                    <a:operation>removed</a:operation>
                </a:schemaMigration>
                <a:schemaMigration>
                    <a:element>tns:getFailure</a:element>
                    <a:version>4.4</a:version>
                    <a:operation>removed</a:operation>
                </a:schemaMigration>
                <a:schemaMigration>
                    <a:element>tns:searchSuccess</a:element>
                    <a:version>4.4</a:version>
                    <a:operation>removed</a:operation>
                </a:schemaMigration>
                <a:schemaMigration>
                    <a:element>tns:searchFailure</a:element>
                    <a:version>4.4</a:version>
                    <a:operation>removed</a:operation>
                </a:schemaMigration>
                <a:schemaMigration>
                    <a:element>tns:createSuccess</a:element>
                    <a:version>4.4</a:version>
                    <a:operation>removed</a:operation>
                </a:schemaMigration>
                <a:schemaMigration>
                    <a:element>tns:createFailure</a:element>
                    <a:version>4.4</a:version>
                    <a:operation>removed</a:operation>
                </a:schemaMigration>
                <a:schemaMigration>
                    <a:element>tns:updateSuccess</a:element>
                    <a:version>4.4</a:version>
                    <a:operation>removed</a:operation>
                </a:schemaMigration>
                <a:schemaMigration>
                    <a:element>tns:updateFailure</a:element>
                    <a:version>4.4</a:version>
                    <a:operation>removed</a:operation>
                </a:schemaMigration>
                <a:schemaMigration>
                    <a:element>tns:deleteSuccess</a:element>
                    <a:version>4.4</a:version>
                    <a:operation>removed</a:operation>
                </a:schemaMigration>
                <a:schemaMigration>
                    <a:element>tns:deleteFailure</a:element>
                    <a:version>4.4</a:version>
                    <a:operation>removed</a:operation>
                </a:schemaMigration>
                <a:schemaMigration>
                    <a:element>tns:syncSuccess</a:element>
                    <a:version>4.4</a:version>
                    <a:operation>removed</a:operation>
                </a:schemaMigration>
                <a:schemaMigration>
                    <a:element>tns:syncFailure</a:element>
                    <a:version>4.4</a:version>
                    <a:operation>removed</a:operation>
                </a:schemaMigration>
                <a:schemaMigration>
                    <a:element>tns:scriptSuccess</a:element>
                    <a:version>4.4</a:version>
                    <a:operation>removed</a:operation>
                </a:schemaMigration>
                <a:schemaMigration>
                    <a:element>tns:scriptFailure</a:element>
                    <a:version>4.4</a:version>
                    <a:operation>removed</a:operation>
                </a:schemaMigration>
                <a:schemaMigration>
                    <a:element>tns:otherSuccess</a:element>
                    <a:version>4.4</a:version>
                    <a:operation>removed</a:operation>
                </a:schemaMigration>
                <a:schemaMigration>
                    <a:element>tns:otherFailure</a:element>
                    <a:version>4.4</a:version>
                    <a:operation>removed</a:operation>
                </a:schemaMigration>
                <a:schemaMigration>
                    <a:element>tns:averageTime</a:element>
                    <a:version>4.4</a:version>
                    <a:operation>removed</a:operation>
                </a:schemaMigration>
                <a:schemaMigration>
                    <a:element>tns:minTime</a:element>
                    <a:version>4.4</a:version>
                    <a:operation>removed</a:operation>
                </a:schemaMigration>
                <a:schemaMigration>
                    <a:element>tns:maxTime</a:element>
                    <a:version>4.4</a:version>
                    <a:operation>removed</a:operation>
                </a:schemaMigration>
                <a:schemaMigration>
                    <a:element>tns:totalTime</a:element>
                    <a:version>4.4</a:version>
                    <a:operation>removed</a:operation>
                </a:schemaMigration>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="resourceRef" type="tns:ObjectReferenceType">
                <xsd:annotation>
                    <xsd:documentation>
                        Reference to the resource. It should have name filled-in.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:objectReferenceTargetType>tns:ResourceType</a:objectReferenceTargetType>
                        <a:since>4.3</a:since>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="objectClass" type="xsd:QName"/>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="operation" type="tns:ProvisioningStatisticsOperationEntryType">
                <xsd:annotation>
                    <xsd:documentation>
                        Information on operations done on given resource and object class.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:since>4.3</a:since>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="ProvisioningStatisticsOperationEntryType">
        <xsd:annotation>
            <xsd:documentation>
                Information on operations of given type and result status.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.3</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="operation" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        Plain operation name, e.g. get, search, etc. Intentionally a free-form string, not an enum.
                        This may change in the future.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="status" type="tns:OperationResultStatusType">
                <xsd:annotation>
                    <xsd:documentation>
                        Operation result status. Should not be null.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="count" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        Number of operations of given type and status.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="totalTime" type="xsd:long">
                <xsd:annotation>
                    <xsd:documentation>
                        Total execution time of operations of given type and status (in milliseconds).
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="minTime" type="xsd:long">
                <xsd:annotation>
                    <xsd:documentation>
                        Minimal execution time of an operation of given type and status (in milliseconds).
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="maxTime" type="xsd:long">
                <xsd:annotation>
                    <xsd:documentation>
                        Maximal execution time of an operation of given type and status (in milliseconds).
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="MappingsStatisticsType">
        <xsd:annotation>
            <xsd:documentation>
                TODO
            </xsd:documentation>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="entry" type="tns:MappingsStatisticsEntryType"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="MappingsStatisticsEntryType">
        <xsd:annotation>
            <xsd:documentation>
                TODO
            </xsd:documentation>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="object" type="xsd:string"/>
            <xsd:element name="count" type="xsd:int"/>
            <xsd:element minOccurs="0" name="averageTime" type="xsd:long"/>
            <xsd:element minOccurs="0" name="minTime" type="xsd:long"/>
            <xsd:element minOccurs="0" name="maxTime" type="xsd:long"/>
            <xsd:element name="totalTime" type="xsd:long"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="NotificationsStatisticsType">
        <xsd:annotation>
            <xsd:documentation>
                TODO
            </xsd:documentation>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="entry" type="tns:NotificationsStatisticsEntryType"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="NotificationsStatisticsEntryType">
        <xsd:annotation>
            <xsd:documentation>
                TODO
            </xsd:documentation>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="transport" type="xsd:string"/>
            <xsd:element name="countSuccess" type="xsd:int"/>
            <xsd:element name="countFailure" type="xsd:int"/>
            <xsd:element minOccurs="0" name="averageTime" type="xsd:long"/>
            <xsd:element minOccurs="0" name="minTime" type="xsd:long"/>
            <xsd:element minOccurs="0" name="maxTime" type="xsd:long"/>
            <xsd:element name="totalTime" type="xsd:long"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="ActivityItemProcessingStatisticsType">
        <xsd:annotation>
            <xsd:documentation>
                Information about item processing in given activity.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="processed" type="tns:ProcessedItemSetType">
                <xsd:annotation>
                    <xsd:documentation>
                        Items that have been processed, with a given outcome.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="current" type="tns:ProcessedItemType">
                <xsd:annotation>
                    <xsd:documentation>
                        Items that are currently being processed by the task.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="run" type="tns:ActivityRunRecordType">
                <xsd:annotation>
                    <xsd:documentation>
                        Information about individual activity runs. Needed e.g. to compute real throughput.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>

    <xsd:complexType name="ActivityRunRecordType">
        <xsd:annotation>
            <xsd:documentation>
                Information about individual activity run. Needed e.g. to compute real throughput.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.3</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="startTimestamp" type="xsd:dateTime">
                <xsd:annotation>
                    <xsd:documentation>
                        When the run started.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="endTimestamp" type="xsd:dateTime">
                <xsd:annotation>
                    <xsd:documentation>
                        When the run ended (or current time, in order to avoid information loss).
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>

    <xsd:complexType name="ProcessedItemSetType">
        <xsd:annotation>
            <xsd:documentation>
                Describes set of items that are or have been processed.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.3</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:OutcomeKeyedCounterType">
                <xsd:sequence>
                    <!-- outcome and count are inherited -->
                    <xsd:element minOccurs="0" name="duration" type="xsd:double">
                        <xsd:annotation>
                            <xsd:documentation>
                                Total time spent while processing items in this set (in milliseconds).
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="lastItem" type="tns:ProcessedItemType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Last item in this set.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:complexType name="ProcessedItemType">
        <xsd:annotation>
            <xsd:documentation>
                Describes an item (typically an object) that is or has been processed.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.3</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="name" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        Name of an item. Typically the object name.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="displayName" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        Display name of an item. For example, user name, org display name, and so on.
                        Null if not present or not applicable for given item type.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="type" type="xsd:QName">
                <xsd:annotation>
                    <xsd:documentation>
                        Related object type. For example, c:UserType or c:ShadowType.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="oid" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        Related object OID, if known.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="startTimestamp" type="xsd:dateTime">
                <xsd:annotation>
                    <xsd:documentation>
                        When the processing of the item started.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="endTimestamp" type="xsd:dateTime">
                <xsd:annotation>
                    <xsd:documentation>
                        When the processing of the item finished. Null if the processing has not finished yet.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="message" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        Message describing the processing. Typically here is the exception message for failed items.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="operationId" type="xsd:long">
                <xsd:annotation>
                    <xsd:documentation>
                        Internal operation identifier. Has no meaning outside midPoint internal structures.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>

    <xsd:complexType name="ActivitySynchronizationStatisticsType">
        <xsd:annotation>
            <xsd:documentation>
                Information about synchronization situations of objects processed by synchronization-related tasks:
                live sync, import, reconciliation.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="transition" type="tns:SynchronizationSituationTransitionType"/>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>

    <xsd:complexType name="SynchronizationSituationTransitionType">
        <xsd:annotation>
            <xsd:documentation>
                Describes how many times given synchronization situation transition has occurred.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.3</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="onProcessingStart" type="tns:SynchronizationSituationType"/>
            <xsd:element minOccurs="0" name="onSynchronizationStart" type="tns:SynchronizationSituationType"/>
            <xsd:element minOccurs="0" name="onSynchronizationEnd" type="tns:SynchronizationSituationType"/>
            <xsd:element minOccurs="0" name="exclusionReason" type="tns:SynchronizationExclusionReasonType"/>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="counter" type="tns:OutcomeKeyedCounterType"/>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>
    <xsd:element name="synchronizationSituationTransition" type="tns:SynchronizationSituationTransitionType"/>

    <xsd:complexType name="ActivityActionsExecutedType">
        <xsd:annotation>
            <xsd:documentation>
                Shows what actions were executed. Currently there are only basic actions (ADD, MODIFY, DELETE) carried out on
                basic categories of objects (object types, e.g. UserType, RoleType, OrgType, ShadowType, ...).

                This gives a quick overview what e.g. import, livesync or reconciliation task is really doing.
                For example, if it really creates new users, or if it deletes anything, etc.

                Two categories of statistics are described: "all" and "resulting".
                The former describes all operations carried out, whereas the latter describes only the "high-level" or "externally visible" ones.
                An example: if a live sync task detects a new resource objects, creates appropriate user, and modifies it twice (because of
                outbound/inbound/template/etc interplay), the "all" category would contain 1xADD and 2xMODIFY for that user. However,
                the "resulting" category shows what the external observer would expect - that 1 user was added (so, 1xADD).
                Note that the behavior of "resulting" action determination is still experimental, and need to be specified more
                precisely, e.g. with regards to operation failures.

                In future it would be nice to distinguish e.g. between shadows on different resources.

                Also, the semantics of operations on ShadowType should be defined more precisely - namely,
                whether an operation means "operation on repository shadow" or "operation on resource object".
                Currently, it means both of them. And some of the shadow related operations are not counted,
                namely those that are carried out autonomously by the provisioning module - e.g. creating repo
                shadows when resource objects are discovered. Also, displaying the result of operations that
                are handled by consistency mechanism is defined quite well.

                Overall, while counters related to focal objects (users, roles, orgs) are relatively well defined,
                counters related to shadows need some clarification.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="objectActionsEntry" type="tns:ObjectActionsExecutedEntryType"/>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="resultingObjectActionsEntry" type="tns:ObjectActionsExecutedEntryType"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="ObjectActionsExecutedEntryType">
        <xsd:annotation>
            <xsd:documentation>
                Actions executed on a given object type, with given operation (change type) and via given channel.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element name="objectType" type="xsd:QName"/>
            <xsd:element name="operation" type="t:ChangeTypeType"/>
            <xsd:element minOccurs="0" name="channel" type="xsd:string"/>
            <xsd:element name="totalSuccessCount" type="xsd:int"/>
            <xsd:element minOccurs="0" name="lastSuccessObjectName" type="xsd:string"/>
            <xsd:element minOccurs="0" name="lastSuccessObjectDisplayName" type="xsd:string"/>
            <xsd:element minOccurs="0" name="lastSuccessObjectOid" type="xsd:string"/>
            <xsd:element minOccurs="0" name="lastSuccessTimestamp" type="xsd:dateTime"/>
            <xsd:element name="totalFailureCount" type="xsd:int"/>
            <xsd:element minOccurs="0" name="lastFailureObjectName" type="xsd:string"/>
            <xsd:element minOccurs="0" name="lastFailureObjectDisplayName" type="xsd:string"/>
            <xsd:element minOccurs="0" name="lastFailureObjectOid" type="xsd:string"/>
            <xsd:element minOccurs="0" name="lastFailureExceptionMessage" type="xsd:string"/>
            <xsd:element minOccurs="0" name="lastFailureTimestamp" type="xsd:dateTime"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="ActivityErrorHandlingStrategyType">
        <xsd:annotation>
            <xsd:documentation>
                Specifies a strategy for handling errors during iterative activities.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.3</a:since>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="entry" type="tns:ActivityErrorHandlingStrategyEntryType">
                <xsd:annotation>
                    <xsd:documentation>
                        A single entry of the strategy: describes a reaction on particular error situation.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>
    <xsd:element name="activityErrorHandlingStrategy" type="tns:ActivityErrorHandlingStrategyType"/>

    <xsd:complexType name="ActivityErrorHandlingStrategyEntryType">
        <xsd:annotation>
            <xsd:documentation>
                Specifies a reaction when a given error during activity execution occurs.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.3</a:since>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="order" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        Order in which this entry is to be evaluated. (Related to other entries.) Smaller numbers
                        go first. Entries with no order go last.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="situation" type="tns:ErrorSituationSelectorType">
                <xsd:annotation>
                    <xsd:documentation>
                        A situation that can occur.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="reaction" type="tns:ErrorReactionType">
                <xsd:annotation>
                    <xsd:documentation>
                        Reaction to the situation.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>
    <xsd:element name="activityErrorHandlingStrategyEntry" type="tns:ActivityErrorHandlingStrategyEntryType"/>

    <xsd:complexType name="ErrorSituationSelectorType">
        <xsd:annotation>
            <xsd:documentation>
                Description of an error condition to act on.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.3</a:since>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="status" type="tns:OperationResultStatusType">
                <xsd:annotation>
                    <xsd:documentation>
                        Operation result status to match. Can be either PARTIAL_ERROR or FATAL_ERROR.
                        If not present, we decide solely on error category. If error categories are not specified,
                        any error matches.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="errorCategory" type="tns:ErrorCategoryType">
                <xsd:annotation>
                    <xsd:documentation>
                        Error category (network, security, policy, ...) to match. Note that some errors are not propagated
                        to the level where they can be recognized by this selector. So be careful and consider this feature
                        to be highly experimental.
                        If not present, we decide solely on the status.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:experimental>true</a:experimental>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>
    <xsd:element name="errorSituationSelector" type="tns:ErrorSituationSelectorType"/>

    <xsd:complexType name="ErrorReactionType">
        <xsd:annotation>
            <xsd:documentation>
                What should a task do when an error of given type is encountered?
                Only some combinations of values are allowed: ignore (+ stopAfter),
                retryLater (+ stopAfter), stop.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.3</a:since>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="ignore" type="tns:IgnoreErrorReactionType"/>
            <xsd:element minOccurs="0" name="stop" type="tns:StopProcessingReactionType"/>
            <xsd:element minOccurs="0" name="retryLater" type="tns:RetryLaterReactionType"/>
            <xsd:element minOccurs="0" name="stopAfter" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        Task is stopped after seeing this number of errors.
                        TEMPORARY. Most probably will be replaced by the thresholds mechanism.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>
    <xsd:element name="errorReaction" type="tns:ErrorReactionType"/>

    <xsd:complexType name="IgnoreErrorReactionType">
        <xsd:annotation>
            <xsd:documentation>
                Error should be ignored and the processing should continue.
                E.g. for live sync tasks, the token is advanced to the next item.
                The ignorance is not complete, though. For example, the error is recorded
                into the operationExecution item of the object being processed.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.3</a:since>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>
    <xsd:element name="ignoreErrorReaction" type="tns:IgnoreErrorReactionType"/>

    <xsd:complexType name="StopProcessingReactionType">
        <xsd:annotation>
            <xsd:documentation>
                The processing should be stopped. This is the default strategy for live sync and async update tasks.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.3</a:since>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
        <!--<xsd:sequence>-->
        <!--    <xsd:element name="status" type="c:OperationResultStatusType" minOccurs="0">-->
        <!--        <xsd:annotation>-->
        <!--            <xsd:documentation>-->
        <!--                Status that is reported as a reason for stopping the task. The default is the current operation-->
        <!--                result status.-->
        <!--            </xsd:documentation>-->
        <!--            <xsd:appinfo>-->
        <!--                <a:since>4.4</a:since>-->
        <!--            </xsd:appinfo>-->
        <!--        </xsd:annotation>-->
        <!--    </xsd:element>-->
        <!--</xsd:sequence>-->
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>
    <xsd:element name="stopProcessingReaction" type="tns:StopProcessingReactionType"/>

    <xsd:complexType name="RetryLaterReactionType">
        <xsd:annotation>
            <xsd:documentation>
                Processing of the specified account should be retried later.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.3</a:since>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="initialInterval" type="xsd:duration">
                <xsd:annotation>
                    <xsd:documentation>
                        Initial retry interval.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="nextInterval" type="xsd:duration">
                <xsd:annotation>
                    <xsd:documentation>
                        "Next" retry interval, after initial attempt.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="retryLimit" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        Maximal number of retries to attempt. (Null means unlimited.)
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>
    <xsd:element name="retryLaterReaction" type="tns:RetryLaterReactionType"/>

    <xsd:complexType name="FailedObjectsSelectorType">
        <xsd:annotation>
            <xsd:documentation>
                Selects objects that were failed to be processed in previous activity run(s).
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.3</a:since>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="status" type="tns:OperationResultStatusType">
                <xsd:annotation>
                    <xsd:documentation>
                        What states to select. Default are: FATAL_ERROR and PARTIAL_ERROR.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="taskRef" type="tns:ObjectReferenceType">
                <xsd:annotation>
                    <xsd:documentation>
                        What task(s) to look for? Default is: the current task.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:objectReferenceTargetType>tns:TaskType</a:objectReferenceTargetType>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="timeFrom" type="xsd:dateTime">
                <xsd:annotation>
                    <xsd:documentation>
                        What is the earliest time of the record to be considered? Default: no limit here.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="timeTo" type="xsd:dateTime">
                <xsd:annotation>
                    <xsd:documentation>
                        What is the latest time of the record to be considered? Default: if explicit task OID is not specified,
                        then it is the last start timestamp of the current task root. (Just to avoid cycles in processing;
                        although maybe we are too cautious here.) If the task is different, then null.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="selectionMethod" type="tns:FailedObjectsSelectionMethodType">
                <xsd:annotation>
                    <xsd:documentation>
                        How are failed objects selected. Usually there's no need to change from the default.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>
    <xsd:element name="failedObjectsSelector" type="tns:FailedObjectsSelectorType"/>

    <xsd:simpleType name="FailedObjectsSelectionMethodType">
        <xsd:annotation>
            <xsd:documentation>
                How are failed objects selected. This is to overcome some technological obstacles in
                object searching in the provisioning module.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.3</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="default">
                <xsd:annotation>
                    <xsd:documentation>
                        Default processing method. Normally narrowQuery. But when searching
                        for shadows via provisioning, fetchFailedObjects is used.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="DEFAULT"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="narrowQuery">
                <xsd:annotation>
                    <xsd:documentation>
                        Simply narrow the query by adding failed objects filter.
                        It works with repository but usually not with provisioning.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="NARROW_QUERY"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="filterAfterRetrieval">
                <xsd:annotation>
                    <xsd:documentation>
                        Uses original query to retrieve objects from a resource. Filtering is done afterwards,
                        i.e. before results are passed to the processing. This is preferable when there is
                        large percentage of failed records.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="FILTER_AFTER_RETRIEVAL"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="fetchFailedObjects">
                <xsd:annotation>
                    <xsd:documentation>
                        Failed objects are selected using the repository. Only after that, they are fetched
                        one-by-one via provisioning and processed. This is preferable when there is only
                        a small percentage of failed records.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="FETCH_FAILED_OBJECTS"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="ItemProcessingOutcomeType">
        <xsd:annotation>
            <xsd:documentation>
                How item processing ended?
                Similar to operation result status, but using a different categorization.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.3</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="success">
                <xsd:annotation>
                    <xsd:documentation>
                        Item processing was considered to be successful.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="SUCCESS"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="failure">
                <xsd:annotation>
                    <xsd:documentation>
                        Item processing is considered to be failed.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="FAILURE"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="skip">
                <xsd:annotation>
                    <xsd:documentation>
                        Item processing was skipped.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="SKIP"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:complexType name="QualifiedItemProcessingOutcomeType">
        <xsd:annotation>
            <xsd:documentation>
                Item processing outcome plus optional qualification.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.3</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="outcome" type="tns:ItemProcessingOutcomeType">
                <xsd:annotation>
                    <xsd:documentation>
                        Outcome of the processing (success, failure, skip).
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="qualifierUri" type="xsd:anyURI">
                <xsd:annotation>
                    <xsd:documentation>
                        Optional qualifier, describing e.g. the reason for item being skipped.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>
    <xsd:element name="qualifiedItemProcessingOutcome" type="tns:QualifiedItemProcessingOutcomeType"/>

    <xsd:complexType name="ActivityReportingDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                How should the task report its various aspects?
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.3</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="logging" type="tns:ActivityLoggingOptionsType">
                <xsd:annotation>
                    <xsd:documentation>
                        Controls logging aspects of an activity execution.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="tracing" type="tns:ActivityTracingDefinitionType">
                <xsd:annotation>
                    <xsd:documentation>
                        Specifies when and how should be the activity execution traced.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:since>4.4</a:since>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="profiling" type="tns:ActivityProfilingDefinitionType">
                <xsd:annotation>
                    <xsd:documentation>
                        Specifies when and how should be the activity execution dynamically profiled.
                        This functionality is deprecated. The tracing should be used instead.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:since>4.4</a:since>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="reports" type="tns:ActivityReportsDefinitionType">
                <xsd:annotation>
                    <xsd:documentation>
                        Configures specific activity reports: on buckets, items, and so on.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:since>4.4</a:since>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="itemCounting" type="tns:ActivityItemCountingDefinitionType">
                <xsd:annotation>
                    <xsd:documentation>
                        How should the activity deal with item counting, i.e. determining "expected progress"
                        for a bucket or overall.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:since>4.4</a:since>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="stateOverview" type="tns:ActivityStateOverviewMaintenanceDefinitionType">
                <xsd:annotation>
                    <xsd:documentation>
                        Parameters related to the maintenance of activity tree state overview.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:since>4.4</a:since>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="simulationResult" type="tns:ActivitySimulationResultDefinitionType">
                <xsd:annotation>
                    <xsd:documentation>
                        Should the simulation result be created for the activity? If so, how?

                        For native repository, the default is "yes, with the default settings" for simulation
                        (full or shadow-level) mode and "no" for all other modes.

                        For generic repository that does not support simulation results, the default is always "no".

                        If you want to explicitly disable the creation of simulation result for simulation-mode activities,
                        set "enabled" to "false" inside.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:since>4.7</a:since>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>
    <xsd:element name="activityReportingDefinition" type="tns:ActivityReportingDefinitionType"/>

    <xsd:complexType name="ActivityItemCountingDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                How should the activity deal with item counting, i.e. determining "expected total"
                for a bucket or overall.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.4</a:since>
                <a:container>true</a:container>
                <a:experimental>true</a:experimental>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="determineBucketSize" type="tns:ActivityItemCountingOptionType">
                <xsd:annotation>
                    <xsd:documentation>
                        Should the activity execution try to determine the size of individual buckets (usually by counting
                        objects before processing)? When execution mode is bucketAnalysis, the bucket size is determined
                        regardless of this setting.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="determineOverallSize" type="tns:ActivityOverallItemCountingOptionType">
                <xsd:annotation>
                    <xsd:documentation>
                        Should the activity execution try to determine expected total progress (usually by counting
                        objects before processing)? Currently not supported for worker tasks.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element default="false" minOccurs="0" name="cacheOverallSize" type="xsd:boolean">
                <xsd:annotation>
                    <xsd:documentation>
                        Should we cache expected total progress between activity runs? (Meaning when suspending
                        and resuming an activity.)
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:simpleType name="ActivityItemCountingOptionType">
        <xsd:annotation>
            <xsd:documentation>
                When are expected items in a bucket counted in an activity?
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.4</a:since>
                <a:experimental>true</a:experimental>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="always">
                <xsd:annotation>
                    <xsd:documentation>
                        The activity will always execute the items counting.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="ALWAYS"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="whenNotBucketed">
                <xsd:annotation>
                    <xsd:documentation>
                        The activity counts the items only if it is not bucketed (i.e. does not support bucketing
                        at all, or has a single "default" bucket only). The idea is that in this case the items count
                        really matters in order to estimate the relative task progress.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="WHEN_NOT_BUCKETED"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="whenInRepository">
                <xsd:annotation>
                    <xsd:documentation>
                        The activity counts the items only if the item source resides in repository
                        (the idea is that repository searches are faster than resource object searches).
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="WHEN_IN_REPOSITORY"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="whenInRepositoryAndNotBucketed">
                <xsd:annotation>
                    <xsd:documentation>
                        The activity counts the items only if the item source resides in repository
                        and the activity is not bucketed.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="WHEN_IN_REPOSITORY_AND_NOT_BUCKETED"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="never">
                <xsd:annotation>
                    <xsd:documentation>
                        The activity does not count the items.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="NEVER"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="ActivityOverallItemCountingOptionType">
        <xsd:annotation>
            <xsd:documentation>
                When are expected items (overall) counted in an activity?

                Just like ActivityItemCountingOptionType but currently does not support distinguishing based
                on bucketed/non-bucketed.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.4</a:since>
                <a:experimental>true</a:experimental>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="always">
                <xsd:annotation>
                    <xsd:documentation>
                        The activity will always execute the items counting.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="ALWAYS"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="whenInRepository">
                <xsd:annotation>
                    <xsd:documentation>
                        The activity counts the items only if the item source resides in repository
                        (the idea is that repository searches are faster than resource object searches).
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="WHEN_IN_REPOSITORY"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="never">
                <xsd:annotation>
                    <xsd:documentation>
                        The activity does not count the items.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="NEVER"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:complexType name="ActivityStateOverviewMaintenanceDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Parameters related to the maintenance of activity tree state overview.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.4</a:since>
                <a:container>true</a:container>
                <a:experimental>true</a:experimental>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="progressUpdateInterval" type="xsd:long">
                <xsd:annotation>
                    <xsd:documentation>
                        How often should be the progress in the activity tree state overview updated?
                        The value is in milliseconds.

                        The interval should be such that its value divided by the number of workers should yield
                        a reasonable time (e.g. no less than a couple of seconds).
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element default="forNonLocalActivities" minOccurs="0" name="progressUpdateMode" type="tns:ActivityStateOverviewProgressUpdateModeType">
                <xsd:annotation>
                    <xsd:documentation>
                        For what activities is the progress updated?
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="ActivityTracingDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Definition for tracing execution of an iterative activity.
                Currently used also for tracing handling of asynchronous updates.
                (Although not all its features are used there!)
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.0.1</a:since>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="order" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        Order in which this definition is to be considered. Nulls go last.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:displayName>Order</a:displayName>
                        <a:since>4.4</a:since>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="interval" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        Traces processing of each N-th item.
                        DEPRECATED. Use beforeItemCondition instead.

                        (Except for tracing asynchronous updates. There, only this property is observed.)
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:displayName>Tracing interval</a:displayName>
                        <a:deprecated>true</a:deprecated>
                        <a:deprecatedSince>4.4</a:deprecatedSince>
                        <a:plannedRemoval>5.0</a:plannedRemoval>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="beforeItemCondition" type="tns:BeforeItemConditionType">
                <xsd:annotation>
                    <xsd:documentation>
                        Conditions that must be fulfilled (any of them) before this definition is applied.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:displayName>"Before item" condition</a:displayName>
                        <a:since>4.4</a:since>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="afterItemCondition" type="tns:AfterItemConditionType">
                <xsd:annotation>
                    <xsd:documentation>
                        Conditions that must be fulfilled (any of them) for the result of this tracing be written to the file.

                        BEWARE! This condition is checked only for traces with the root of activityItemProcessing,
                        i.e. those that were started right on the level of the iterative activity.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:displayName>"After item" condition</a:displayName>
                        <a:since>4.4</a:since>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="tracingProfile" type="c:TracingProfileType">
                <xsd:annotation>
                    <xsd:documentation>
                        Tracing profile to be used.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:displayName>Tracing profile</a:displayName>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="tracingPoint" type="c:TracingRootType">
                <xsd:annotation>
                    <xsd:documentation>
                        Point(s) to be traced.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:displayName>Tracing root</a:displayName>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>
    <xsd:element name="activityTracingDefinition" type="tns:ActivityTracingDefinitionType"/>

    <xsd:complexType name="ActivityProfilingDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.4</a:since>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="interval" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        Profiles processing of each N-th item.
                        DEPRECATED. Use beforeItemCondition instead.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:displayName>Profiling interval</a:displayName>
                        <a:deprecated>true</a:deprecated>
                        <a:deprecatedSince>4.8</a:deprecatedSince>
                        <a:plannedRemoval>5.0</a:plannedRemoval>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="beforeItemCondition" type="tns:BeforeItemConditionType">
                <xsd:annotation>
                    <xsd:documentation>
                        Conditions that must be fulfilled (any of them) before dynamic profiling is started.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:displayName>"Before item" condition</a:displayName>
                        <a:since>4.4</a:since>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>
    <xsd:element name="activityProfilingDefinition" type="tns:ActivityProfilingDefinitionType"/>

    <xsd:complexType name="ActivityReportsDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Defines specific activity-related reports.
            </xsd:documentation>
            <xsd:appinfo>
                <a:experimentaL>true</a:experimentaL>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="buckets" type="tns:BucketsProcessingReportDefinitionType">
                <xsd:annotation>
                    <xsd:documentation>
                        Definition of "buckets" report.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="items" type="tns:ItemsProcessingReportDefinitionType">
                <xsd:annotation>
                    <xsd:documentation>
                        Definition of "items" report.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="connIdOperations" type="tns:ConnIdOperationsReportDefinitionType">
                <xsd:annotation>
                    <xsd:documentation>
                        Definition of ConnId operations report.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="internalOperations" type="tns:InternalOperationsReportDefinitionType">
                <xsd:annotation>
                    <xsd:documentation>
                        Definition of midPoint internal operations report.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>
    <xsd:element name="activityReportsDefinition" type="tns:ActivityReportsDefinitionType"/>

    <xsd:complexType name="AbstractActivityReportDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Common parts of definitions of activity-related reports.
            </xsd:documentation>
            <xsd:appinfo>
                <a:experimentaL>true</a:experimentaL>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="enabled" type="xsd:boolean">
                <xsd:annotation>
                    <xsd:documentation>
                        If false, the report is (temporarily) disabled.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="recordFilter" type="q:SearchFilterType">
                <xsd:annotation>
                    <xsd:documentation>
                        If specified, only records matching this filter will be reported.
                    </xsd:documentation>
                    <xsd:appinfo>   <!-- TODO check -->
                        <a:schemaContext>
                            <a:type>BucketProcessingRecordType</a:type>
                            <a:type>ItemProcessingRecordType</a:type>
                            <a:type>ConnIdOperationRecordType</a:type>
                            <a:type>InternalOperationRecordType</a:type>
                        </a:schemaContext>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="recordFilteringExpression" type="tns:ExpressionType">
                <xsd:annotation>
                    <xsd:documentation>
                        If specified and if returns false, the specified record will not be included in the report.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>

    <xsd:complexType name="BucketsProcessingReportDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Defines report on buckets processing.
            </xsd:documentation>
            <xsd:appinfo>
                <a:experimentaL>true</a:experimentaL>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractActivityReportDefinitionType">
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="bucketsProcessingReportDefinition" type="tns:BucketsProcessingReportDefinitionType"/>

    <xsd:complexType name="ItemsProcessingReportDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Defines report on items processing.
            </xsd:documentation>
            <xsd:appinfo>
                <a:experimentaL>true</a:experimentaL>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractActivityReportDefinitionType">
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="itemsProcessingReportDefinition" type="tns:ItemsProcessingReportDefinitionType"/>

    <xsd:complexType name="ConnIdOperationsReportDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Defines report on ConnId operations.
            </xsd:documentation>
            <xsd:appinfo>
                <a:experimentaL>true</a:experimentaL>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractActivityReportDefinitionType">
                <xsd:sequence>
                    <xsd:element maxOccurs="unbounded" minOccurs="0" name="beforeItemCondition" type="tns:BeforeItemConditionType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Conditions that must be fulfilled (any of them) before ConnId reporting for this activity is enabled.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:displayName>"Before item" condition</a:displayName>
                                <a:since>4.4</a:since>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <!-- currently no "after item condition" because of the implementation limitations -->
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="connIdOperationsReportDefinition" type="tns:ConnIdOperationsReportDefinitionType"/>

    <xsd:complexType name="InternalOperationsReportDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Defines report on internal operations.
            </xsd:documentation>
            <xsd:appinfo>
                <a:experimentaL>true</a:experimentaL>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractActivityReportDefinitionType">
                <xsd:sequence>
                    <xsd:element maxOccurs="unbounded" minOccurs="0" name="fastFilter" type="tns:InternalOperationRecordFastFilterType">
                        <xsd:annotation>
                            <xsd:documentation>
                                "Fast filter" that can reject a raw operation result, even before transforming into report record.
                                The record is accepted if any of the filters accepts. (If there are any filters specified.)
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element maxOccurs="unbounded" minOccurs="0" name="beforeItemCondition" type="tns:BeforeItemConditionType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Conditions that must be fulfilled (any of them) before internal operation reporting
                                for this activity is enabled.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:displayName>"Before item" condition</a:displayName>
                                <a:since>4.4</a:since>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element maxOccurs="unbounded" minOccurs="0" name="afterItemCondition" type="tns:AfterItemConditionType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Conditions that must be fulfilled (any of them) for the result
                                of this reporting be written to the file.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:displayName>"After item" condition</a:displayName>
                                <a:since>4.4</a:since>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="internalOperationsReportDefinition" type="tns:InternalOperationsReportDefinitionType"/>

    <xsd:complexType name="InternalOperationRecordFastFilterType">
        <xsd:annotation>
            <xsd:documentation>
                "Fast filter" that can reject a raw operation result.
            </xsd:documentation>
            <xsd:appinfo>
                <a:experimentaL>true</a:experimentaL>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="operationInclude" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        If specified, only operations matching the listed ones are reported.
                        An asterisk can be used as a wildcard. If the string is in the form of ~/.../,
                        the content is interpreted as a regular expression.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="operationExclude" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        If specified, operations matching the listed ones are NOT reported.
                        An asterisk can be used as a wildcard. If the string is in the form of ~/.../,
                        the content is interpreted as a regular expression.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="individualQualifier" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        Values to be matched for individual qualifiers.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="concatenatedQualifiers" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        Values to be matched for concatenated qualifiers.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>

    <xsd:complexType name="ItemReportingConditionType">
        <xsd:annotation>
            <xsd:documentation>
                Condition controlling item report creation or collection that is evaluated before or after item is processed.
            </xsd:documentation>
            <xsd:appinfo>
                <a:experimentaL>true</a:experimentaL>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="interval" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        If specified, only each N-th item is reported. Should be used only in "before item" conditions
                        to spare processing resources.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="firstWorker" type="xsd:boolean">
                <xsd:annotation>
                    <xsd:documentation>
                        If true, only the first worker on each node (so called scavenger) runs the report.
                        Should be used only in "before item" conditions to spare processing resources.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="expression" type="tns:ExpressionType">
                <xsd:annotation>
                    <xsd:documentation>
                        Expression that is evaluated. If returns false, the report is not being created or collected.
                        Variables available: "request", "item". After processing, also "operation" (containing e.g. duration
                        or status) and "operationResult" are available.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>

    <xsd:complexType name="BeforeItemConditionType">
        <xsd:annotation>
            <xsd:documentation>
                Condition controlling item report creation that is evaluated before the item is processed.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.4</a:since>
                <a:container>true</a:container>
                <a:experimental>true</a:experimental>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:ItemReportingConditionType">
                <xsd:sequence>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:complexType name="AfterItemConditionType">
        <xsd:annotation>
            <xsd:documentation>
                Condition controlling item report collection that is evaluated after the item is processed.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.4</a:since>
                <a:container>true</a:container>
                <a:experimental>true</a:experimental>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:ItemReportingConditionType">
                <xsd:sequence>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:complexType name="ActivityLoggingOptionsType">
        <xsd:annotation>
            <xsd:documentation>
                Controls logging aspects of an activity execution.
            </xsd:documentation>
            <xsd:appinfo>
                <a:experimentaL>true</a:experimentaL>
                <a:container>true</a:container>
                <a:since>4.3</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="itemCompletion" type="tns:ActivityEventLoggingOptionType">
                <xsd:annotation>
                    <xsd:documentation>
                        How should item completion be logged?
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="bucketCompletion" type="tns:ActivityEventLoggingOptionType">
                <xsd:annotation>
                    <xsd:documentation>
                        How should bucket completion be logged?
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <!-- TODO logging override for an activity -->
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>
    <xsd:element name="activityLoggingOptions" type="tns:ActivityLoggingOptionsType"/>

    <xsd:simpleType name="ActivityEventLoggingOptionType">
        <xsd:annotation>
            <xsd:documentation>
                Option about logging a particular task-related event.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.3</a:since>
                <a:experimental>true</a:experimental>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="none">
                <xsd:annotation>
                    <xsd:documentation>
                        Event should not be logged.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="NONE"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="brief">
                <xsd:annotation>
                    <xsd:documentation>
                        Event should be logged briefly, typically by writing a single log line.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="BRIEF"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="full">
                <xsd:annotation>
                    <xsd:documentation>
                        Event should be logged fully. A couple of lines containing e.g. statistical information can be written.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="FULL"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:complexType name="ActivitySimulationResultDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Should the simulation result be created for the activity? If so, how?
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.7</a:since>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element default="true" minOccurs="0" name="enabled" type="xsd:boolean">
                <xsd:annotation>
                    <xsd:documentation>
                        Is the creation of simulation result enabled?
                        The default is "true" if this container is present.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:since>4.8</a:since>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="definition" type="tns:SimulationDefinitionType">
                <xsd:annotation>
                    <xsd:documentation>
                        Definition (configuration) of the simulation result. May refer to one of global definitions.
                        If none is specified, the system default definition is used.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="BasicObjectSetType">
        <xsd:annotation>
            <xsd:documentation>
                Specifies the basic features of a repository-based object set.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.8</a:since>
                <a:container>true</a:container>
                <a:schemaContext>
                    <a:typePath>type</a:typePath>
                </a:schemaContext>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="type" type="xsd:QName">
                <xsd:annotation>
                    <xsd:documentation>
                        Type of objects to be processed.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="archetypeRef" type="tns:ObjectReferenceType">
                <xsd:annotation>
                    <xsd:documentation>
                        Archetype of objects to be processed.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:objectReferenceTargetType>tns:ArchetypeType</a:objectReferenceTargetType>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="objectRef" type="tns:ObjectReferenceType">
                <xsd:annotation>
                    <xsd:documentation>
                        Explicit enumeration of objects belonging to this object set.
                        Functionally equivalent to "inOid" filter in "query".

                        Mutually exclusive with "query".

                        Limitation:
                        1. All uses except for in "roleMembershipManagementWorkDefinition" are considered
                        experimental. (They should work but no guarantees there.)
                        2. The list here is translated into "has OID" query, so it may not work adequately
                        for large lists of objects (e.g. thousands).
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:objectReferenceTargetType>tns:ObjectType</a:objectReferenceTargetType>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="ObjectSetType">
        <xsd:annotation>
            <xsd:documentation>
                Specifies a set of repository objects to be processed.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:BasicObjectSetType">
                <xsd:sequence>
                    <xsd:element minOccurs="0" name="query" type="q:QueryType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Query specifying objects to be processed.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="searchOptions" type="c:SelectorQualifiedGetOptionsType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Options to be used when searching for objects.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="useRepositoryDirectly" type="xsd:boolean">
                        <xsd:annotation>
                            <xsd:documentation>
                                Whether to use repository directly when searching for objects.
                                (There's usually no need to specify this.)
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="failedObjectsSelector" type="tns:FailedObjectsSelectorType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Selects objects that were failed to be processed in previous activity run(s).
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="objectSet" type="tns:ObjectSetType"/>

    <xsd:complexType name="BasicResourceObjectSetType">
        <xsd:annotation>
            <xsd:documentation>
                Specifies a set of resource objects to be processed with only basic identifiers.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.8</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="resourceRef" type="tns:ObjectReferenceType">
                <xsd:annotation>
                    <xsd:documentation>
                        Resource against which we want to execute the activity.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:displayName>ResourceObjectSetType.resourceRef</a:displayName>
                        <a:objectReferenceTargetType>c:ResourceType</a:objectReferenceTargetType>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="kind" type="tns:ShadowKindType">
                <xsd:annotation>
                    <xsd:documentation>
                        Kind of objects to be processed.

                        If specified, a resource object type is looked up using provided kind and intent values. The activity
                        is then executed against objects of given type.

                        If not specified, the scope of the operation is driven by the object class.

                        For activities that do not select objects right on the resource (e.g. shadow cleanup),
                        the kind, intent, and objectclass are interpreted "literally", i.e. as filters against
                        values of kind, intent, and object class stored in the repository.

                        See documentation of searchObjects and synchronize methods in ProvisioningService for more information.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="intent" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        Complements the kind in specifying resource object type that should be processed by the activity.
                        Must not be specified if kind is missing.

                        If kind is specified but intent is not, the object type marked as "default for kind" is selected.

                        For activities that do not select objects right on the resource (e.g. shadow cleanup),
                        the kind, intent, and objectclass are interpreted "literally", i.e. as filters against
                        values of kind, intent, and object class stored in the repository.

                        See documentation of searchObjects and synchronize methods in ProvisioningService for more information.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="objectclass" type="xsd:QName">
                <xsd:annotation>
                    <xsd:documentation>
                        Denotes the object class to be processed by the activity.

                        If kind (with or without intent) is specified, then the value provided here must match the object class
                        connected to specified resource object type. Therefore, it is not necessary nor advisable to specify
                        object class if kind is specified.

                        If kind is not specified, then the value provided here specifies the class of objects to be processed
                        by the activity. (For example, all of "inetOrgPerson".)

                        If neither kind nor object class is specified (and no custom query is provided), then the activity
                        is assumed to be executed on all objects on given resource. Not all activities support this mode.

                        For activities that do not select objects right on the resource (e.g. shadow cleanup),
                        the kind, intent, and objectclass are interpreted "literally", i.e. as filters against
                        values of kind, intent, and object class stored in the repository.

                        See documentation of searchObjects and synchronize methods in ProvisioningService for more information.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="ResourceObjectSetType">
        <xsd:annotation>
            <xsd:documentation>
                Specifies a set of resource objects to be processed.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:BasicResourceObjectSetType">
                <xsd:sequence>
                    <xsd:element minOccurs="0" name="query" type="q:QueryType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Explicit object query used to refine/replace the default query stemming from resourceRef, kind, intent,
                                and/or objectclass.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:schemaContext>
                                    <a:type>tns:ShadowType</a:type> <!-- new resolver/algorithm will be needed-->
                                </a:schemaContext>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="queryApplication" type="tns:ResourceObjectSetQueryApplicationModeType">
                        <xsd:annotation>
                            <xsd:documentation>
                                How should be the explicit query applied to the default query.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="searchOptions" type="c:SelectorQualifiedGetOptionsType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Options to be used when searching for objects.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="failedObjectsSelector" type="tns:FailedObjectsSelectorType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Selects objects that were failed to be processed in previous activity run(s).
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="resourceObjectSet" type="tns:ResourceObjectSetType"/>

    <xsd:simpleType name="ResourceObjectSetQueryApplicationModeType">
        <xsd:annotation>
            <xsd:documentation>
                How should be the explicit query applied to the default query stemming from
                resourceRef / objectclass / kind / intent specification.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="append">
                <xsd:annotation>
                    <xsd:documentation>
                        Specified query is "appended" to the default query that results from
                        the resourceRef/kind/intent/objectclass tuple.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="APPEND"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="replace">
                <xsd:annotation>
                    <xsd:documentation>
                        Specified query replaces the default query that results from
                        the resourceRef/kind/intent/objectclass tuple.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="REPLACE"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:complexType name="RecomputationWorkDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Recomputes specified objects.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:ObjectSetBasedWorkDefinitionType">
                <xsd:sequence>
                    <xsd:element minOccurs="0" name="executionOptions" type="tns:ModelExecuteOptionsType"/>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="recomputationWorkDefinition" type="tns:RecomputationWorkDefinitionType"/>

    <xsd:complexType name="IterativeScriptingWorkDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Executes a script (a.k.a. action) over a set of objects.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:ObjectSetBasedWorkDefinitionType">
                <xsd:sequence>
                    <xsd:element minOccurs="0" name="scriptExecutionRequest" type="s:ExecuteScriptType"/>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="iterativeScriptingWorkDefinition" type="tns:IterativeScriptingWorkDefinitionType"/>

    <xsd:complexType name="NonIterativeScriptingWorkDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Executes a script (a.k.a. action) on an empty or explicitly specified input.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractWorkDefinitionType">
                <xsd:sequence>
                    <xsd:element minOccurs="0" name="scriptExecutionRequest" type="s:ExecuteScriptType"/>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="nonIterativeScriptingWorkDefinition" type="tns:NonIterativeScriptingWorkDefinitionType"/>

    <xsd:complexType name="FocusValidityScanWorkDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Executes validity scan on focal objects.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:ObjectSetBasedWorkDefinitionType">
                <xsd:sequence>
                    <xsd:element minOccurs="0" name="queryStyle" type="tns:ValidityScanQueryStyleType">
                        <xsd:annotation>
                            <xsd:documentation>
                                How to execute validation scan queries.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="validityConstraint" type="tns:TimeValidityPolicyConstraintType"/>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="focusValidityScanWorkDefinition" type="tns:FocusValidityScanWorkDefinitionType"/>

    <xsd:simpleType name="ValidityScanQueryStyleType">
        <xsd:annotation>
            <xsd:documentation>
                How to execute validation scan queries.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="singleQuery">
                <xsd:annotation>
                    <xsd:documentation>
                        A single query is issued. This encompasses both objects and assignments.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="SINGLE_QUERY"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="separateObjectAndAssignmentQueries">
                <xsd:annotation>
                    <xsd:documentation>
                        Separate queries for objects and assignments are issued.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="SEPARATE_OBJECT_AND_ASSIGNMENT_QUERIES"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:complexType name="TriggerScanWorkDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Executes trigger scan on repository objects.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:ObjectSetBasedWorkDefinitionType">
                <xsd:sequence>
                    <!-- ? -->
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="triggerScanWorkDefinition" type="tns:TriggerScanWorkDefinitionType"/>

    <xsd:complexType name="ShadowRefreshWorkDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Looks for pending operations in shadows and updates their status.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractWorkDefinitionType">
                <xsd:sequence>
                    <xsd:element minOccurs="0" name="shadows" type="tns:ObjectSetType">
                        <xsd:annotation>
                            <xsd:documentation>
                                This is intentionally not a resource object set type, because the filtering behavior is different
                                from the usual tasks: the "has pending operations" filter is used ONLY if there is no custom
                                filter present in the work definition.

                                This is the behavior up to 4.4. It may or may not be correct. So it may change in the future.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:schemaContext>
                                    <a:type>tns:ShadowType</a:type>
                                </a:schemaContext>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="shadowRefreshWorkDefinition" type="tns:ShadowRefreshWorkDefinitionType"/>

    <xsd:complexType name="IterativeChangeExecutionWorkDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Executes specified changes on specified objects.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:ObjectSetBasedWorkDefinitionType">
                <xsd:sequence>
                    <xsd:element minOccurs="0" name="delta" type="t:ObjectDeltaType"/>
                    <xsd:element minOccurs="0" name="executionOptions" type="tns:ModelExecuteOptionsType"/>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="IterativeChangeExecutionWorkDefinition" type="tns:IterativeChangeExecutionWorkDefinitionType"/>

    <xsd:complexType name="ExplicitChangeExecutionWorkDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Executes given changes. Each change explicitly specifies the object(s) on which it is to be executed.

                There are two options here:

                1) There is a single request, defined by (multivalued) `delta` and `executionOptions`.
                2) There are multiple independent requests, wrapped in ChangeExecutionRequestType objects.

                Each set of deltas in a single request must pertain to a single clockwork operation; e.g. referring to a user
                and his accounts.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractWorkDefinitionType">
                <xsd:sequence>
                    <xsd:choice>
                        <xsd:sequence>
                            <xsd:element maxOccurs="unbounded" minOccurs="0" name="delta" type="t:ObjectDeltaType"/>
                            <xsd:element minOccurs="0" name="executionOptions" type="tns:ModelExecuteOptionsType"/>
                        </xsd:sequence>
                        <xsd:element maxOccurs="unbounded" minOccurs="0" name="request" type="tns:ChangeExecutionRequestType"/>
                    </xsd:choice>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="explicitChangeExecutionWorkDefinition" type="tns:ExplicitChangeExecutionWorkDefinitionType"/>

    <xsd:complexType name="ChangeExecutionRequestType">
        <xsd:annotation>
            <xsd:documentation>
                Batch of changes to be executed.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.6</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractWorkDefinitionType">
                <xsd:sequence>
                    <xsd:element minOccurs="0" name="name" type="xsd:string">
                        <xsd:annotation>
                            <xsd:documentation>
                                Optional name of the request. It will be shown e.g. in GUI that displays the task progress.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element maxOccurs="unbounded" minOccurs="0" name="delta" type="t:ObjectDeltaType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Delta(s) to be processed. They must pertain to a single clockwork  operation;
                                e.g. referring to a user and his accounts.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="executionOptions" type="tns:ModelExecuteOptionsType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Execution options to use for this request.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="changeExecutionRequest" type="tns:ChangeExecutionRequestType"/>

    <xsd:complexType name="ReindexingWorkDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Re-indexes specified repository objects.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:ObjectSetBasedWorkDefinitionType">
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="reindexingWorkDefinition" type="tns:ReindexingWorkDefinitionType"/>

    <xsd:complexType name="RepartitioningWorkDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Re-indexes specified repository objects.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.9</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractWorkDefinitionType">
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="repartitioningWorkDefinition" type="tns:RepartitioningWorkDefinitionType"/>



    <xsd:complexType name="ObjectSetBasedWorkDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                A definition that applies to a set of repository objects.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractWorkDefinitionType">
                <xsd:sequence>
                    <xsd:element minOccurs="0" name="objects" type="tns:ObjectSetType">
                        <xsd:annotation>
                            <xsd:documentation>
                                What objects should be processed by the activity.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:schemaContext>
                                    <a:typePath>type</a:typePath>
                                </a:schemaContext>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="objectSetBasedWorkDefinition" type="tns:ObjectSetBasedWorkDefinitionType"/>

    <xsd:complexType name="ShadowCleanupWorkDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Deletes all shadows that have not been updated for given time.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractWorkDefinitionType">
                <xsd:sequence>
                    <xsd:element minOccurs="0" name="shadows" type="tns:ResourceObjectSetType"/>
                    <xsd:element minOccurs="0" name="interval" type="xsd:duration"/> <!-- TODO -->
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="shadowCleanupWorkDefinition" type="tns:ShadowCleanupWorkDefinitionType"/>

    <xsd:complexType name="ReconciliationWorkDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Executes the reconciliation.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:ResourceWorkDefinitionType"/>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="reconciliationWorkDefinition" type="tns:ReconciliationWorkDefinitionType"/>

    <xsd:complexType name="AsyncUpdateWorkDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Executes the asynchronous update from a resource.
            </xsd:documentation>
            <xsd:appinfo>
                <a:experimental>true</a:experimental>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractWorkDefinitionType">
                <xsd:sequence>
                    <xsd:element minOccurs="0" name="updatedResourceObjects" type="tns:ResourceObjectSetType">
                        <xsd:annotation>
                            <xsd:documentation>
                                TODO - EXPERIMENTAL!!!
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="asyncUpdateWorkDefinition" type="tns:AsyncUpdateWorkDefinitionType"/>

    <xsd:complexType name="ImportWorkDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Definition for an import activity.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:ResourceWorkDefinitionType"/>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="importWorkDefinition" type="tns:ImportWorkDefinitionType"/>

    <xsd:complexType name="ShadowReclassificationWorkDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Definition for a shadow reclassification activity.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.9</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:ResourceWorkDefinitionType"/>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="shadowReclassificationWorkDefinition" type="tns:ShadowReclassificationWorkDefinitionType"/>

    <xsd:complexType name="LiveSyncWorkDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Definition for a live sync activity.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:ResourceWorkDefinitionType">
                <xsd:sequence>
                    <xsd:element minOccurs="0" name="batchSize" type="xsd:int">
                        <xsd:annotation>
                            <xsd:documentation>
                                Batch size for live sync operations: if specified as N &gt; 0, live synchronization fetches
                                at most N records during each provisioning.synchronize() method execution - i.e. during
                                any live sync task run. (Currently, it leaves unprocessed changes for the next live sync
                                task run. This may change in the future.)

                                USE WITH CARE. This feature assumes that the connector provides LiveSync capability
                                with preciseTokenValue = true, i.e. that it assigns sync tokens to individual changes
                                "incrementally" so it can resume live sync operation on each individual change. This
                                can be the case of SQL connectors, but e.g. not for CSV or LDAP ones.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element default="false" minOccurs="0" name="updateLiveSyncTokenInDryRun" type="xsd:boolean">
                        <xsd:annotation>
                            <xsd:documentation>
                                Indicates if the LiveSync token should be updated when running in dry run mode.
                                If false (the default) then LiveSync will not update token to a new value so it
                                will process objects fetched on the next run (either dry or normal). If true, it
                                will update the token, and therefore marks objects as processed.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element default="false" minOccurs="0" name="updateLiveSyncTokenInPreviewMode" type="xsd:boolean">
                        <xsd:annotation>
                            <xsd:documentation>
                                Indicates if the LiveSync token should be updated when running in preview (simulation) mode.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="liveSyncWorkDefinition" type="tns:LiveSyncWorkDefinitionType"/>

    <xsd:complexType name="CleanupWorkDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Definition for a cleanup activity.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractWorkDefinitionType">
                <xsd:sequence>
                    <xsd:element minOccurs="0" name="policies" type="tns:CleanupPoliciesType">
                        <xsd:annotation>
                            <xsd:documentation>
                                TODO
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="cleanupWorkDefinition" type="tns:CleanupWorkDefinitionType"/>

    <xsd:complexType name="DeletionWorkDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Deletes specified objects.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:ObjectSetBasedWorkDefinitionType">
                <xsd:sequence>
                    <xsd:element minOccurs="0" name="executionOptions" type="tns:ModelExecuteOptionsType"/>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="deletionWorkDefinition" type="tns:DeletionWorkDefinitionType"/>

    <xsd:complexType name="AbstractReportWorkDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Definition for report-related activities.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractWorkDefinitionType">
                <xsd:sequence>
                    <xsd:element minOccurs="0" name="reportRef" type="tns:ObjectReferenceType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Definition of the report: for either import or export direction.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:objectReferenceTargetType>tns:ReportType</a:objectReferenceTargetType>
                                <a:displayName>AbstractReportWorkDefinitionType.reportRef</a:displayName>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="reportParam" type="c:ReportParameterType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Definition of the report parameters: for export direction.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:displayName>AbstractReportWorkDefinitionType.reportParam</a:displayName>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:complexType name="ClassicReportExportWorkDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Definition for a classic report export activity.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractReportWorkDefinitionType">
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="classicReportExportWorkDefinition" type="tns:ClassicReportExportWorkDefinitionType"/>

    <xsd:complexType name="DistributedReportExportWorkDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Definition for a distributed report export activity.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractReportWorkDefinitionType">
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="distributedReportExportWorkDefinition" type="tns:DistributedReportExportWorkDefinitionType"/>

    <xsd:complexType name="ClassicReportImportWorkDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Definition for a classic report import activity.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractReportWorkDefinitionType">
                <xsd:sequence>
                    <xsd:element minOccurs="0" name="reportDataRef" type="tns:ObjectReferenceType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Report data to be imported.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:objectReferenceTargetType>tns:ReportDataType</a:objectReferenceTargetType>
                                <a:displayName>AbstractReportWorkDefinitionType.reportDataRef</a:displayName>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="classicReportImportWorkDefinition" type="tns:ClassicReportImportWorkDefinitionType"/>

    <xsd:complexType name="AbstractWorkDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Marker type for an activity work definition.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container/>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>
    <xsd:element name="abstractWorkDefinition" type="tns:AbstractWorkDefinitionType"/>

    <xsd:complexType name="ResourceWorkDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Marker type for an activity work definition that use resourceObjects.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.9</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractWorkDefinitionType">
                <xsd:sequence>
                    <xsd:element minOccurs="0" name="resourceObjects" type="tns:ResourceObjectSetType"/>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="resourceWorkDefinition" type="tns:ResourceWorkDefinitionType"/>

    <xsd:complexType name="PropagationWorkDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Work definition for the propagation activity.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractWorkDefinitionType">
                <xsd:sequence>
                    <xsd:element minOccurs="0" name="resourceRef" type="tns:ObjectReferenceType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Reference to the resource on which we want to execute provisioning propagation.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:objectReferenceTargetType>tns:ResourceType</a:objectReferenceTargetType>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="propagationWorkDefinition" type="tns:PropagationWorkDefinitionType"/>

    <xsd:complexType name="MultiPropagationWorkDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Work definition for the multi-propagation activity.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractWorkDefinitionType">
                <xsd:sequence>
                    <xsd:element minOccurs="0" name="resources" type="tns:ObjectSetType">
                        <xsd:annotation>
                            <xsd:appinfo>
                                <a:schemaContext>
                                    <a:type>tns:ResourceType</a:type>
                                </a:schemaContext>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="multiPropagationWorkDefinition" type="tns:MultiPropagationWorkDefinitionType"/>

    <xsd:complexType name="ActivityPathType">
        <xsd:annotation>
            <xsd:documentation>
                Path from the root of the activity tree to the specified activity.
            </xsd:documentation>
            <xsd:appinfo>
                <!-- Intentionally not a container because of the need of path segment ordering -->
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="identifier" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        Identifier of the activity. Note that the identifier of the root activity is NOT included here.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>
    <xsd:element name="activityPath" type="tns:ActivityPathType"/>

    <xsd:complexType name="AbstractActivityWorkStateType">
        <xsd:annotation>
            <xsd:documentation>
                Supertype for all activity state types.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <!-- TEMPORARY -->
            <xsd:element minOccurs="0" name="extension" type="c:ExtensionType"/>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>
    <xsd:element name="abstractActivityWorkState" type="tns:AbstractActivityWorkStateType"/>

    <xsd:complexType name="PureCompositeWorkStateType">
        <xsd:annotation>
            <xsd:documentation>
                Work state for a pure composite activity.
                Replaced by CustomCompositeWorkStateType.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
                <a:deprecated>true</a:deprecated>
                <a:deprecatedSince>4.7</a:deprecatedSince>
                <a:deprecatedSince>4.4.4</a:deprecatedSince>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractActivityWorkStateType"/>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="pureCompositeWorkState" type="tns:PureCompositeWorkStateType"/>

    <xsd:complexType name="CustomCompositeWorkStateType">
        <xsd:annotation>
            <xsd:documentation>
                Work state for a custom composite activity.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.7</a:since>
                <a:since>4.4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractActivityWorkStateType"/>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="customCompositeWorkState" type="tns:CustomCompositeWorkStateType"/>

    <xsd:complexType name="ScanWorkStateType">
        <xsd:annotation>
            <xsd:documentation>
                Work state for scanning activities (validity scanner, trigger scanner, shadow refresher).
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractActivityWorkStateType">
                <xsd:sequence>
                    <xsd:element minOccurs="0" name="lastScanTimestamp" type="xsd:dateTime"/>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="scanWorkState" type="tns:ScanWorkStateType"/>

    <xsd:complexType name="ObjectIntegrityCheckWorkDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Definition for object integrity check activity.
            </xsd:documentation>
            <xsd:appinfo>
                <a:experimental>true</a:experimental>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:ObjectSetBasedWorkDefinitionType">
                <xsd:sequence>
                    <xsd:element default="80" minOccurs="0" name="histogramColumns" type="xsd:int"/>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="objectIntegrityCheckWorkDefinition" type="tns:ObjectIntegrityCheckWorkDefinitionType"/>

    <xsd:complexType name="ShadowIntegrityCheckWorkDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Definition for shadow integrity check activity.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractWorkDefinitionType">
                <xsd:sequence>
                    <xsd:element minOccurs="0" name="shadows" type="tns:ObjectSetType">
                        <xsd:annotation>
                            <xsd:appinfo>
                                <a:schemaContext>
                                    <a:type>tns:ShadowType</a:type>
                                </a:schemaContext>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element maxOccurs="unbounded" minOccurs="0" name="diagnose" type="tns:ShadowIntegrityAspectType"/>
                    <xsd:element maxOccurs="unbounded" minOccurs="0" name="fix" type="tns:ShadowIntegrityAspectType"/>
                    <xsd:element default="false" minOccurs="0" name="checkDuplicatesOnPrimaryIdentifiersOnly" type="xsd:boolean"/>
                    <xsd:element minOccurs="0" name="duplicateShadowsResolver" type="xsd:string"/>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="shadowIntegrityCheckWorkDefinition" type="tns:ShadowIntegrityCheckWorkDefinitionType"/>

    <xsd:simpleType name="ShadowIntegrityAspectType">
        <xsd:annotation>
            <xsd:documentation>
                An aspect of shadow integrity to be diagnosed and/or fixed.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="intents">
                <xsd:annotation>
                    <xsd:documentation>
                        TODO
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="INTENTS"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="uniqueness">
                <xsd:annotation>
                    <xsd:documentation>
                        TODO
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="UNIQUENESS"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="normalization">
                <xsd:annotation>
                    <xsd:documentation>
                        TODO
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="NORMALIZATION"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="owners">
                <xsd:annotation>
                    <xsd:documentation>
                        TODO
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="OWNERS"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="existenceOnResource">
                <xsd:annotation>
                    <xsd:documentation>
                        TODO
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="EXISTENCE_ON_RESOURCE"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="extraData">
                <xsd:annotation>
                    <xsd:documentation>
                        TODO
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="EXTRA_DATA"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="resourceRef">
                <xsd:annotation>
                    <xsd:documentation>
                        TODO
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="RESOURCE_REF"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:complexType name="DelegationWorkStateType">
        <xsd:annotation>
            <xsd:documentation>
                State for a delegation (delegating) activity run.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractActivityWorkStateType">
                <xsd:sequence>
                    <xsd:element minOccurs="0" name="taskRef" type="tns:ObjectReferenceType">
                        <xsd:annotation>
                            <xsd:documentation>
                                A reference to the delegate subtask.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:objectReferenceTargetType>tns:TaskType</a:objectReferenceTargetType>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="delegationWorkState" type="tns:DelegationWorkStateType"/>

    <xsd:complexType name="ReconciliationWorkStateType">
        <xsd:annotation>
            <xsd:documentation>
                State of the reconciliation activity.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractActivityWorkStateType">
                <xsd:sequence>
                    <xsd:element minOccurs="0" name="resourceObjectsReconciliationStartTimestamp" type="xsd:dateTime">
                        <xsd:annotation>
                            <xsd:documentation>
                                When did the resource objects reconciliation start? This information is used in the last
                                activity (remaining shadows), where we look for shadows with synchronization timestamp less
                                than this value - i.e. ones that were not touched by resource object reconciliation activity.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="reconciliationWorkState" type="tns:ReconciliationWorkStateType"/>

    <xsd:complexType name="LiveSyncWorkStateType">
        <xsd:annotation>
            <xsd:documentation>
                State of the live sync activity.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractActivityWorkStateType">
                <xsd:sequence>
                    <xsd:element minOccurs="0" name="token" type="xsd:anyType">
                        <xsd:annotation>
                            <xsd:documentation>
                                The token value.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:rawType>true</a:rawType> <!-- TODO ok? -->
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="liveSyncWorkState" type="tns:LiveSyncWorkStateType"/>

    <xsd:complexType name="ReportExportWorkStateType">
        <xsd:annotation>
            <xsd:documentation>
                State of the report export activity.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractActivityWorkStateType">
                <xsd:sequence>
                    <xsd:element minOccurs="0" name="reportDataRef" type="tns:ObjectReferenceType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Report data that have been exported.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:objectReferenceTargetType>tns:ReportDataType</a:objectReferenceTargetType>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="reportExportWorkStateType" type="tns:ReportExportWorkStateType"/>

    <xsd:complexType name="WorkersReconciliationResultType">
        <xsd:annotation>
            <xsd:documentation>
                Result of the workers reconciliation process.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="rootTaskRef" type="tns:ObjectReferenceType">
                <xsd:annotation>
                    <xsd:documentation>
                        Root task.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:objectReferenceTargetType>tns:TaskType</a:objectReferenceTargetType>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="coordinatorTaskRef" type="tns:ObjectReferenceType">
                <xsd:annotation>
                    <xsd:documentation>
                        Coordinator task.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:objectReferenceTargetType>tns:TaskType</a:objectReferenceTargetType>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="activityPath" type="tns:ActivityPathType">
                <xsd:annotation>
                    <xsd:documentation>
                        Path of distributed activity.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="existing" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        Number of existing worker tasks on start.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="required" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        Number of required worker tasks.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="matched" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        Number of worker tasks that matched their specification.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="renamed" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        Number of worker tasks that were renamed to match their specification.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="adapted" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        Number of worker tasks that were adapted (renamed + set the scavenger flag) to match their specification.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="suspended" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        Number of ready worker tasks that were suspended because they were on wrong node or superfluous.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="closedDone" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        Number of worker tasks that were closed because the work was done.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="created" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        Number of worker tasks that were created.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="resumed" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        Number of worker tasks that were resumed.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="status" type="tns:OperationResultStatusType"/>
        </xsd:sequence>
    </xsd:complexType>
    <xsd:element name="workersReconciliationResult" type="tns:WorkersReconciliationResultType"/>

    <xsd:complexType name="AutoScalingDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Defines how auto-scaling should be carried out.
                (Currently the definition is trivial. This is more or less a placeholder for the future.)
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
                <a:experimental>true</a:experimental>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element default="true" minOccurs="0" name="enabled" type="xsd:boolean">
                <xsd:annotation>
                    <xsd:documentation>
                        Is autoscaling enabled for this activity? The default is "true" if the autoscaling definition
                        exists. (Note that this may change in the future.)
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="ActivityPoliciesStateType">
        <xsd:annotation>
            <xsd:documentation>
                State of policies related to execution of activity, grouped into related categories.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.10</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="policy" type="tns:ActivityPolicyStateType">
                <xsd:annotation>
                    <xsd:documentation>
                        Policy state related to the evaluation of activity policy.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>
    <xsd:element name="activityPoliciesState" type="tns:ActivityPoliciesStateType"/>

    <xsd:complexType name="ActivityPolicyStateType">
        <xsd:annotation>
            <xsd:documentation>
                The state of a single policy.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.10</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="identifier" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        Policy identifier (key).
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="name" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        Policy name.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="trigger" type="tns:EvaluatedActivityPolicyTriggerType">
                <xsd:annotation>
                    <xsd:documentation>
                        Triggers associated with the policy.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>
    <xsd:element name="activityPolicyState" type="tns:ActivityPolicyStateType"/>

    <xsd:complexType name="EvaluatedActivityPolicyTriggerType">
        <xsd:annotation>
            <xsd:documentation>
                A single policy trigger.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.10</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="constraintName" type="xsd:string"/>
            <xsd:element minOccurs="0" name="message" type="tns:LocalizableMessageType"/>
        </xsd:sequence>
    </xsd:complexType>
    <xsd:element name="evaluatedActivityPolicyTrigger" type="tns:EvaluatedActivityPolicyTriggerType"/>

    <xsd:complexType name="ActivityCounterGroupsType">
        <xsd:annotation>
            <xsd:documentation>
                Counters related to the execution of the activity, grouped into related categories.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
                <a:experimental>true</a:experimental>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="previewModePolicyRules" type="tns:ActivityCounterGroupType">
                <xsd:annotation>
                    <xsd:documentation>
                        Counters for policy rules in preview mode.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="fullExecutionModePolicyRules" type="tns:ActivityCounterGroupType">
                <xsd:annotation>
                    <xsd:documentation>
                        Counters for policy rules in full execution mode.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>
    <xsd:element name="activityCounterGroups" type="tns:ActivityCounterGroupsType"/>

    <xsd:complexType name="ActivityCounterGroupType">
        <xsd:annotation>
            <xsd:documentation>
                A group of related counters.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
                <a:experimental>true</a:experimental>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="counter" type="tns:ActivityCounterType">
                <xsd:annotation>
                    <xsd:documentation>
                        A single counter.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>
    <xsd:element name="activityCounterGroup" type="tns:ActivityCounterGroupType"/>

    <xsd:complexType name="ActivityCounterType">
        <xsd:annotation>
            <xsd:documentation>
                A single counter.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
                <a:experimental>true</a:experimental>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="identifier" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        Counter identifier (key).
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="value" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        Current counter value.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <!-- TODO other data, like start timestamp (maybe) -->
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>
    <xsd:element name="activityCounter" type="tns:ActivityCounterType"/>

    <xsd:complexType name="TaskAutoScalingType">
        <xsd:annotation>
            <xsd:documentation>
                Auto-scaling configuration for the task.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.4</a:since>
                <a:experimental>true</a:experimental>
                <a:container>true</a:container>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="mode" type="tns:TaskAutoScalingModeType">
                <xsd:annotation>
                    <xsd:documentation>
                        Auto-scaling mode.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>

    <xsd:simpleType name="TaskAutoScalingModeType">
        <xsd:annotation>
            <xsd:documentation>
                Mode of task auto-scaling.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="disabled">
                <xsd:annotation>
                    <xsd:documentation>
                        Auto-scaling is disabled for this task.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="DISABLED"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="default">
                <xsd:annotation>
                    <xsd:documentation>
                        Default auto-scaling strategy is to be used. TODO
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="DEFAULT"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:complexType name="ActivityAutoScalingWorkDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Work definition for the auto-scaling activity.
            </xsd:documentation>
            <xsd:appinfo>
                <a:experimental>true</a:experimental>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractWorkDefinitionType">
                <xsd:sequence>
                    <xsd:element minOccurs="0" name="tasks" type="tns:ObjectSetType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Tasks that should be covered by this activity. The default is to cover
                                all running tasks that have some children and that do not have autoscaling disabled.

                                This specification extends this default.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:schemaContext>
                                    <a:type>tns:TaskType</a:type>
                                </a:schemaContext>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="minReconciliationInterval" type="xsd:duration">
                        <xsd:annotation>
                            <xsd:documentation>
                                If specified, reconciliation is postponed if specified interval has not elapsed
                                after previous reconciliation.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="maxReconciliationInterval" type="xsd:duration">
                        <xsd:annotation>
                            <xsd:documentation>
                                If specified, a reconciliation is forced after specified time even if no cluster state
                                changes are detected.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element default="false" minOccurs="0" name="skipInitialReconciliation" type="xsd:boolean">
                        <xsd:annotation>
                            <xsd:documentation>
                                If true, the initial reconciliation (when the cluster state is first determined) should be skipped.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="activityAutoScalingWorkDefinition" type="tns:ActivityAutoScalingWorkDefinitionType"/>

    <xsd:complexType name="ActivityAutoScalingWorkStateType">
        <xsd:annotation>
            <xsd:documentation>
                Work state for the auto scaling activity.
            </xsd:documentation>
            <xsd:appinfo>
                <a:experimental>true</a:experimental>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractActivityWorkStateType">
                <xsd:sequence>
                    <xsd:element minOccurs="0" name="lastClusterState" type="tns:ClusterStateType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Last known cluster state.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="lastClusterStateChangeTimestamp" type="xsd:dateTime">
                        <xsd:annotation>
                            <xsd:documentation>
                                Time when the cluster state last changed.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="lastReconciliationTimestamp" type="xsd:dateTime">
                        <xsd:annotation>
                            <xsd:documentation>
                                When was the last reconciliation started? (With one exception: if initial reconciliation
                                is being skipped, the time of that skipped reconciliation is written here.)
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="reconciliationPending" type="xsd:boolean">
                        <xsd:annotation>
                            <xsd:documentation>
                                Is reconciliation pending, i.e. was it determined to start but was postponed because
                                of the minimal interval requirement?
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="activityAutoScalingWorkState" type="tns:ActivityAutoScalingWorkStateType"/>

    <xsd:complexType name="ClusterStateType">
        <xsd:annotation>
            <xsd:documentation>
                State of the cluster for the purposes of auto-scaling.
            </xsd:documentation>
            <xsd:appinfo>
                <a:experimental>true</a:experimental>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="nodeUp" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        Nodes that are up (according to operational state in repo).
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="nodeUpAndAlive" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        Nodes that are up and alive (according to operational state + last check-in time in repo).
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="NoOpWorkDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Work definition for a no-op activity.
            </xsd:documentation>
            <xsd:appinfo>
                <a:experimental>true</a:experimental>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractWorkDefinitionType">
                <xsd:sequence>
                    <xsd:element minOccurs="0" name="steps" type="xsd:int"/>
                    <xsd:element minOccurs="0" name="delay" type="xsd:int"/>
                    <xsd:element default="none" minOccurs="0" name="stepInterruptibility" type="tns:NoOpActivityStepInterruptibilityType"/>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="noOpWorkDefinition" type="tns:NoOpWorkDefinitionType"/>

    <xsd:simpleType name="NoOpActivityStepInterruptibilityType">
        <xsd:annotation>
            <xsd:documentation>
                Should a step of NoOp activity be interruptible?
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>4.4</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="full">
                <xsd:annotation>
                    <xsd:documentation>
                        The activity can be interrupted any time.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="FULL"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="hard">
                <xsd:annotation>
                    <xsd:documentation>
                        The activity can be interrupted only in "hard" way, i.e. by sending the Java interrupt signal.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="HARD"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="none">
                <xsd:annotation>
                    <xsd:documentation>
                        The activity is not interruptible, except at step boundaries.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="NONE"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:complexType name="ActivityReportsType">
        <xsd:annotation>
            <xsd:documentation>
                Reports related to activity execution.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
                <a:experimental>true</a:experimental>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="buckets" type="tns:ActivityReportCollectionType">
                <xsd:annotation>
                    <xsd:documentation>
                        Report(s) on the level of buckets.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="items" type="tns:ActivityReportCollectionType">
                <xsd:annotation>
                    <xsd:documentation>
                        Report(s) on the level of items.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="connIdOperations" type="tns:ActivityReportCollectionType">
                <xsd:annotation>
                    <xsd:documentation>
                        Report(s) on the level of ConnId operations.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="internalOperations" type="tns:ActivityReportCollectionType">
                <xsd:annotation>
                    <xsd:documentation>
                        Report(s) on the level of midPoint internal operations (based on OperationResult trees).
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>

    <xsd:complexType name="ActivityReportCollectionType">
        <xsd:annotation>
            <xsd:documentation>
                A collection of related report data objects.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
                <a:experimental>true</a:experimental>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="rawDataRef" type="tns:ObjectReferenceType">
                <xsd:annotation>
                    <xsd:documentation>
                        "Raw" (or streamed) report data objects collection.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:objectReferenceTargetType>tns:ReportDataType</a:objectReferenceTargetType>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>

    <xsd:complexType name="BucketProcessingRecordType">
        <xsd:annotation>
            <xsd:documentation>
                Information about bucket completion or analysis to be recorded in buckets report.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
                <a:experimental>true</a:experimental>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="sequentialNumber" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        Bucket sequential number.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="content" type="tns:AbstractWorkBucketContentType">
                <xsd:annotation>
                    <xsd:documentation>
                        Bucket content in full details.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="size" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        Size of the bucket, as determined in bucket analysis mode by counting the objects,
                        or as determined by counting items processed in other modes.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="itemsSuccessfullyProcessed" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        Number of items successfully processed.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="itemsFailed" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        Number of items failed to be processed.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="itemsSkipped" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        Number of items that have been skipped.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="startTimestamp" type="xsd:dateTime">
                <xsd:annotation>
                    <xsd:documentation>
                        When the bucket processing started. (Excludes the bucket acquisition.)
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="endTimestamp" type="xsd:dateTime">
                <xsd:annotation>
                    <xsd:documentation>
                        When the bucket processing finished. (Excludes the bucket completion marking.)
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="duration" type="xsd:long">
                <xsd:annotation>
                    <xsd:documentation>
                        How many milliseconds did the bucket processing take.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>

    <xsd:complexType name="ItemProcessingRecordType">
        <xsd:annotation>
            <xsd:documentation>
                Information about item processing to be recorded in items report.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
                <a:experimental>true</a:experimental>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="sequentialNumber" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        Item sequential number.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="name" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        Item name (e.g. object name).
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="displayName" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        Item display name (e.g. object display name), if applicable.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="type" type="xsd:QName">
                <xsd:annotation>
                    <xsd:documentation>
                        Item type (e.g. object type), if applicable.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="oid" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        Item OID (e.g. object OID), if applicable.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="bucketSequentialNumber" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        Bucket sequential number.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="outcome" type="tns:QualifiedItemProcessingOutcomeType">
                <xsd:annotation>
                    <xsd:documentation>
                        Outcome of the processing.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="startTimestamp" type="xsd:dateTime">
                <xsd:annotation>
                    <xsd:documentation>
                        When the item processing started.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="endTimestamp" type="xsd:dateTime">
                <xsd:annotation>
                    <xsd:documentation>
                        When the item processing finished.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="duration" type="xsd:double">
                <xsd:annotation>
                    <xsd:documentation>
                        How many milliseconds did the bucket processing take.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="errorMessage" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        Error message related to the processing. May be shortened. May not be accurate. (Very experimental.)
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>

    <xsd:complexType name="ItemRelatedRecordType">
        <xsd:annotation>
            <xsd:documentation>
                Columns common to all specific item-related reports (like ConnId operations, internal operations, etc).
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
                <a:experimental>true</a:experimental>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="itemSequentialNumber" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        Item sequential number.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="itemName" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        Item name (e.g. object name).
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="itemOid" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        Item OID (e.g. object OID), if applicable.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="bucketSequentialNumber" type="xsd:int">
                <xsd:annotation>
                    <xsd:documentation>
                        Bucket sequential number.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>

    <xsd:complexType name="ConnIdOperationRecordType">
        <xsd:annotation>
            <xsd:documentation>
                Information about a ConnId operation.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
                <a:experimental>true</a:experimental>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:ItemRelatedRecordType">
                <xsd:sequence>
                    <xsd:element minOccurs="0" name="identifier" type="xsd:string">
                        <xsd:annotation>
                            <xsd:documentation>
                                Lightweight identifier of the ConnId operation.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="resourceRef" type="tns:ObjectReferenceType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Reference to the resource. It should have name filled-in.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:objectReferenceTargetType>tns:ResourceType</a:objectReferenceTargetType>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="objectClass" type="xsd:QName"/>
                    <xsd:element minOccurs="0" name="operation" type="xsd:string">
                        <xsd:annotation>
                            <xsd:documentation>
                                Plain operation name, e.g. get, search, etc. It is a free-form string (not an enum)
                                to be compatible with provisioning statistics. This may change in the future.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="status" type="tns:OperationResultStatusType">
                        <xsd:annotation>
                            <xsd:documentation>
                                What was the result status of the operation?
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="message" type="xsd:string">
                        <xsd:annotation>
                            <xsd:documentation>
                                Resulting message (typically an exception message).
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="size" type="xsd:int">
                        <xsd:annotation>
                            <xsd:documentation>
                                "Size" of the operation. E.g. for search operations here is the number of objects returned.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="startTimestamp" type="xsd:dateTime">
                        <xsd:annotation>
                            <xsd:documentation>
                                When did the operation started?
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="endTimestamp" type="xsd:dateTime">
                        <xsd:annotation>
                            <xsd:documentation>
                                When did the operation finished?
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="duration" type="xsd:double">
                        <xsd:annotation>
                            <xsd:documentation>
                                How many milliseconds did the operation take.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:complexType name="InternalOperationRecordType">
        <xsd:annotation>
            <xsd:documentation>
                Information about a midPoint internal operation.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.4</a:since>
                <a:experimental>true</a:experimental>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:ItemRelatedRecordType">
                <xsd:sequence>
                    <xsd:element minOccurs="0" name="operation" type="xsd:string">
                        <xsd:annotation>
                            <xsd:documentation>
                                Name of the operation
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="qualifiers" type="xsd:string">
                        <xsd:annotation>
                            <xsd:documentation>
                                Qualifiers joined into a single field. (Will be replaced with something smarter in the future.)
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="operationKind" type="tns:OperationKindType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Kind of operation (e.g. clockwork execution, mapping evaluation, repository access). To be used
                                for easy navigation, result filtering, and so on.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="status" type="tns:OperationResultStatusType"/>
                    <xsd:element minOccurs="0" name="importance" type="tns:OperationResultImportanceType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Importance of the operation result (major, normal, minor). The default is "normal".
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="asynchronousOperationReference" type="xsd:string">
                        <xsd:annotation>
                            <xsd:documentation>
                                Identifier (reference) of asynchronous operation.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="start" type="xsd:dateTime">
                        <xsd:annotation>
                            <xsd:documentation>
                                When the operation started.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="end" type="xsd:dateTime">
                        <xsd:annotation>
                            <xsd:documentation>
                                When the operation finished.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="microseconds" type="xsd:long">
                        <xsd:annotation>
                            <xsd:documentation>
                                How long the operation took (if known).
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="cpuMicroseconds" type="xsd:long">
                        <xsd:annotation>
                            <xsd:documentation>
                                How much CPU time the operation took (if known).
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="invocationId" type="xsd:long">
                        <xsd:annotation>
                            <xsd:documentation>
                                ID of the operation invocation (if known).
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="params" type="tns:ParamsType"/> <!-- TODO -->
                    <xsd:element minOccurs="0" name="context" type="tns:ParamsType"/> <!-- TODO -->
                    <xsd:element minOccurs="0" name="returns" type="tns:ParamsType"/> <!-- TODO -->
                    <xsd:element minOccurs="0" name="token" type="xsd:long"/>
                    <xsd:element minOccurs="0" name="messageCode" type="xsd:string"/>
                    <xsd:element minOccurs="0" name="message" type="xsd:string">
                        <xsd:annotation>
                            <xsd:documentation>
                                Error or warning message.
                                This is optional, as some types does not need a message (e.g. success).
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="parent" type="xsd:long">
                        <xsd:annotation>
                            <xsd:documentation>
                                Token of the parent operation result.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:complexType name="ActivitySimulationStateType">
        <xsd:annotation>
            <xsd:documentation>
                State related to the "simulated" execution of this activity (and its children).
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.7</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="resultRef" type="tns:ObjectReferenceType">
                <xsd:annotation>
                    <xsd:documentation>
                        Reference to the object into which the results of the simulation should be stored.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:objectReferenceTargetType>tns:SimulationResultType</a:objectReferenceTargetType>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="resultCreated" type="xsd:boolean">
                <xsd:annotation>
                    <xsd:documentation>
                        Was the result created in this activity ("true") or in some of its ancestors or not at all ("false")?
                        We can close it only in the former case, to avoid writing to closed results in follow-on activities.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long"/>
    </xsd:complexType>

    <xsd:complexType name="TaskAffectedObjectsType">
        <xsd:annotation>
            <xsd:documentation>
                Searchable computed indexes, which tries to capture common parameters used to identify objects
                (and resource objects), which are expected to be affected by execution of the task.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.8</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="activity" type="tns:ActivityAffectedObjectsType">
                <xsd:annotation>
                    <xsd:documentation>
                        Objects affected by a simple activity. Effects of composite activities are represented by multiple
                        values of this item (without representing any particular tree structure).
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>
    <xsd:element name="taskAffectedObjects" type="tns:TaskAffectedObjectsType"/>

    <xsd:complexType name="ActivityAffectedObjectsType">
        <xsd:annotation>
            <xsd:documentation>
                Objects affected by a simple activity.

                Note that only selected activities are supported here.
                Activity tailoring is not supported either.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.8</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="activityType" type="xsd:QName">
                <xsd:annotation>
                    <xsd:documentation>
                        Type of activity (identified by configuration item name) carried out on objects mentioned here.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:displayName>ActivityAffectedObjectsType.activity</a:displayName>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
            <xsd:choice>
                <xsd:element minOccurs="0" name="resourceObjects" type="tns:BasicResourceObjectSetType">
                    <xsd:annotation>
                        <xsd:documentation>
                            Resource objects (defined by their object class, intent/kind), which are affected by the activity.
                            Does not contain explicit enumeration of affected resource objects.
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element minOccurs="0" name="objects" type="tns:BasicObjectSetType">
                    <xsd:annotation>
                        <xsd:documentation>
                            Repository objects (defined by their type and archetype), which are affected by the activity.
                            Does not contain explicit enumeration of affected objects.
                        </xsd:documentation>
                        <xsd:appinfo>
                            <a:schemaContext>
                                <a:typePath>type</a:typePath>
                            </a:schemaContext>
                        </xsd:appinfo>
                    </xsd:annotation>
                </xsd:element>
            </xsd:choice>
            <xsd:element minOccurs="0" name="executionMode" type="tns:ExecutionModeType">
                <xsd:annotation>
                    <xsd:documentation>
                        Execution mode for this activity: full, preview, dryRun, none, bucketAnalysis, ...
                        See ActivityExecutionModeDefinitionType.mode.
                        Should be always present, as "full" is the default value.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:displayName>ActivityAffectedObjectsType.executionMode</a:displayName>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="predefinedConfigurationToUse" type="tns:PredefinedConfigurationType">
                <xsd:annotation>
                    <xsd:documentation>
                        Predefined configuration that is/was used for this activity.
                        In current midPoint version it should be always present, as we do not allow specification of
                        a configuration other than a predefined one.
                        Later, it may be unspecified if no predefined configuration applies.
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:displayName>ActivityAffectedObjectsType.predefinedConfigurationToUse</a:displayName>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>
    <xsd:element name="activityAffectedObjects" type="tns:ActivityAffectedObjectsType"/>

    <xsd:complexType name="RoleMembershipManagementWorkDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Definition of "role membership management" activity. Currently, it assigns new members to a role,
                and un-assigns legacy roles (induced by the business role) from them.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.8</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractWorkDefinitionType">
                <xsd:sequence>
                    <xsd:element name="roleRef" type="tns:ObjectReferenceType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Role whose membership we are going to manage.
                                It must exist before execution of this activity.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:objectReferenceTargetType>tns:AbstractRoleType</a:objectReferenceTargetType>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element name="members" type="tns:ObjectSetType">
                        <xsd:annotation>
                            <xsd:documentation>
                                Prospective members of the role.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:schemaContext>
                                    <a:type>tns:AssignmentHolderType</a:type>
                                </a:schemaContext>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element minOccurs="0" name="executionOptions" type="tns:ModelExecuteOptionsType"/>
                    <!-- "business" operation options i.e. what we actually want to do (assigning/unassigning members) -->
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="roleMembershipManagementWorkDefinition" type="tns:RoleMembershipManagementWorkDefinitionType"/>

    <xsd:complexType name="RoleAnalysisClusteringWorkDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                TODO
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.8</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractWorkDefinitionType">
                <xsd:sequence>
                    <xsd:element name="sessionRef" type="tns:ObjectReferenceType">
                        <xsd:annotation>
                            <xsd:documentation>
                                TODO
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:objectReferenceTargetType>tns:RoleAnalysisSessionType</a:objectReferenceTargetType>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="roleAnalysisClusteringWorkDefinition" type="tns:RoleAnalysisClusteringWorkDefinitionType"/>

    <xsd:complexType name="RoleAnalysisPatternDetectionWorkDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                TODO
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.8</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractWorkDefinitionType">
                <xsd:sequence>
                    <xsd:element name="clusterRef" type="tns:ObjectReferenceType">
                        <xsd:annotation>
                            <xsd:documentation>
                                TODO
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:objectReferenceTargetType>tns:RoleAnalysisClusterType</a:objectReferenceTargetType>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="roleAnalysisPatternDetectionWorkDefinition" type="tns:RoleAnalysisPatternDetectionWorkDefinitionType"/>

    <xsd:complexType name="AbstractCertificationWorkDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Work definition for the certification related operations.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.9</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractWorkDefinitionType">
                <xsd:sequence>
                    <xsd:element name="certificationCampaignRef" type="tns:ObjectReferenceType">
                        <xsd:annotation>
                            <xsd:documentation>
                                The reference to the specified certification campaign which was processed
                                during the operation.
                            </xsd:documentation>
                            <xsd:appinfo>
                                <a:objectReferenceTargetType>tns:AccessCertificationCampaignType</a:objectReferenceTargetType>
                                <a:displayName>AbstractCertificationWorkDefinitionType.certificationCampaignRef</a:displayName>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:complexType name="CertificationRemediationWorkDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Work definition for the certification campaign remediation operation.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.9</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractCertificationWorkDefinitionType">
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="certificationRemediationWorkDefinition" type="tns:CertificationRemediationWorkDefinitionType"/>

    <xsd:complexType name="CertificationOpenNextStageWorkDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Work definition for the opening next stage of the certification campaign operation.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.9</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractCertificationWorkDefinitionType">
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="certificationNextStageWorkDefinition" type="tns:CertificationOpenNextStageWorkDefinitionType"/>

    <xsd:complexType name="CertificationStartCampaignWorkDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Work definition for the start certification campaign operation.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.9</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractCertificationWorkDefinitionType">
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="certificationStartCampaignWorkDefinition" type="tns:CertificationStartCampaignWorkDefinitionType"/>

    <xsd:complexType name="CertificationCloseCurrentStageWorkDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Work definition for the close current stage of the certification campaign operation.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.9</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractCertificationWorkDefinitionType">
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="certificationCloseCurrentStageWorkDefinition" type="tns:CertificationCloseCurrentStageWorkDefinitionType"/>

    <xsd:complexType name="CertificationReiterateCampaignWorkDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Work definition for the certification campaign reiteration operation.
            </xsd:documentation>
            <xsd:appinfo>
                <a:container>true</a:container>
                <a:since>4.9</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="tns:AbstractCertificationWorkDefinitionType">
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="certificationReiterateCampaignWorkDefinition" type="tns:CertificationReiterateCampaignWorkDefinitionType"/>
</xsd:schema>