Source:
public boolean performNextOperation(int completedChildCount) { syncChildCommandList(getParameters().getCommandStep(), getParameters().getChildCommands()); Guid currentChildId = getCurrentChildId(getParameters().getCommandStep(), getParameters().getChildCommands()); if (currentChildId != null) { getParameters().setCommandStep(getParameters().getNextCommandStep()); } log.info("Executing Cold Merge command step '{}'", getParameters().getCommandStep()); Pair<VdcActionType, ? extends VdcActionParametersBase> nextCommand = null; switch (getParameters().getCommandStep()) { case PREPARE_MERGE: nextCommand = new Pair<>(VdcActionType.PrepareMerge, buildColdMergeParameters(getImageId(), getDestinationImageId())); getParameters().setNextCommandStep(RemoveSnapshotSingleDiskStep.MERGE); break; case MERGE: nextCommand = new Pair<>(VdcActionType.ColdMerge, buildColdMergeParameters(getImageId(), getDestinationImageId())); getParameters().setNextCommandStep(RemoveSnapshotSingleDiskStep.FINALIZE_MERGE); break; case FINALIZE_MERGE: nextCommand = new Pair<>(VdcActionType.FinalizeMerge, buildColdMergeParameters(getImageId(), getDestinationImageId())); getParameters().setNextCommandStep(RemoveSnapshotSingleDiskStep.DESTROY_IMAGE); break; case DESTROY_IMAGE: nextCommand = new Pair<>(VdcActionType.DestroyImage, buildDestroyImageParameters(getActiveDiskImage().getId(), Collections.singletonList(getDestinationImageId()), VdcActionType.ColdMergeSnapshotSingleDisk)); getParameters().setNextCommandStep(RemoveSnapshotSingleDiskStep.DESTROY_IMAGE_CHECK); break; case DESTROY_IMAGE_CHECK: nextCommand = new Pair<>(VdcActionType.DestroyImageCheck, buildDestroyImageParameters(getActiveDiskImage().getId(), Collections.singletonList(getDestinationImageId()), VdcActionType.ColdMergeSnapshotSingleDisk)); getParameters().setNextCommandStep(RemoveSnapshotSingleDiskStep.COMPLETE); break; case COMPLETE: getParameters().setDestroyImageCommandComplete(true); setCommandStatus(CommandStatus.SUCCEEDED); break; } persistCommand(getParameters().getParentCommand(), true); if (nextCommand != null) { runInternalActionWithTasksContext(nextCommand.getFirst(), nextCommand.getSecond()); return true; } else { return false; } }

Target:
public boolean performNextOperation(int completedChildCount) { log.info("Executing Cold Merge command step '{}'", getParameters().getCommandStep()); Pair<VdcActionType, ? extends VdcActionParametersBase> nextCommand = null; switch (getParameters().getCommandStep()) { case PREPARE_MERGE: nextCommand = new Pair<>(VdcActionType.PrepareMerge, buildColdMergeParameters(getImageId(), getDestinationImageId())); getParameters().setNextCommandStep(RemoveSnapshotSingleDiskStep.MERGE); break; case MERGE: nextCommand = new Pair<>(VdcActionType.ColdMerge, buildColdMergeParameters(getImageId(), getDestinationImageId())); getParameters().setNextCommandStep(RemoveSnapshotSingleDiskStep.FINALIZE_MERGE); break; case FINALIZE_MERGE: nextCommand = new Pair<>(VdcActionType.FinalizeMerge, buildColdMergeParameters(getImageId(), getDestinationImageId())); getParameters().setNextCommandStep(RemoveSnapshotSingleDiskStep.DESTROY_IMAGE); break; case DESTROY_IMAGE: nextCommand = buildDestroyCommand(VdcActionType.DestroyImage, Collections.singletonList(getDestinationImageId())); break; case DESTROY_IMAGE_CHECK: nextCommand = buildDestroyCommand(VdcActionType.DestroyImageCheck, Collections.singletonList(getDestinationImageId())); break; case COMPLETE: getParameters().setDestroyImageCommandComplete(true); setCommandStatus(CommandStatus.SUCCEEDED); break; } persistCommand(getParameters().getParentCommand(), true); if (nextCommand != null) { runInternalActionWithTasksContext(nextCommand.getFirst(), nextCommand.getSecond()); return true; } else { return false; } }