Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Add WorkFlowExecutionResponseDTO #371

Merged
merged 2 commits into from
May 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
import com.redhat.parodos.sdk.model.ArgumentRequestDTO;
import com.redhat.parodos.sdk.model.WorkFlowContextResponseDTO;
import com.redhat.parodos.sdk.model.WorkFlowDefinitionResponseDTO;
import com.redhat.parodos.sdk.model.WorkFlowExecutionResponseDTO;
import com.redhat.parodos.sdk.model.WorkFlowExecutionResponseDTO.WorkStatusEnum;
import com.redhat.parodos.sdk.model.WorkFlowRequestDTO;
import com.redhat.parodos.sdk.model.WorkFlowResponseDTO;
import com.redhat.parodos.sdk.model.WorkFlowResponseDTO.WorkStatusEnum;
import com.redhat.parodos.sdk.model.WorkFlowStatusResponseDTO;
import com.redhat.parodos.sdk.model.WorkRequestDTO;
import com.redhat.parodos.sdkutils.SdkUtils;
Expand Down Expand Up @@ -49,7 +49,7 @@ public void runComplexWorkFlow() throws ApiException, InterruptedException {

log.info("Running the Assessment to see what WorkFlows are eligible for this situation:");
WorkflowApi workflowApi = new WorkflowApi(components.apiClient());
WorkFlowResponseDTO workFlowResponseDTO = workflowApi.execute(workFlowRequestDTO);
WorkFlowExecutionResponseDTO workFlowResponseDTO = workflowApi.execute(workFlowRequestDTO);
assertEquals(WorkStatusEnum.IN_PROGRESS, workFlowResponseDTO.getWorkStatus());
log.info("workflow submitted successfully with response: {}", workFlowResponseDTO);

Expand Down Expand Up @@ -103,7 +103,7 @@ public void runComplexWorkFlow() throws ApiException, InterruptedException {
workFlowResponseDTO = workflowApi.execute(workFlowRequestDTO);

assertNotNull("There is no valid WorkFlowExecutionId", workFlowResponseDTO.getWorkFlowExecutionId());
assertEquals(workFlowResponseDTO.getWorkStatus(), WorkStatusEnum.IN_PROGRESS);
assertEquals(WorkStatusEnum.IN_PROGRESS, workFlowResponseDTO.getWorkStatus());
log.info("Onboarding workflow execution id: {}", workFlowResponseDTO.getWorkFlowExecutionId());

workFlowStatusResponseDTO = SdkUtils.waitWorkflowStatusAsync(workflowApi,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
import com.redhat.parodos.flows.common.WorkFlowTestBuilder.TestComponents;
import com.redhat.parodos.sdk.api.WorkflowApi;
import com.redhat.parodos.sdk.invoker.ApiException;
import com.redhat.parodos.sdk.model.WorkFlowExecutionResponseDTO;
import com.redhat.parodos.sdk.model.WorkFlowRequestDTO;
import com.redhat.parodos.sdk.model.WorkFlowResponseDTO;
import com.redhat.parodos.sdk.model.WorkFlowStatusResponseDTO;
import com.redhat.parodos.sdkutils.SdkUtils;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;

import static com.redhat.parodos.sdk.model.WorkFlowExecutionResponseDTO.WorkStatusEnum;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

Expand All @@ -35,10 +36,10 @@ public void runEscalationFlow() throws ApiException, InterruptedException {

log.info("executes 1 task with a WorkFlowChecker");
WorkflowApi workflowApi = new WorkflowApi(components.apiClient());
WorkFlowResponseDTO workFlowResponseDTO = workflowApi.execute(workFlowRequestDTO);
WorkFlowExecutionResponseDTO workFlowResponseDTO = workflowApi.execute(workFlowRequestDTO);

assertNotNull("There is no valid WorkFlowExecutionId", workFlowResponseDTO.getWorkFlowExecutionId());
assertEquals(workFlowResponseDTO.getWorkStatus(), WorkFlowResponseDTO.WorkStatusEnum.IN_PROGRESS);
assertEquals(workFlowResponseDTO.getWorkStatus(), WorkStatusEnum.IN_PROGRESS);
log.info("Escalation workflow execution id: {}", workFlowResponseDTO.getWorkFlowExecutionId());
log.info("Escalation workFlow {}", workFlowResponseDTO.getWorkStatus());
log.info("Waiting for checkers to complete...");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
import com.redhat.parodos.sdk.model.ArgumentRequestDTO;
import com.redhat.parodos.sdk.model.WorkDefinitionResponseDTO;
import com.redhat.parodos.sdk.model.WorkFlowDefinitionResponseDTO;
import com.redhat.parodos.sdk.model.WorkFlowExecutionResponseDTO;
import com.redhat.parodos.sdk.model.WorkFlowExecutionResponseDTO.WorkStatusEnum;
import com.redhat.parodos.sdk.model.WorkFlowRequestDTO;
import com.redhat.parodos.sdk.model.WorkFlowResponseDTO;
import com.redhat.parodos.sdk.model.WorkFlowStatusResponseDTO;
import com.redhat.parodos.sdk.model.WorkRequestDTO;
import com.redhat.parodos.sdkutils.SdkUtils;
Expand Down Expand Up @@ -54,11 +55,11 @@ public void runPreBuiltWorkFlow() throws ApiException, InterruptedException {

WorkflowApi workflowApi = new WorkflowApi(components.apiClient());
log.info("******** Running The PreBuilt Flow ********");
WorkFlowResponseDTO workFlowResponseDTO = workflowApi.execute(workFlowRequestDTO);
WorkFlowExecutionResponseDTO workFlowResponseDTO = workflowApi.execute(workFlowRequestDTO);

assertNotNull(workFlowResponseDTO.getWorkFlowExecutionId());
assertNotNull(workFlowResponseDTO.getWorkStatus());
assertEquals(WorkFlowResponseDTO.WorkStatusEnum.IN_PROGRESS, workFlowResponseDTO.getWorkStatus());
assertEquals(WorkStatusEnum.IN_PROGRESS, workFlowResponseDTO.getWorkStatus());

WorkFlowStatusResponseDTO workFlowStatusResponseDTO = SdkUtils.waitWorkflowStatusAsync(workflowApi,
workFlowResponseDTO.getWorkFlowExecutionId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import com.redhat.parodos.sdk.api.WorkflowApi;
import com.redhat.parodos.sdk.invoker.ApiException;
import com.redhat.parodos.sdk.model.WorkFlowDefinitionResponseDTO;
import com.redhat.parodos.sdk.model.WorkFlowExecutionResponseDTO;
import com.redhat.parodos.sdk.model.WorkFlowExecutionResponseDTO.WorkStatusEnum;
import com.redhat.parodos.sdk.model.WorkFlowRequestDTO;
import com.redhat.parodos.sdk.model.WorkFlowResponseDTO;
import com.redhat.parodos.sdk.model.WorkFlowResponseDTO.WorkStatusEnum;
import com.redhat.parodos.sdk.model.WorkFlowStatusResponseDTO;
import com.redhat.parodos.sdkutils.SdkUtils;
import com.redhat.parodos.workflow.consts.WorkFlowConstants;
Expand Down Expand Up @@ -44,7 +44,7 @@ public void runRollbackWorkFlow() throws ApiException, InterruptedException {
WorkflowApi workflowApi = new WorkflowApi(components.apiClient());
log.info("******** Running The Simple Failed Flow ********");

WorkFlowResponseDTO workFlowResponseDTO = workflowApi.execute(workFlowRequestDTO);
WorkFlowExecutionResponseDTO workFlowResponseDTO = workflowApi.execute(workFlowRequestDTO);

assertNotNull(workFlowResponseDTO.getWorkFlowExecutionId());
assertNotNull(workFlowResponseDTO.getWorkStatus());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
import com.redhat.parodos.sdk.model.WorkFlowDefinitionResponseDTO;
import com.redhat.parodos.sdk.model.WorkFlowDefinitionResponseDTO.ProcessingTypeEnum;
import com.redhat.parodos.sdk.model.WorkFlowDefinitionResponseDTO.TypeEnum;
import com.redhat.parodos.sdk.model.WorkFlowExecutionResponseDTO;
import com.redhat.parodos.sdk.model.WorkFlowExecutionResponseDTO.WorkStatusEnum;
import com.redhat.parodos.sdk.model.WorkFlowRequestDTO;
import com.redhat.parodos.sdk.model.WorkFlowResponseDTO;
import com.redhat.parodos.sdk.model.WorkFlowResponseDTO.WorkStatusEnum;
import com.redhat.parodos.sdk.model.WorkFlowStatusResponseDTO;
import com.redhat.parodos.sdk.model.WorkRequestDTO;
import com.redhat.parodos.sdkutils.SdkUtils;
Expand Down Expand Up @@ -64,7 +64,7 @@ public void runSimpleWorkFlow() throws ApiException, InterruptedException {

log.info("******** Running The Simple Sequence Flow ********");
WorkflowApi workflowApi = new WorkflowApi(components.apiClient());
WorkFlowResponseDTO workFlowResponseDTO = workflowApi.execute(workFlowRequestDTO);
WorkFlowExecutionResponseDTO workFlowResponseDTO = workflowApi.execute(workFlowRequestDTO);

assertNotNull(workFlowResponseDTO.getWorkFlowExecutionId());
assertNotNull(workFlowResponseDTO.getWorkStatus());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import com.redhat.parodos.sdk.model.ArgumentRequestDTO;
import com.redhat.parodos.sdk.model.ProjectResponseDTO;
import com.redhat.parodos.sdk.model.WorkFlowDefinitionResponseDTO;
import com.redhat.parodos.sdk.model.WorkFlowExecutionResponseDTO;
import com.redhat.parodos.sdk.model.WorkFlowRequestDTO;
import com.redhat.parodos.sdk.model.WorkFlowResponseDTO;
import com.redhat.parodos.sdk.model.WorkRequestDTO;
import com.redhat.parodos.workflow.utils.CredUtils;
import org.junit.Test;
Expand Down Expand Up @@ -103,7 +103,7 @@ public void runFlow() {

// 3 - Execute WorkFlowRequests
for (WorkFlowRequestDTO workFlowRequest : workFlowRequests) {
WorkFlowResponseDTO execute = workflowApi.execute(workFlowRequest);
WorkFlowExecutionResponseDTO execute = workflowApi.execute(workFlowRequest);

assertNotNull(execute.getWorkFlowExecutionId());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import com.redhat.parodos.sdk.model.ArgumentRequestDTO;
import com.redhat.parodos.sdk.model.ProjectResponseDTO;
import com.redhat.parodos.sdk.model.WorkFlowDefinitionResponseDTO;
import com.redhat.parodos.sdk.model.WorkFlowExecutionResponseDTO;
import com.redhat.parodos.sdk.model.WorkFlowRequestDTO;
import com.redhat.parodos.sdk.model.WorkFlowResponseDTO;
import com.redhat.parodos.sdk.model.WorkRequestDTO;
import com.redhat.parodos.workflow.utils.CredUtils;
import org.junit.Test;
Expand Down Expand Up @@ -65,7 +65,7 @@ public void runFlow() throws InterruptedException, ApiException {
WorkFlowRequestDTO workFlowRequests[] = new WorkFlowRequestDTO[] { workFlowRequestGet };

for (WorkFlowRequestDTO workFlowRequest : workFlowRequests) {
WorkFlowResponseDTO execute = workflowApi.execute(workFlowRequest);
WorkFlowExecutionResponseDTO execute = workflowApi.execute(workFlowRequest);

assertNotNull(execute.getWorkFlowExecutionId());
}
Expand Down
1 change: 1 addition & 0 deletions workflow-service-sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ Class | Method | HTTP request | Description
- [WorkFlowCheckerTaskRequestDTO](docs/WorkFlowCheckerTaskRequestDTO.md)
- [WorkFlowContextResponseDTO](docs/WorkFlowContextResponseDTO.md)
- [WorkFlowDefinitionResponseDTO](docs/WorkFlowDefinitionResponseDTO.md)
- [WorkFlowExecutionResponseDTO](docs/WorkFlowExecutionResponseDTO.md)
- [WorkFlowOption](docs/WorkFlowOption.md)
- [WorkFlowOptionsResponseDTO](docs/WorkFlowOptionsResponseDTO.md)
- [WorkFlowPropertiesDefinitionDTO](docs/WorkFlowPropertiesDefinitionDTO.md)
Expand Down
19 changes: 18 additions & 1 deletion workflow-service-sdk/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/WorkFlowResponseDTO'
$ref: '#/components/schemas/WorkFlowExecutionResponseDTO'
description: Accepted
"400":
content:
Expand Down Expand Up @@ -1035,6 +1035,23 @@ components:
$ref: '#/components/schemas/WorkDefinitionResponseDTO'
type: array
type: object
WorkFlowExecutionResponseDTO:
example:
workStatus: FAILED
workFlowExecutionId: 046b6c7f-0b8a-43b9-b35d-6489e6daee91
properties:
workFlowExecutionId:
format: uuid
type: string
workStatus:
enum:
- FAILED
- COMPLETED
- IN_PROGRESS
- REJECTED
- PENDING
type: string
type: object
WorkFlowOption:
example:
identifier: identifier
Expand Down
26 changes: 26 additions & 0 deletions workflow-service-sdk/docs/WorkFlowExecutionResponseDTO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@


# WorkFlowExecutionResponseDTO


## Properties

| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**workFlowExecutionId** | **UUID** | | [optional] |
|**workStatus** | [**WorkStatusEnum**](#WorkStatusEnum) | | [optional] |



## Enum: WorkStatusEnum

| Name | Value |
|---- | -----|
| FAILED | "FAILED" |
| COMPLETED | "COMPLETED" |
| IN_PROGRESS | "IN_PROGRESS" |
| REJECTED | "REJECTED" |
| PENDING | "PENDING" |



6 changes: 3 additions & 3 deletions workflow-service-sdk/docs/WorkflowApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ All URIs are relative to *http://localhost:8080*

<a name="execute"></a>
# **execute**
> WorkFlowResponseDTO execute(workFlowRequestDTO)
> WorkFlowExecutionResponseDTO execute(workFlowRequestDTO)

Executes a workflow

Expand All @@ -34,7 +34,7 @@ public class Example {
WorkflowApi apiInstance = new WorkflowApi(defaultClient);
WorkFlowRequestDTO workFlowRequestDTO = new WorkFlowRequestDTO(); // WorkFlowRequestDTO |
try {
WorkFlowResponseDTO result = apiInstance.execute(workFlowRequestDTO);
WorkFlowExecutionResponseDTO result = apiInstance.execute(workFlowRequestDTO);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling WorkflowApi#execute");
Expand All @@ -55,7 +55,7 @@ public class Example {

### Return type

[**WorkFlowResponseDTO**](WorkFlowResponseDTO.md)
[**WorkFlowExecutionResponseDTO**](WorkFlowExecutionResponseDTO.md)

### Authorization

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.redhat.parodos.sdk.invoker.Pair;
import com.redhat.parodos.sdk.model.WorkFlowCheckerTaskRequestDTO;
import com.redhat.parodos.sdk.model.WorkFlowContextResponseDTO;
import com.redhat.parodos.sdk.model.WorkFlowExecutionResponseDTO;
import com.redhat.parodos.sdk.model.WorkFlowRequestDTO;
import com.redhat.parodos.sdk.model.WorkFlowResponseDTO;
import com.redhat.parodos.sdk.model.WorkFlowStatusResponseDTO;
Expand Down Expand Up @@ -178,7 +179,7 @@ private okhttp3.Call executeValidateBeforeCall(WorkFlowRequestDTO workFlowReques
/**
* Executes a workflow
* @param workFlowRequestDTO (required)
* @return WorkFlowResponseDTO
* @return WorkFlowExecutionResponseDTO
* @throws ApiException If fail to call the API, e.g. server error or cannot
* deserialize the response body
* @http.response.details
Expand Down Expand Up @@ -220,15 +221,15 @@ private okhttp3.Call executeValidateBeforeCall(WorkFlowRequestDTO workFlowReques
* </tr>
* </table>
*/
public WorkFlowResponseDTO execute(WorkFlowRequestDTO workFlowRequestDTO) throws ApiException {
ApiResponse<WorkFlowResponseDTO> localVarResp = executeWithHttpInfo(workFlowRequestDTO);
public WorkFlowExecutionResponseDTO execute(WorkFlowRequestDTO workFlowRequestDTO) throws ApiException {
ApiResponse<WorkFlowExecutionResponseDTO> localVarResp = executeWithHttpInfo(workFlowRequestDTO);
return localVarResp.getData();
}

/**
* Executes a workflow
* @param workFlowRequestDTO (required)
* @return ApiResponse&lt;WorkFlowResponseDTO&gt;
* @return ApiResponse&lt;WorkFlowExecutionResponseDTO&gt;
* @throws ApiException If fail to call the API, e.g. server error or cannot
* deserialize the response body
* @http.response.details
Expand Down Expand Up @@ -270,10 +271,10 @@ public WorkFlowResponseDTO execute(WorkFlowRequestDTO workFlowRequestDTO) throws
* </tr>
* </table>
*/
public ApiResponse<WorkFlowResponseDTO> executeWithHttpInfo(WorkFlowRequestDTO workFlowRequestDTO)
public ApiResponse<WorkFlowExecutionResponseDTO> executeWithHttpInfo(WorkFlowRequestDTO workFlowRequestDTO)
throws ApiException {
okhttp3.Call localVarCall = executeValidateBeforeCall(workFlowRequestDTO, null);
Type localVarReturnType = new TypeToken<WorkFlowResponseDTO>() {
Type localVarReturnType = new TypeToken<WorkFlowExecutionResponseDTO>() {
}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
Expand Down Expand Up @@ -325,10 +326,10 @@ public ApiResponse<WorkFlowResponseDTO> executeWithHttpInfo(WorkFlowRequestDTO w
* </table>
*/
public okhttp3.Call executeAsync(WorkFlowRequestDTO workFlowRequestDTO,
final ApiCallback<WorkFlowResponseDTO> _callback) throws ApiException {
final ApiCallback<WorkFlowExecutionResponseDTO> _callback) throws ApiException {

okhttp3.Call localVarCall = executeValidateBeforeCall(workFlowRequestDTO, _callback);
Type localVarReturnType = new TypeToken<WorkFlowResponseDTO>() {
Type localVarReturnType = new TypeToken<WorkFlowExecutionResponseDTO>() {
}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri
new com.redhat.parodos.sdk.model.WorkFlowContextResponseDTO.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(
new com.redhat.parodos.sdk.model.WorkFlowDefinitionResponseDTO.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(
new com.redhat.parodos.sdk.model.WorkFlowExecutionResponseDTO.CustomTypeAdapterFactory());
gsonBuilder
.registerTypeAdapterFactory(new com.redhat.parodos.sdk.model.WorkFlowOption.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(
Expand Down
Loading