Пример #1
0
 public void updateTrack(final User user, final long id, final String title, final String points)
     throws TrackNotFoundException, AccessDeniedException {
   final TrackImpl track = fetchTrackForUpdate(user, id);
   track.setTitle(title);
   track.setPoints(points);
   entityManager.merge(track);
 }
Пример #2
0
 private TrackImpl fetchTrackForUpdate(final User user, final long id)
     throws TrackNotFoundException, AccessDeniedException {
   final TrackImpl track = fetchTrack(id);
   if (!track.getUser().equals(user)) throw new AccessDeniedException();
   return track;
 }