@Override public Message update(Orator object, BindingResult result) { if (result.hasErrors()) { Message oratorMessage = new Message("There is error in inserting the orator", false); List<String> errorOrator = new ArrayList<String>(); for (ObjectError error : result.getAllErrors()) { errorOrator.add(error.getDefaultMessage()); } oratorMessage.setErrors(errorOrator); return oratorMessage; } else { oratorRepository.save(object); Message oratorMessage = new Message("Orator save successfully", true); oratorMessage.setId(object.getIdOrator()); return oratorMessage; } }
@Override public Message delete(int id) { oratorRepository.delete(id); Message message = new Message("Object deleted successfully", true); return message; }
@Override public Orator get(int id) { return oratorRepository.findOne(id); }
@Override public List<Orator> listAll() { logger.debug("getting list of orators"); List<Orator> orators = oratorRepository.findAll(); return orators; }