Search in sources :

Example 6 with PipelineExecutionTrace

use of org.guvnor.ala.ui.model.PipelineExecutionTrace in project kie-wb-common by kiegroup.

the class RuntimeListItemBuilder method build.

public RuntimeListItem build() {
    RuntimeListItem result;
    PipelineExecutionTrace pipelineTrace;
    String runtimeName;
    if (item.getRuntimeName() != null) {
        runtimeName = item.getRuntimeName();
    } else {
        runtimeName = item.getRuntimeId();
    }
    if (item.getPipelineExecutionId() != null) {
        final Pipeline pipeline = new Pipeline(new PipelineKey(item.getPipelineId()));
        pipelineTrace = new PipelineExecutionTrace(new PipelineExecutionTraceKey(item.getPipelineExecutionId()));
        pipelineTrace.setPipelineStatus(transformToPipelineStatus(item.getPipelineStatus()));
        pipelineTrace.setPipelineError(new PipelineError(item.getPipelineError(), item.getPipelineErrorDetail()));
        item.getPipelineStageItems().getItems().forEach(stage -> {
            pipeline.addStage(new Stage(pipeline.getKey(), stage.getName()));
            pipelineTrace.setStageStatus(stage.getName(), transformToPipelineStatus(stage.getStatus()));
            pipelineTrace.setStageError(stage.getName(), new PipelineError(stage.getStageError(), stage.getStageErrorDetail()));
        });
        pipelineTrace.setPipeline(pipeline);
    } else {
        pipelineTrace = null;
    }
    if (item.getRuntimeId() != null) {
        final Runtime runtime = new Runtime(new RuntimeKey(new ProviderKey(new ProviderTypeKey(item.getProviderTypeName(), item.getProviderVersion()), item.getProviderId()), item.getRuntimeId()), item.getRuntimeStatus(), item.getRuntimeEndpoint(), item.getStartedAt());
        runtime.setPipelineTrace(pipelineTrace);
        result = new RuntimeListItem(runtimeName, runtime);
    } else {
        result = new RuntimeListItem(runtimeName, pipelineTrace);
    }
    return result;
}
Also used : Runtime(org.guvnor.ala.ui.model.Runtime) RuntimeListItem(org.guvnor.ala.ui.model.RuntimeListItem) PipelineKey(org.guvnor.ala.ui.model.PipelineKey) ProviderKey(org.guvnor.ala.ui.model.ProviderKey) PipelineExecutionTrace(org.guvnor.ala.ui.model.PipelineExecutionTrace) Stage(org.guvnor.ala.ui.model.Stage) RuntimeKey(org.guvnor.ala.ui.model.RuntimeKey) PipelineExecutionTraceKey(org.guvnor.ala.ui.model.PipelineExecutionTraceKey) ProviderTypeKey(org.guvnor.ala.ui.model.ProviderTypeKey) Pipeline(org.guvnor.ala.ui.model.Pipeline) PipelineError(org.guvnor.ala.ui.model.PipelineError)

Aggregations

PipelineExecutionTrace (org.guvnor.ala.ui.model.PipelineExecutionTrace)6 PipelineExecutionTraceKey (org.guvnor.ala.ui.model.PipelineExecutionTraceKey)3 Runtime (org.guvnor.ala.ui.model.Runtime)2 RuntimeListItem (org.guvnor.ala.ui.model.RuntimeListItem)2 Stage (org.guvnor.ala.ui.model.Stage)2 StagePresenter (org.guvnor.ala.ui.client.widget.pipeline.stage.StagePresenter)1 TransitionPresenter (org.guvnor.ala.ui.client.widget.pipeline.transition.TransitionPresenter)1 Pipeline (org.guvnor.ala.ui.model.Pipeline)1 PipelineError (org.guvnor.ala.ui.model.PipelineError)1 PipelineKey (org.guvnor.ala.ui.model.PipelineKey)1 PipelineStatus (org.guvnor.ala.ui.model.PipelineStatus)1 ProviderKey (org.guvnor.ala.ui.model.ProviderKey)1 ProviderTypeKey (org.guvnor.ala.ui.model.ProviderTypeKey)1 RuntimeKey (org.guvnor.ala.ui.model.RuntimeKey)1 Test (org.junit.Test)1