Skip to content

Commit f4efa05

Browse files
authored
[Fix #867] Adding MapSetTaskConfiguration to pass a Map directly to Set (#868)
Signed-off-by: fjtirado <ftirados@redhat.com>
1 parent 9116654 commit f4efa05

File tree

2 files changed

+35
-3
lines changed

2 files changed

+35
-3
lines changed

experimental/lambda/src/test/java/io/serverless/workflow/impl/ModelTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@
2222
import io.serverlessworkflow.api.types.Output;
2323
import io.serverlessworkflow.api.types.Set;
2424
import io.serverlessworkflow.api.types.SetTask;
25-
import io.serverlessworkflow.api.types.SetTaskConfiguration;
2625
import io.serverlessworkflow.api.types.Task;
2726
import io.serverlessworkflow.api.types.TaskItem;
2827
import io.serverlessworkflow.api.types.TimeoutAfter;
2928
import io.serverlessworkflow.api.types.WaitTask;
3029
import io.serverlessworkflow.api.types.Workflow;
30+
import io.serverlessworkflow.api.types.func.MapSetTaskConfiguration;
3131
import io.serverlessworkflow.api.types.func.OutputAsFunction;
3232
import io.serverlessworkflow.impl.WorkflowApplication;
3333
import io.serverlessworkflow.impl.WorkflowInstance;
@@ -89,8 +89,8 @@ void testMapExpression() throws InterruptedException, ExecutionException {
8989
.withSet(
9090
new Set()
9191
.withSetTaskConfiguration(
92-
new SetTaskConfiguration()
93-
.withAdditionalProperty("name", "Francisco")))
92+
new MapSetTaskConfiguration(
93+
Map.of("name", "Francisco"))))
9494
.withOutput(
9595
new Output()
9696
.withAs(
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Copyright 2020-Present The Serverless Workflow Specification Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package io.serverlessworkflow.api.types.func;
17+
18+
import io.serverlessworkflow.api.types.SetTaskConfiguration;
19+
import java.util.Map;
20+
21+
public class MapSetTaskConfiguration extends SetTaskConfiguration {
22+
23+
private static final long serialVersionUID = 1L;
24+
25+
public MapSetTaskConfiguration(Map<String, Object> map) {
26+
map.forEach(this::processItem);
27+
}
28+
29+
private void processItem(String key, Object value) {
30+
withAdditionalProperty(key, value);
31+
}
32+
}

0 commit comments

Comments
 (0)