Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding missing validation #13489

Merged
merged 2 commits into from
Jan 23, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -293,12 +293,18 @@ public void deleteStep(final WorkflowStep step) throws DotDataException {
// Checking for Next Step references
for(WorkflowStep otherStep : findSteps(findScheme(step.getSchemeId()))){

for(WorkflowAction action : findActions(otherStep, APILocator.getUserAPI().getSystemUser())){

if(action.getNextStep().equals(step.getId())) {
throw new DotDataException("</br> <b> Step : '" + step.getName() + "' is being referenced by </b> </br></br>" +
" Step : '"+otherStep.getName() + "' -> Action : '" + action.getName() + "' </br></br>");
}
/*
Verify we are not validating the next step is the step we want to delete.
Remember the step can point to itself and that should not be a restriction when deleting.
*/
if (!otherStep.getId().equals(step.getId())) {
for(WorkflowAction action : findActions(otherStep, APILocator.getUserAPI().getSystemUser())){

if(action.getNextStep().equals(step.getId())) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CRITICAL Refactor this code to not nest more than 4 if/for/while/switch/try statements. rule

throw new DotDataException("</br> <b> Step : '" + step.getName() + "' is being referenced by </b> </br></br>" +
" Step : '"+otherStep.getName() + "' -> Action : '" + action.getName() + "' </br></br>");
}
}
}
}

Expand Down