Search in sources :

Example 1 with TaskAutoScalingType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.TaskAutoScalingType in project midpoint by Evolveum.

the class QTaskMapping method toRowObjectWithoutFullObject.

@Override
@NotNull
public MTask toRowObjectWithoutFullObject(TaskType task, JdbcSession jdbcSession) {
    MTask row = super.toRowObjectWithoutFullObject(task, jdbcSession);
    row.taskIdentifier = task.getTaskIdentifier();
    row.binding = task.getBinding();
    row.category = task.getCategory();
    row.completionTimestamp = MiscUtil.asInstant(task.getCompletionTimestamp());
    row.executionState = task.getExecutionState();
    // Logically resultStatus is task.getResult().getStatus(), but repo is NOT responsible for
    // this synchronization - Task manager is - for repo these are two separate attributes.
    OperationResultType operationResult = task.getResult();
    if (operationResult != null) {
        row.fullResult = repositoryContext().createFullResult(operationResult);
    }
    row.resultStatus = task.getResultStatus();
    row.handlerUriId = processCacheableUri(task.getHandlerUri());
    row.lastRunStartTimestamp = MiscUtil.asInstant(task.getLastRunStartTimestamp());
    row.lastRunFinishTimestamp = MiscUtil.asInstant(task.getLastRunFinishTimestamp());
    row.node = task.getNode();
    setReference(task.getObjectRef(), o -> row.objectRefTargetOid = o, t -> row.objectRefTargetType = t, r -> row.objectRefRelationId = r);
    setReference(task.getOwnerRef(), o -> row.ownerRefTargetOid = o, t -> row.ownerRefTargetType = t, r -> row.ownerRefRelationId = r);
    row.parent = task.getParent();
    // Using effective recurrence instead of specified one might be questionable, but
    // it's needed to reasonably use filtering based on recurrence.
    // (Otherwise the null value of recurrence is really ambiguous.)
    row.recurrence = TaskTypeUtil.getEffectiveRecurrence(task);
    row.schedulingState = task.getSchedulingState();
    TaskAutoScalingType autoScaling = task.getAutoScaling();
    if (autoScaling != null) {
        row.autoScalingMode = autoScaling.getMode();
    }
    row.threadStopAction = task.getThreadStopAction();
    row.waitingReason = task.getWaitingReason();
    row.dependentTaskIdentifiers = stringsToArray(task.getDependent());
    return row;
}
Also used : TaskAutoScalingType(com.evolveum.midpoint.xml.ns._public.common.common_3.TaskAutoScalingType) OperationResultType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with TaskAutoScalingType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.TaskAutoScalingType in project midpoint by Evolveum.

the class RTask method copyFromJAXB.

// dynamically called
public static void copyFromJAXB(TaskType jaxb, RTask repo, RepositoryContext repositoryContext, IdGeneratorResult generatorResult) throws DtoTranslationException {
    copyAssignmentHolderInformationFromJAXB(jaxb, repo, repositoryContext, generatorResult);
    repo.setNameCopy(RPolyString.copyFromJAXB(jaxb.getName()));
    repo.setTaskIdentifier(jaxb.getTaskIdentifier());
    repo.setExecutionStatus(RUtil.getRepoEnumValue(jaxb.getExecutionState(), RTaskExecutionState.class));
    repo.setHandlerUri(jaxb.getHandlerUri());
    repo.setLastRunFinishTimestamp(jaxb.getLastRunFinishTimestamp());
    repo.setCompletionTimestamp(jaxb.getCompletionTimestamp());
    repo.setLastRunStartTimestamp(jaxb.getLastRunStartTimestamp());
    repo.setNode(jaxb.getNode());
    repo.setBinding(RUtil.getRepoEnumValue(jaxb.getBinding(), RTaskBinding.class));
    repo.setRecurrence(RUtil.getRepoEnumValue(TaskTypeUtil.getEffectiveRecurrence(jaxb), RTaskRecurrence.class));
    repo.setThreadStopAction(RUtil.getRepoEnumValue(jaxb.getThreadStopAction(), RThreadStopAction.class));
    repo.setCategory(jaxb.getCategory());
    repo.setParent(jaxb.getParent());
    repo.setObjectRef(RUtil.jaxbRefToEmbeddedRepoRef(jaxb.getObjectRef(), repositoryContext.relationRegistry));
    repo.setOwnerRefTask(RUtil.jaxbRefToEmbeddedRepoRef(jaxb.getOwnerRef(), repositoryContext.relationRegistry));
    repo.setWaitingReason(RUtil.getRepoEnumValue(jaxb.getWaitingReason(), RTaskWaitingReason.class));
    repo.setSchedulingState(RUtil.getRepoEnumValue(jaxb.getSchedulingState(), RTaskSchedulingState.class));
    repo.setDependent(RUtil.listToSet(jaxb.getDependent()));
    TaskAutoScalingType autoScaling = jaxb.getAutoScaling();
    if (autoScaling != null) {
        RTaskAutoScaling rAutoScaling = new RTaskAutoScaling();
        RTaskAutoScaling.fromJaxb(autoScaling, rAutoScaling);
        repo.setAutoScaling(rAutoScaling);
    }
    RUtil.copyResultFromJAXB(TaskType.F_RESULT, jaxb.getResult(), repo, repositoryContext.prismContext);
}
Also used : TaskAutoScalingType(com.evolveum.midpoint.xml.ns._public.common.common_3.TaskAutoScalingType) RTaskAutoScaling(com.evolveum.midpoint.repo.sql.data.common.embedded.RTaskAutoScaling)

Aggregations

TaskAutoScalingType (com.evolveum.midpoint.xml.ns._public.common.common_3.TaskAutoScalingType)2 RTaskAutoScaling (com.evolveum.midpoint.repo.sql.data.common.embedded.RTaskAutoScaling)1 OperationResultType (com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType)1 NotNull (org.jetbrains.annotations.NotNull)1