Skip to content
This repository was archived by the owner on Dec 13, 2023. It is now read-only.

Commit adbcb8a

Browse files
fix compatibility with 1.x
1 parent 26cfd71 commit adbcb8a

File tree

2 files changed

+31
-7
lines changed

2 files changed

+31
-7
lines changed

common/src/main/java/com/netflix/conductor/common/metadata/workflow/WorkflowTask.java

+29-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/**
1+
/*
22
* Copyright 2016 Netflix, Inc.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,9 +13,6 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
/**
17-
*
18-
*/
1916
package com.netflix.conductor.common.metadata.workflow;
2017

2118
import com.github.vmg.protogen.annotations.ProtoField;
@@ -24,12 +21,14 @@
2421

2522
import java.util.Collection;
2623
import java.util.HashMap;
24+
import java.util.HashSet;
2725
import java.util.Iterator;
2826
import java.util.LinkedHashMap;
2927
import java.util.LinkedList;
3028
import java.util.List;
3129
import java.util.Map;
3230
import java.util.Objects;
31+
import java.util.Set;
3332

3433
/**
3534
* @author Viren
@@ -40,6 +39,31 @@
4039
@ProtoMessage
4140
public class WorkflowTask {
4241

42+
/**
43+
* This field is deprecated and will be removed in the next version.
44+
* Please use {@link TaskType} instead.
45+
*/
46+
@Deprecated
47+
public enum Type {
48+
SIMPLE, DYNAMIC, FORK_JOIN, FORK_JOIN_DYNAMIC, DECISION, JOIN, SUB_WORKFLOW, EVENT, WAIT, USER_DEFINED;
49+
private static Set<String> systemTasks = new HashSet<>();
50+
static {
51+
systemTasks.add(Type.SIMPLE.name());
52+
systemTasks.add(Type.DYNAMIC.name());
53+
systemTasks.add(Type.FORK_JOIN.name());
54+
systemTasks.add(Type.FORK_JOIN_DYNAMIC.name());
55+
systemTasks.add(Type.DECISION.name());
56+
systemTasks.add(Type.JOIN.name());
57+
systemTasks.add(Type.SUB_WORKFLOW.name());
58+
systemTasks.add(Type.EVENT.name());
59+
systemTasks.add(Type.WAIT.name());
60+
//Do NOT add USER_DEFINED here...
61+
}
62+
public static boolean isSystemTask(String name) {
63+
return systemTasks.contains(name);
64+
}
65+
}
66+
4367
@ProtoField(id = 1)
4468
private String name;
4569

@@ -52,7 +76,7 @@ public class WorkflowTask {
5276
//Key: Name of the input parameter. MUST be one of the keys defined in TaskDef (e.g. fileName)
5377
//Value: mapping of the parameter from another task (e.g. task1.someOutputParameterAsFileName)
5478
@ProtoField(id = 4)
55-
private Map<String, Object> inputParameters = new HashMap<String, Object>();
79+
private Map<String, Object> inputParameters = new HashMap<>();
5680

5781
@ProtoField(id = 5)
5882
private String type = TaskType.SIMPLE.name();

common/src/main/java/com/netflix/conductor/common/run/Workflow.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ public void setCorrelationId(String correlationId) {
244244
*/
245245
@Deprecated
246246
public String getWorkflowType() {
247-
return workflowType;
247+
return getWorkflowName();
248248
}
249249

250250
/**
@@ -261,7 +261,7 @@ public void setWorkflowType(String workflowType) {
261261
*/
262262
@Deprecated
263263
public int getVersion() {
264-
return version;
264+
return getWorkflowVersion();
265265
}
266266

267267
/**

0 commit comments

Comments
 (0)