@@ -57,55 +57,61 @@ class IndexWorkflowRequest : ActionRequest {
57
57
58
58
if (workflow.inputs.isEmpty()) {
59
59
validationException = ValidateActions .addValidationError(
60
- " Input list can not be empty." , validationException
60
+ " Input list can not be empty." ,
61
+ validationException
61
62
)
62
63
return validationException
63
64
}
64
65
if (workflow.inputs.size > 1 ) {
65
66
validationException = ValidateActions .addValidationError(
66
- " Input list can contain only one element." , validationException
67
+ " Input list can contain only one element." ,
68
+ validationException
67
69
)
68
70
return validationException
69
71
}
70
72
if (workflow.inputs[0 ] !is CompositeInput ) {
71
73
validationException = ValidateActions .addValidationError(
72
- " When creating a workflow input must be CompositeInput" , validationException
74
+ " When creating a workflow input must be CompositeInput" ,
75
+ validationException
73
76
)
74
77
}
75
78
val compositeInput = workflow.inputs[0 ] as CompositeInput
76
79
val monitorIds = compositeInput.sequence.delegates.stream().map { it.monitorId }.collect(Collectors .toList())
77
80
78
81
if (monitorIds.isNullOrEmpty()) {
79
82
validationException = ValidateActions .addValidationError(
80
- " Delegates list can not be empty." , validationException
83
+ " Delegates list can not be empty." ,
84
+ validationException
81
85
)
82
86
// Break the flow because next checks are dependant on non-null monitorIds
83
87
return validationException
84
88
}
85
89
86
90
if (monitorIds.size > MAX_DELEGATE_SIZE ) {
87
91
validationException = ValidateActions .addValidationError(
88
- " Delegates list can not be larger then $MAX_DELEGATE_SIZE ." , validationException
92
+ " Delegates list can not be larger then $MAX_DELEGATE_SIZE ." ,
93
+ validationException
89
94
)
90
95
}
91
96
92
97
if (monitorIds.toSet().size != monitorIds.size) {
93
98
validationException = ValidateActions .addValidationError(
94
- " Duplicate delegates not allowed" , validationException
99
+ " Duplicate delegates not allowed" ,
100
+ validationException
95
101
)
96
102
}
97
103
val delegates = compositeInput.sequence.delegates
98
104
val orderSet = delegates.stream().filter { it.order > 0 }.map { it.order }.collect(Collectors .toSet())
99
105
if (orderSet.size != delegates.size) {
100
106
validationException = ValidateActions .addValidationError(
101
- " Sequence ordering of delegate monitor shouldn't contain duplicate order values" , validationException
107
+ " Sequence ordering of delegate monitor shouldn't contain duplicate order values" ,
108
+ validationException
102
109
)
103
110
}
104
111
105
112
val monitorIdOrderMap: Map <String , Int > = delegates.associate { it.monitorId to it.order }
106
113
delegates.forEach {
107
114
if (it.chainedMonitorFindings != null ) {
108
-
109
115
if (it.chainedMonitorFindings.monitorId != null ) {
110
116
if (monitorIdOrderMap.containsKey(it.chainedMonitorFindings.monitorId) == false ) {
111
117
validationException = ValidateActions .addValidationError(
0 commit comments