Skip to content

Commit 4420d27

Browse files
committed
Review comments
Signed-off-by: Francisco Javier Tirado Sarti <ftirados@ibm.com>
1 parent b29a0d4 commit 4420d27

2 files changed

Lines changed: 14 additions & 20 deletions

File tree

‎impl/core/src/main/java/io/serverlessworkflow/impl/executors/RunShellExecutor.java‎

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,28 +40,24 @@ public class RunShellExecutor implements CallableTask {
4040
public RunShellExecutor(
4141
WorkflowValueResolver<String> shellCommand,
4242
List<WorkflowValueResolver<String>> shellArguments,
43-
Optional<WorkflowValueResolver<String>> shellDirectory,
4443
Optional<WorkflowValueResolver<Map<String, Object>>> shellEnv,
45-
Optional<ProcessReturnType> returnType) {
44+
Optional<ProcessReturnType> returnType,
45+
Optional<WorkflowValueResolver<String>> shellDirectory) {
4646
this.shellCommand = shellCommand;
4747
this.shellArguments = shellArguments;
48-
this.shellDirectory = shellDirectory;
4948
this.shellEnv = shellEnv;
5049
this.returnType = returnType;
50+
this.shellDirectory = shellDirectory;
5151
}
5252

5353
public RunShellExecutor(
54-
WorkflowValueResolver<String> shellCommand,
55-
List<WorkflowValueResolver<String>> shellArguments,
56-
Optional<WorkflowValueResolver<Map<String, Object>>> shellEnv,
57-
Optional<ProcessReturnType> returnType) {
58-
this.shellCommand = shellCommand;
59-
this.shellArguments = shellArguments;
60-
this.shellDirectory = Optional.empty();
61-
this.shellEnv = shellEnv;
62-
this.returnType = returnType;
63-
}
64-
54+
WorkflowValueResolver<String> shellCommand,
55+
List<WorkflowValueResolver<String>> shellArguments,
56+
Optional<WorkflowValueResolver<Map<String, Object>>> shellEnv,
57+
Optional<ProcessReturnType> returnType) {
58+
this(shellCommand, shellArguments, shellEnv, returnType, Optional.empty());
59+
}
60+
6561
@Override
6662
public CompletableFuture<WorkflowModel> apply(
6763
WorkflowContext workflowContext, TaskContext taskContext, WorkflowModel model) {

‎impl/core/src/main/java/io/serverlessworkflow/impl/executors/RunShellExecutorBuilder.java‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,15 @@ public CallableTask build(RunShell taskConfiguration, WorkflowDefinition definit
3939
.map(s -> WorkflowUtils.buildStringFilter(definition.application(), s))
4040
.toList()
4141
: List.of(),
42-
shell.getDirectory() != null
43-
? Optional.of(
44-
WorkflowUtils.buildStringFilter(definition.application(), shell.getDirectory()))
45-
: Optional.empty(),
4642
shell.getEnvironment() != null
4743
? Optional.of(
4844
WorkflowUtils.buildMapResolver(
4945
definition.application(), shell.getEnvironment().getAdditionalProperties()))
5046
: Optional.empty(),
51-
taskConfiguration.isAwait()
52-
? Optional.of(taskConfiguration.getReturn())
47+
taskConfiguration.isAwait() ? Optional.of(taskConfiguration.getReturn()) : Optional.empty(),
48+
shell.getDirectory() != null
49+
? Optional.of(
50+
WorkflowUtils.buildStringFilter(definition.application(), shell.getDirectory()))
5351
: Optional.empty());
5452
}
5553

0 commit comments

Comments
 (0)