public List<Command> removeAllCommandsForCluster(
final String id) throws GenieException {
if (StringUtils.isBlank(id)) {
throw new GeniePreconditionException("No cluster id entered. Unable to remove commands.");
}
final Cluster cluster = this.clusterRepo.findOne(id);
if (cluster != null) {
final List<Command> cmdList = new ArrayList<>();
cmdList.addAll(cluster.getCommands());
for (final Command cmd : cmdList) {
cluster.removeCommand(cmd);
}
return cluster.getCommands();
} else {
throw new GenieNotFoundException("No cluster with id " + id + " exists.");
}
}