Add validation of step name uniqueness.

This commit is contained in:
2024-03-27 19:50:44 -05:00
parent e078015732
commit df4ac3ec35
2 changed files with 25 additions and 1 deletions

View File

@ -1362,12 +1362,17 @@ public class QInstanceValidator
///////////////////////////////////
// validate steps in the process //
///////////////////////////////////
Set<String> usedStepNames = new HashSet<>();
if(assertCondition(CollectionUtils.nullSafeHasContents(process.getStepList()), "At least 1 step must be defined in process " + processName + "."))
{
int index = 0;
for(QStepMetaData step : process.getStepList())
{
assertCondition(StringUtils.hasContent(step.getName()), "Missing name for a step at index " + index + " in process " + processName);
if(assertCondition(StringUtils.hasContent(step.getName()), "Missing name for a step at index " + index + " in process " + processName))
{
assertCondition(!usedStepNames.contains(step.getName()), "Duplicate step name [" + step.getName() + "] in process " + processName);
usedStepNames.add(step.getName());
}
index++;
////////////////////////////////////////////