1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
@ExceptionHandler(DataIntegrityViolationException.class)
public void handleMySpeException(DataIntegrityViolationException ex, HttpServletResponse response) throws ServiceException
{
throw new ServiceException();
}
@Override
@Transactional(rollbackFor = {ServiceException.class})
public void modifierTournee(Long _tourneeId, String _intitule, Integer _intervalleGPS, String _commentaire) throws ServiceException {
modifierTourneeWithServiceException();
}
private void modifierTourneeWithServiceException(Long _tourneeId, String _intitule, Integer _intervalleGPS, String _commentaire) throws ServiceException {
Tournee tournee;
// Recherche de la tournee
tournee = tourneeRepository.findOne(_tourneeId);
if (tournee == null)
throw new ServiceException("La tournée n'existe pas.");
tournee.setIntitule(_intitule);
tournee.setIntervalleGPS(_intervalleGPS);
tournee.setCommentaire(_commentaire);
} |
Partager