throw new GeniePreconditionException("No application entered. Unable to set application.");
}
if (StringUtils.isBlank(application.getId())) {
throw new GeniePreconditionException("No application id entered. Unable to set application.");
}
final Command command = this.commandRepo.findOne(id);
if (command != null) {
final Application app = this.appRepo.findOne(application.getId());
if (app != null) {
command.setApplication(app);
} else {
throw new GenieNotFoundException("No application with id " + application.getId() + " exists.");
}
return command.getApplication();
} else {
throw new GenieNotFoundException("No command with id " + id + " exists.");
}
}