-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathBasicWorkflowS2.java
37 lines (30 loc) · 1.5 KB
/
BasicWorkflowS2.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package io.github.cadenceoss.iwf.basic;
import io.github.cadenceoss.iwf.core.Context;
import io.github.cadenceoss.iwf.core.StateDecision;
import io.github.cadenceoss.iwf.core.WorkflowState;
import io.github.cadenceoss.iwf.core.attributes.QueryAttributesRW;
import io.github.cadenceoss.iwf.core.attributes.SearchAttributesRW;
import io.github.cadenceoss.iwf.core.attributes.StateLocal;
import io.github.cadenceoss.iwf.core.command.CommandRequest;
import io.github.cadenceoss.iwf.core.command.CommandResults;
import io.github.cadenceoss.iwf.core.command.InterStateChannel;
public class BasicWorkflowS2 implements WorkflowState<Integer> {
public static final String StateId = "S2";
@Override
public String getStateId() {
return StateId;
}
@Override
public Class<Integer> getInputType() {
return Integer.class;
}
@Override
public CommandRequest start(final Context context, final Integer input, StateLocal stateLocals, final SearchAttributesRW searchAttributes, final QueryAttributesRW queryAttributes, final InterStateChannel interStateChannel) {
return CommandRequest.empty;
}
@Override
public StateDecision decide(final Context context, final Integer input, final CommandResults commandResults, StateLocal stateLocals, final SearchAttributesRW searchAttributes, final QueryAttributesRW queryAttributes, final InterStateChannel interStateChannel) {
final int output = input + 1;
return StateDecision.gracefulCompleteWorkflow(output);
}
}