use of alien4cloud.paas.wf.exception.InconsistentWorkflowException in project alien4cloud by alien4cloud.
the class AbstractWorkflowBuilder method removeEdge.
public void removeEdge(Workflow wf, String from, String to) {
WorkflowStep fromStep = wf.getSteps().get(from);
if (fromStep == null) {
throw new InconsistentWorkflowException(String.format("Inconsistent workflow: a step nammed '%s' can not be found while it's referenced else where ...", from));
}
WorkflowStep toStep = wf.getSteps().get(to);
if (toStep == null) {
throw new InconsistentWorkflowException(String.format("Inconsistent workflow: a step nammed '%s' can not be found while it's referenced else where ...", to));
}
fromStep.removeFollowing(to);
toStep.removePreceding(from);
}
use of alien4cloud.paas.wf.exception.InconsistentWorkflowException in project alien4cloud by alien4cloud.
the class AbstractWorkflowBuilder method connectStepFrom.
void connectStepFrom(Workflow wf, String stepId, String[] stepNames) {
WorkflowStep to = wf.getSteps().get(stepId);
if (to == null) {
throw new InconsistentWorkflowException(String.format("Inconsistent workflow: a step nammed '%s' can not be found while it's referenced else where ...", stepId));
}
for (String preceding : stepNames) {
WorkflowStep precedingStep = wf.getSteps().get(preceding);
if (precedingStep == null) {
throw new InconsistentWorkflowException(String.format("Inconsistent workflow: a step nammed '%s' can not be found while it's referenced else where ...", preceding));
}
WorkflowUtils.linkSteps(precedingStep, to);
}
}
use of alien4cloud.paas.wf.exception.InconsistentWorkflowException in project alien4cloud by alien4cloud.
the class AbstractWorkflowBuilder method removeStep.
void removeStep(Workflow wf, String stepId, boolean force) {
WorkflowStep step = wf.getSteps().remove(stepId);
if (step == null) {
throw new InconsistentWorkflowException(String.format("Inconsistent workflow: a step nammed '%s' can not be found while it's referenced else where ...", stepId));
}
if (!force && step.getActivity() instanceof DelegateWorkflowActivity) {
throw new BadWorkflowOperationException("Native steps can not be removed from workflow");
}
if (step.getPrecedingSteps() != null) {
if (step.getOnSuccess() != null) {
// connect all preceding to all following
for (String precedingId : step.getPrecedingSteps()) {
WorkflowStep preceding = wf.getSteps().get(precedingId);
for (String followingId : step.getOnSuccess()) {
WorkflowStep following = wf.getSteps().get(followingId);
WorkflowUtils.linkSteps(preceding, following);
}
}
}
for (Object precedingId : step.getPrecedingSteps().toArray()) {
WorkflowStep preceding = wf.getSteps().get(precedingId);
unlinkSteps(preceding, step);
}
}
if (step.getOnSuccess() != null) {
for (Object followingId : step.getOnSuccess().toArray()) {
WorkflowStep following = wf.getSteps().get(followingId);
unlinkSteps(step, following);
}
}
}
use of alien4cloud.paas.wf.exception.InconsistentWorkflowException in project alien4cloud by alien4cloud.
the class AbstractWorkflowBuilder method connectStepTo.
void connectStepTo(Workflow wf, String stepId, String[] stepNames) {
WorkflowStep from = wf.getSteps().get(stepId);
if (from == null) {
throw new InconsistentWorkflowException(String.format("Inconsistent workflow: a step nammed '%s' can not be found while it's referenced else where ...", stepId));
}
for (String following : stepNames) {
WorkflowStep followingStep = wf.getSteps().get(following);
WorkflowUtils.linkSteps(from, followingStep);
}
}
Aggregations