Commit ba5d5da8 authored by Dmitriy Novikov's avatar Dmitriy Novikov
Browse files

Fixed constructors

parent 7abc7579
Pipeline #67903 failed with stages
in 164 minutes and 7 seconds
package org.opengroup.osdu.workflow.service;
import java.util.Collections;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.opengroup.osdu.core.common.exception.BadRequestException;
......@@ -16,9 +18,6 @@ import org.opengroup.osdu.workflow.provider.interfaces.IWorkflowRunService;
import org.opengroup.osdu.workflow.provider.interfaces.IWorkflowSystemMetadataRepository;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
@Service
@RequiredArgsConstructor
public class WorkflowManagerServiceImpl implements IWorkflowManagerService {
......@@ -106,7 +105,11 @@ public class WorkflowManagerServiceImpl implements IWorkflowManagerService {
} else {
savedMetadata = workflowSystemMetadataRepository.createSystemWorkflow(workflowMetadata);
}
final WorkflowEngineRequest rq = new WorkflowEngineRequest(workflowMetadata.getWorkflowName(), false, isSystemWorkflow);
final WorkflowEngineRequest rq =
WorkflowEngineRequest.builder()
.workflowName(workflowMetadata.getWorkflowName())
.isSystemWorkflow(isSystemWorkflow)
.build();
workflowEngineService.createWorkflow(rq, request.getRegistrationInstructions());
auditLogger.workflowCreateEvent(Collections.singletonList(savedMetadata.toString()));
return savedMetadata;
......@@ -120,7 +123,11 @@ public class WorkflowManagerServiceImpl implements IWorkflowManagerService {
} else {
workflowMetadata = workflowSystemMetadataRepository.getSystemWorkflow(workflowName);
}
WorkflowEngineRequest rq = new WorkflowEngineRequest(workflowName, workflowMetadata.isDeployedThroughWorkflowService(), isSystemWorkflow);
WorkflowEngineRequest rq = WorkflowEngineRequest.builder()
.workflowName(workflowName)
.isDeployedThroughWorkflowService(workflowMetadata.isDeployedThroughWorkflowService())
.isSystemWorkflow(isSystemWorkflow)
.build();
workflowEngineService.deleteWorkflow(rq);
if (!isSystemWorkflow) {
workflowMetadataRepository.deleteWorkflow(workflowName);
......
......@@ -87,7 +87,13 @@ public class WorkflowRunServiceImpl implements IWorkflowRunService {
dagName = workflowMetadata.getWorkflowName();
}
final WorkflowEngineRequest rq = new WorkflowEngineRequest(runId, workflowId, workflowName, dagName, workflowMetadata.isSystemWorkflow());
final WorkflowEngineRequest rq = WorkflowEngineRequest.builder()
.runId(runId)
.workflowId(workflowId)
.workflowName(workflowName)
.dagName(dagName)
.isSystemWorkflow(workflowMetadata.isSystemWorkflow())
.build();
final Map<String, Object> context = createWorkflowPayload(workflowName, runId, dpsHeaders.getCorrelationId(), request);
TriggerWorkflowResponse rs = workflowEngineService.triggerWorkflow(rq, context);
final WorkflowRun workflowRun = buildWorkflowRun(rq, rs);
......@@ -235,8 +241,12 @@ public class WorkflowRunServiceImpl implements IWorkflowRunService {
if (activeStatusTypes.contains(workflowRun.getStatus())) {
final WorkflowMetadata workflowMetadata = getWorkflowByName(workflowRun.getWorkflowName());
final String workflowName = workflowMetadata.getWorkflowName();
final WorkflowEngineRequest rq = new WorkflowEngineRequest(workflowName,
workflowRun.getStartTimeStamp(), workflowRun.getWorkflowEngineExecutionDate(), workflowMetadata.isSystemWorkflow());
final WorkflowEngineRequest rq = WorkflowEngineRequest.builder()
.workflowName(workflowName)
.executionTimeStamp(workflowRun.getStartTimeStamp())
.workflowEngineExecutionDate(workflowRun.getWorkflowEngineExecutionDate())
.isSystemWorkflow(workflowMetadata.isSystemWorkflow())
.build();
final WorkflowStatusType currentStatusType = workflowEngineService.getWorkflowRunStatus(rq);
if (currentStatusType != workflowRun.getStatus() && currentStatusType != null) {
if (getCompletedStatusTypes().contains(currentStatusType)) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment