From 70ecaf867014301306afd06fc59a4f8cb3a15076 Mon Sep 17 00:00:00 2001 From: Quanzheng Long Date: Sun, 18 Dec 2022 08:48:38 -0800 Subject: [PATCH 1/2] update to use 1.0 --- build.gradle | 2 +- .../controller/BasicWorkflowController.java | 10 +++++----- .../InterstateChannelWorkflowController.java | 4 ++-- .../controller/PersistenceWorkflowController.java | 14 +++++++------- .../controller/SignalWorkflowController.java | 6 +++--- .../controller/TimerWorkflowController.java | 4 ++-- .../iworkflow/services/DynamicWorkflowService.java | 4 ++-- 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/build.gradle b/build.gradle index 942921b..4fb8d21 100644 --- a/build.gradle +++ b/build.gradle @@ -30,7 +30,7 @@ dependencies { implementation "org.springframework.boot:spring-boot-starter-test" implementation "javax.validation:validation-api:2.0.1.Final" - implementation "io.iworkflow:iwf-java-sdk:1.0.0-rc1" + implementation "io.iworkflow:iwf-java-sdk:1.0.0-final" // openapi implementation "org.openapitools:jackson-databind-nullable:0.2.1" diff --git a/src/main/java/io/iworkflow/controller/BasicWorkflowController.java b/src/main/java/io/iworkflow/controller/BasicWorkflowController.java index b857301..db8e8fb 100644 --- a/src/main/java/io/iworkflow/controller/BasicWorkflowController.java +++ b/src/main/java/io/iworkflow/controller/BasicWorkflowController.java @@ -1,9 +1,9 @@ package io.iworkflow.controller; import io.iworkflow.core.Client; -import io.iworkflow.core.ImmutableWorkflowStartOptions; -import io.iworkflow.core.WorkflowStartOptions; -import io.iworkflow.core.options.WorkflowIdReusePolicy; +import io.iworkflow.core.ImmutableWorkflowOptions; +import io.iworkflow.core.WorkflowOptions; +import io.iworkflow.gen.models.WorkflowStartOptions; import io.iworkflow.workflow.basic.BasicWorkflow; import io.iworkflow.workflow.basic.BasicWorkflowS1; import org.springframework.http.ResponseEntity; @@ -28,9 +28,9 @@ public BasicWorkflowController( @GetMapping("/start") public ResponseEntity start() { final String wfId = "basic-test-id" + System.currentTimeMillis() / 1000; - final WorkflowStartOptions startOptions = ImmutableWorkflowStartOptions.builder() + final WorkflowOptions startOptions = ImmutableWorkflowOptions.builder() .workflowTimeoutSeconds(10) - .workflowIdReusePolicy(Optional.of(WorkflowIdReusePolicy.ALLOW_DUPLICATE)) + .workflowIdReusePolicy(Optional.of(WorkflowStartOptions.WorkflowIDReusePolicyEnum.ALLOW_DUPLICATE)) .build(); final Integer input = 0; final String runId = client.startWorkflow(BasicWorkflow.class, BasicWorkflowS1.StateId, input, wfId, startOptions); diff --git a/src/main/java/io/iworkflow/controller/InterstateChannelWorkflowController.java b/src/main/java/io/iworkflow/controller/InterstateChannelWorkflowController.java index cb68c70..8386747 100644 --- a/src/main/java/io/iworkflow/controller/InterstateChannelWorkflowController.java +++ b/src/main/java/io/iworkflow/controller/InterstateChannelWorkflowController.java @@ -1,7 +1,7 @@ package io.iworkflow.controller; import io.iworkflow.core.Client; -import io.iworkflow.core.WorkflowStartOptions; +import io.iworkflow.core.WorkflowOptions; import io.iworkflow.workflow.interstatechannel.BasicInterStateChannelWorkflow; import io.iworkflow.workflow.interstatechannel.BasicInterStateChannelWorkflowState0; import org.springframework.http.ResponseEntity; @@ -24,7 +24,7 @@ public InterstateChannelWorkflowController( @GetMapping("/start") public ResponseEntity start() { final String wfId = "basic-inter-state-test-id" + System.currentTimeMillis() / 1000; - final WorkflowStartOptions startOptions = WorkflowStartOptions.minimum(10); + final WorkflowOptions startOptions = WorkflowOptions.minimum(10); final Integer input = 1; final String runId = client.startWorkflow( BasicInterStateChannelWorkflow.class, BasicInterStateChannelWorkflowState0.STATE_ID, input, wfId, startOptions); diff --git a/src/main/java/io/iworkflow/controller/PersistenceWorkflowController.java b/src/main/java/io/iworkflow/controller/PersistenceWorkflowController.java index 23cccf6..421a070 100644 --- a/src/main/java/io/iworkflow/controller/PersistenceWorkflowController.java +++ b/src/main/java/io/iworkflow/controller/PersistenceWorkflowController.java @@ -1,16 +1,16 @@ package io.iworkflow.controller; import io.iworkflow.core.Client; -import io.iworkflow.core.WorkflowStartOptions; -import io.iworkflow.workflow.persistence.BasicPersistenceWorkflow; -import io.iworkflow.workflow.persistence.BasicPersistenceWorkflowState1; +import io.iworkflow.core.WorkflowOptions; +import io.iworkflow.workflow.basic.BasicWorkflow; +import io.iworkflow.workflow.basic.BasicWorkflowS1; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @Controller -@RequestMapping("/persistence") +@RequestMapping("/WorkflowOptions") public class PersistenceWorkflowController { private final Client client; @@ -23,10 +23,10 @@ public PersistenceWorkflowController( @GetMapping("/start") public ResponseEntity start() { - final String wfId = "basic-persistence-test-id" + System.currentTimeMillis() / 1000; - final WorkflowStartOptions startOptions = WorkflowStartOptions.minimum(10); + final String wfId = "basic-WorkflowOptions-test-id" + System.currentTimeMillis() / 1000; + final WorkflowOptions startOptions = WorkflowOptions.minimum(10); final String runId = client.startWorkflow( - BasicPersistenceWorkflow.class, BasicPersistenceWorkflowState1.STATE_ID, "start", wfId, startOptions); + BasicWorkflow.class, BasicWorkflowS1.StateId, "start", wfId, startOptions); final String output = client.getSimpleWorkflowResultWithWait(String.class, wfId); return ResponseEntity.ok(String.format("runId: %s, output: %s", runId, output)); diff --git a/src/main/java/io/iworkflow/controller/SignalWorkflowController.java b/src/main/java/io/iworkflow/controller/SignalWorkflowController.java index a9c8d09..87f58ee 100644 --- a/src/main/java/io/iworkflow/controller/SignalWorkflowController.java +++ b/src/main/java/io/iworkflow/controller/SignalWorkflowController.java @@ -1,9 +1,9 @@ package io.iworkflow.controller; -import io.iworkflow.core.WorkflowStartOptions; +import io.iworkflow.core.Client; +import io.iworkflow.core.WorkflowOptions; import io.iworkflow.workflow.signal.BasicSignalWorkflow; import io.iworkflow.workflow.signal.BasicSignalWorkflowState1; -import io.iworkflow.core.Client; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; @@ -24,7 +24,7 @@ public SignalWorkflowController( @GetMapping("/start") public ResponseEntity start() { final String wfId = "basic-signal-test-id" + System.currentTimeMillis() / 1000; - final WorkflowStartOptions startOptions = WorkflowStartOptions.minimum(10); + final WorkflowOptions startOptions = WorkflowOptions.minimum(10); final Integer input = 1; final String runId = client.startWorkflow( BasicSignalWorkflow.class, BasicSignalWorkflowState1.STATE_ID, input, wfId, startOptions); diff --git a/src/main/java/io/iworkflow/controller/TimerWorkflowController.java b/src/main/java/io/iworkflow/controller/TimerWorkflowController.java index 65aaf1e..1ab2987 100644 --- a/src/main/java/io/iworkflow/controller/TimerWorkflowController.java +++ b/src/main/java/io/iworkflow/controller/TimerWorkflowController.java @@ -1,7 +1,7 @@ package io.iworkflow.controller; import io.iworkflow.core.Client; -import io.iworkflow.core.WorkflowStartOptions; +import io.iworkflow.core.WorkflowOptions; import io.iworkflow.workflow.timer.BasicTimerWorkflow; import io.iworkflow.workflow.timer.BasicTimerWorkflowState1; import org.springframework.http.ResponseEntity; @@ -25,7 +25,7 @@ public TimerWorkflowController( public ResponseEntity start() { final long startTs = System.currentTimeMillis(); final String wfId = "basic-timer-test-id" + startTs / 1000; - final WorkflowStartOptions startOptions = WorkflowStartOptions.minimum(10); + final WorkflowOptions startOptions = WorkflowOptions.minimum(10); final Integer input = 5; final String runId = client.startWorkflow( diff --git a/src/main/java/io/iworkflow/services/DynamicWorkflowService.java b/src/main/java/io/iworkflow/services/DynamicWorkflowService.java index 65cd4c6..33b426e 100644 --- a/src/main/java/io/iworkflow/services/DynamicWorkflowService.java +++ b/src/main/java/io/iworkflow/services/DynamicWorkflowService.java @@ -1,7 +1,7 @@ package io.iworkflow.services; import io.iworkflow.core.UntypedClient; -import io.iworkflow.core.WorkflowStartOptions; +import io.iworkflow.core.WorkflowOptions; import io.iworkflow.models.ImmutableStartWorkflowResponse; import io.iworkflow.models.SignalRequest; import io.iworkflow.models.StartWorkflowResponse; @@ -33,7 +33,7 @@ public StartWorkflowResponse startWorkflow(final String workflowName) { String runId = untypedClient.startWorkflow(DynamicDslWorkflow.class.getSimpleName(), adapter.getWorkflow().getId() + "-" + startState.getName(), - adapter.getFirstState(), workflowId, WorkflowStartOptions.minimum(100)); + adapter.getFirstState(), workflowId, WorkflowOptions.minimum(100)); return ImmutableStartWorkflowResponse.builder() .workflowId(workflowId) .runId(runId) From a2d8fd341eca9eaa4f21468bf999217b34a75bd5 Mon Sep 17 00:00:00 2001 From: Quanzheng Long Date: Sun, 18 Dec 2022 08:50:07 -0800 Subject: [PATCH 2/2] fix --- .../iworkflow/controller/PersistenceWorkflowController.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/iworkflow/controller/PersistenceWorkflowController.java b/src/main/java/io/iworkflow/controller/PersistenceWorkflowController.java index 421a070..48e87b8 100644 --- a/src/main/java/io/iworkflow/controller/PersistenceWorkflowController.java +++ b/src/main/java/io/iworkflow/controller/PersistenceWorkflowController.java @@ -10,7 +10,7 @@ import org.springframework.web.bind.annotation.RequestMapping; @Controller -@RequestMapping("/WorkflowOptions") +@RequestMapping("/persistence") public class PersistenceWorkflowController { private final Client client; @@ -23,7 +23,7 @@ public PersistenceWorkflowController( @GetMapping("/start") public ResponseEntity start() { - final String wfId = "basic-WorkflowOptions-test-id" + System.currentTimeMillis() / 1000; + final String wfId = "basic-persistence-test-id" + System.currentTimeMillis() / 1000; final WorkflowOptions startOptions = WorkflowOptions.minimum(10); final String runId = client.startWorkflow( BasicWorkflow.class, BasicWorkflowS1.StateId, "start", wfId, startOptions);