From ad5e4f0329dd0e3dd9c8f1e011194f2620b50e2e Mon Sep 17 00:00:00 2001 From: manan164 <1897158+manan164@users.noreply.github.com> Date: Mon, 14 Aug 2023 17:49:18 +0530 Subject: [PATCH 1/3] Jump task support. --- .../client/http/OrkesWorkflowClient.java | 4 + .../client/http/api/WorkflowResourceApi.java | 96 +++++++++++++++++++ 2 files changed, 100 insertions(+) diff --git a/src/main/java/io/orkes/conductor/client/http/OrkesWorkflowClient.java b/src/main/java/io/orkes/conductor/client/http/OrkesWorkflowClient.java index a509806f..8cbfb816 100644 --- a/src/main/java/io/orkes/conductor/client/http/OrkesWorkflowClient.java +++ b/src/main/java/io/orkes/conductor/client/http/OrkesWorkflowClient.java @@ -343,6 +343,10 @@ public void shutdown() { } } + public void jumpToTask(String workflowId, String taskReferenceName, Map input) { + httpClient.jumpToTaskWithHttpInfo(workflowId, taskReferenceName, input); + } + @Override public void close() { shutdown(); diff --git a/src/main/java/io/orkes/conductor/client/http/api/WorkflowResourceApi.java b/src/main/java/io/orkes/conductor/client/http/api/WorkflowResourceApi.java index baedc245..b5ba1dc8 100644 --- a/src/main/java/io/orkes/conductor/client/http/api/WorkflowResourceApi.java +++ b/src/main/java/io/orkes/conductor/client/http/api/WorkflowResourceApi.java @@ -3834,4 +3834,100 @@ private Call updateVariablesCall(String workflowId, Map variable localVarAuthNames, null); } + + /** + * Jump workflow execution to given task + * Jump workflow execution to given task. + * @param body (required) + * @param workflowId (required) + * @param taskReferenceName (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public void jumpToTask(Map body, String workflowId, String taskReferenceName) throws ApiException { + jumpToTaskWithHttpInfo(workflowId, taskReferenceName, body); + } + + /** + * Jump workflow execution to given task + * Jump workflow execution to given task. + * @param input (required) + * @param workflowId (required) + * @param taskReferenceName (optional) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse jumpToTaskWithHttpInfo(String workflowId, String taskReferenceName, Map input) throws ApiException { + com.squareup.okhttp.Call call = jumpToTaskValidateBeforeCall(input, workflowId, taskReferenceName, null, null); + return apiClient.execute(call); + } + + @SuppressWarnings("rawtypes") + private com.squareup.okhttp.Call jumpToTaskValidateBeforeCall(Map body, String workflowId, String taskReferenceName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling jumpToTask(Async)"); + } + // verify the required parameter 'workflowId' is set + if (workflowId == null) { + throw new ApiException("Missing the required parameter 'workflowId' when calling jumpToTask(Async)"); + } + + com.squareup.okhttp.Call call = jumpToTaskCall(body, workflowId, taskReferenceName, progressListener, progressRequestListener); + return call; + } + + /** + * Build call for jumpToTask + * @param body (required) + * @param workflowId (required) + * @param taskReferenceName (optional) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public com.squareup.okhttp.Call jumpToTaskCall(Map body, String workflowId, String taskReferenceName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/api/workflow/{workflowId}/jump/{taskReferenceName}" + .replaceAll("\\{" + "workflowId" + "\\}", apiClient.escapeString(workflowId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + if (taskReferenceName != null) + localVarQueryParams.addAll(apiClient.parameterToPair("taskReferenceName", taskReferenceName)); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + } From 2d5dd66085140fabe4434e057bda8ba2f2dee48d Mon Sep 17 00:00:00 2001 From: manan164 <1897158+manan164@users.noreply.github.com> Date: Wed, 16 Aug 2023 15:43:16 +0530 Subject: [PATCH 2/3] remove api --- .../io/orkes/conductor/client/http/api/WorkflowResourceApi.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/orkes/conductor/client/http/api/WorkflowResourceApi.java b/src/main/java/io/orkes/conductor/client/http/api/WorkflowResourceApi.java index b5ba1dc8..0ef5197e 100644 --- a/src/main/java/io/orkes/conductor/client/http/api/WorkflowResourceApi.java +++ b/src/main/java/io/orkes/conductor/client/http/api/WorkflowResourceApi.java @@ -3890,7 +3890,7 @@ public com.squareup.okhttp.Call jumpToTaskCall(Map body, String Object localVarPostBody = body; // create path and map variables - String localVarPath = "/api/workflow/{workflowId}/jump/{taskReferenceName}" + String localVarPath = "/workflow/{workflowId}/jump/{taskReferenceName}" .replaceAll("\\{" + "workflowId" + "\\}", apiClient.escapeString(workflowId.toString())); List localVarQueryParams = new ArrayList(); From e46abb71a35aa21fd67f997789e55ef402bd2c72 Mon Sep 17 00:00:00 2001 From: manan164 <1897158+manan164@users.noreply.github.com> Date: Wed, 16 Aug 2023 21:34:44 +0530 Subject: [PATCH 3/3] log --- .../io/orkes/conductor/client/http/api/WorkflowResourceApi.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/orkes/conductor/client/http/api/WorkflowResourceApi.java b/src/main/java/io/orkes/conductor/client/http/api/WorkflowResourceApi.java index 0ef5197e..332dc769 100644 --- a/src/main/java/io/orkes/conductor/client/http/api/WorkflowResourceApi.java +++ b/src/main/java/io/orkes/conductor/client/http/api/WorkflowResourceApi.java @@ -3865,7 +3865,7 @@ public ApiResponse jumpToTaskWithHttpInfo(String workflowId, String taskRe private com.squareup.okhttp.Call jumpToTaskValidateBeforeCall(Map body, String workflowId, String taskReferenceName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'body' is set if (body == null) { - throw new ApiException("Missing the required parameter 'body' when calling jumpToTask(Async)"); + throw new ApiException("Missing the required parameter 'input' when calling jumpToTask(Async)"); } // verify the required parameter 'workflowId' is set if (workflowId == null) {