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

Commit 8539330

Browse files
Revert "fix compatibility with 1.x"
1 parent f211acb commit 8539330

File tree

2 files changed

+39
-65
lines changed

2 files changed

+39
-65
lines changed

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

+37-63
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,6 +13,9 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
/**
17+
*
18+
*/
1619
package com.netflix.conductor.common.metadata.workflow;
1720

1821
import com.github.vmg.protogen.annotations.ProtoField;
@@ -21,51 +24,22 @@
2124

2225
import java.util.Collection;
2326
import java.util.HashMap;
24-
import java.util.HashSet;
2527
import java.util.Iterator;
2628
import java.util.LinkedHashMap;
2729
import java.util.LinkedList;
2830
import java.util.List;
2931
import java.util.Map;
3032
import java.util.Objects;
31-
import java.util.Set;
3233

3334
/**
3435
* @author Viren
3536
*
36-
* This is the task definition defined as part of the {@link WorkflowDef}. The tasks definied in the Workflow definition are saved
37+
* This is the task definition definied as part of the {@link WorkflowDef}. The tasks definied in the Workflow definition are saved
3738
* as part of {@link WorkflowDef#tasks}
3839
*/
3940
@ProtoMessage
4041
public class WorkflowTask {
4142

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-
50-
private static Set<String> systemTasks = new HashSet<>();
51-
static {
52-
systemTasks.add(Type.SIMPLE.name());
53-
systemTasks.add(Type.DYNAMIC.name());
54-
systemTasks.add(Type.FORK_JOIN.name());
55-
systemTasks.add(Type.FORK_JOIN_DYNAMIC.name());
56-
systemTasks.add(Type.DECISION.name());
57-
systemTasks.add(Type.JOIN.name());
58-
systemTasks.add(Type.SUB_WORKFLOW.name());
59-
systemTasks.add(Type.EVENT.name());
60-
systemTasks.add(Type.WAIT.name());
61-
//Do NOT add USER_DEFINED here...
62-
}
63-
64-
public static boolean isSystemTask(String name) {
65-
return systemTasks.contains(name);
66-
}
67-
}
68-
6943
@ProtoField(id = 1)
7044
private String name;
7145

@@ -78,7 +52,7 @@ public static boolean isSystemTask(String name) {
7852
//Key: Name of the input parameter. MUST be one of the keys defined in TaskDef (e.g. fileName)
7953
//Value: mapping of the parameter from another task (e.g. task1.someOutputParameterAsFileName)
8054
@ProtoField(id = 4)
81-
private Map<String, Object> inputParameters = new HashMap<>();
55+
private Map<String, Object> inputParameters = new HashMap<String, Object>();
8256

8357
@ProtoField(id = 5)
8458
private String type = TaskType.SIMPLE.name();
@@ -201,7 +175,7 @@ public Map<String, Object> getInputParameters() {
201175
public void setInputParameters(Map<String, Object> inputParameters) {
202176
this.inputParameters = inputParameters;
203177
}
204-
178+
205179
/**
206180
* @return the type
207181
*/
@@ -212,7 +186,7 @@ public String getType() {
212186
public void setWorkflowTaskType(TaskType type) {
213187
this.type = type.name();
214188
}
215-
189+
216190
/**
217191
* @param type the type to set
218192
*/
@@ -234,7 +208,7 @@ public void setDecisionCases(Map<String, List<WorkflowTask>> decisionCases) {
234208
this.decisionCases = decisionCases;
235209
}
236210

237-
211+
238212
/**
239213
* @return the defaultCase
240214
*/
@@ -263,7 +237,7 @@ public void setForkTasks(List<List<WorkflowTask>> forkTasks) {
263237
this.forkTasks = forkTasks;
264238
}
265239

266-
240+
267241
/**
268242
* @return the startDelay in seconds
269243
*/
@@ -278,7 +252,7 @@ public void setStartDelay(int startDelay) {
278252
this.startDelay = startDelay;
279253
}
280254

281-
255+
282256
/**
283257
* @return the dynamicTaskNameParam
284258
*/
@@ -288,13 +262,13 @@ public String getDynamicTaskNameParam() {
288262

289263
/**
290264
* @param dynamicTaskNameParam the dynamicTaskNameParam to set to be used by DYNAMIC tasks
291-
*
265+
*
292266
*/
293267
public void setDynamicTaskNameParam(String dynamicTaskNameParam) {
294268
this.dynamicTaskNameParam = dynamicTaskNameParam;
295269
}
296270

297-
271+
298272
/**
299273
* @return the caseValueParam
300274
*/
@@ -311,19 +285,19 @@ public String getDynamicForkJoinTasksParam() {
311285
public void setDynamicForkJoinTasksParam(String dynamicForkJoinTasksParam) {
312286
this.dynamicForkJoinTasksParam = dynamicForkJoinTasksParam;
313287
}
314-
288+
315289
public String getDynamicForkTasksParam() {
316290
return dynamicForkTasksParam;
317291
}
318-
292+
319293
public void setDynamicForkTasksParam(String dynamicForkTasksParam) {
320294
this.dynamicForkTasksParam = dynamicForkTasksParam;
321295
}
322296

323297
public String getDynamicForkTasksInputParamName() {
324298
return dynamicForkTasksInputParamName;
325299
}
326-
300+
327301
public void setDynamicForkTasksInputParamName(String dynamicForkTasksInputParamName) {
328302
this.dynamicForkTasksInputParamName = dynamicForkTasksInputParamName;
329303
}
@@ -334,25 +308,25 @@ public void setDynamicForkTasksInputParamName(String dynamicForkTasksInputParamN
334308
public void setCaseValueParam(String caseValueParam) {
335309
this.caseValueParam = caseValueParam;
336310
}
337-
311+
338312
/**
339-
*
313+
*
340314
* @return A javascript expression for decision cases. The result should be a scalar value that is used to decide the case branches.
341315
* @see #getDecisionCases()
342316
*/
343317
public String getCaseExpression() {
344318
return caseExpression;
345319
}
346-
320+
347321
/**
348-
*
322+
*
349323
* @param caseExpression A javascript expression for decision cases. The result should be a scalar value that is used to decide the case branches.
350324
*/
351325
public void setCaseExpression(String caseExpression) {
352326
this.caseExpression = caseExpression;
353327
}
354328

355-
329+
356330
/**
357331
* @return the subWorkflow
358332
*/
@@ -382,21 +356,21 @@ public void setJoinOn(List<String> joinOn) {
382356
}
383357

384358
/**
385-
*
359+
*
386360
* @return Sink value for the EVENT type of task
387361
*/
388362
public String getSink() {
389363
return sink;
390364
}
391-
365+
392366
/**
393-
*
367+
*
394368
* @param sink Name of the sink
395369
*/
396370
public void setSink(String sink) {
397371
this.sink = sink;
398372
}
399-
373+
400374
/**
401375
*
402376
* @return If the task is optional. When set to true, the workflow execution continues even when the task is in failed status.
@@ -421,7 +395,7 @@ public void setTaskDefinition(TaskDef taskDefinition) {
421395
}
422396

423397
/**
424-
*
398+
*
425399
* @param optional when set to true, the task is marked as optional
426400
*/
427401
public void setOptional(boolean optional) {
@@ -532,38 +506,38 @@ public WorkflowTask next(String taskReferenceName, WorkflowTask parent) {
532506
}
533507
return null;
534508
}
535-
509+
536510
public boolean has(String taskReferenceName){
537511

538512
if(this.getTaskReferenceName().equals(taskReferenceName)){
539513
return true;
540514
}
541-
515+
542516
TaskType tt = TaskType.USER_DEFINED;
543517
if(TaskType.isSystemTask(type)) {
544518
tt = TaskType.valueOf(type);
545519
}
546-
520+
547521
switch(tt){
548-
522+
549523
case DECISION:
550-
case FORK_JOIN:
524+
case FORK_JOIN:
551525
for(List<WorkflowTask> childx : children()){
552526
for(WorkflowTask child : childx){
553527
if(child.has(taskReferenceName)){
554528
return true;
555-
}
529+
}
556530
}
557531
}
558532
break;
559533
default:
560534
break;
561535
}
562-
536+
563537
return false;
564-
538+
565539
}
566-
540+
567541
public WorkflowTask get(String taskReferenceName){
568542

569543
if(this.getTaskReferenceName().equals(taskReferenceName)){
@@ -578,9 +552,9 @@ public WorkflowTask get(String taskReferenceName){
578552
}
579553
}
580554
return null;
581-
555+
582556
}
583-
557+
584558
@Override
585559
public String toString() {
586560
return name + "/" + taskReferenceName;

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 getWorkflowName();
247+
return workflowType;
248248
}
249249

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

267267
/**

0 commit comments

Comments
 (0)