public void updateMovie(Movie m) throws ServerFailureException, ObjectNotFoundException {
   try {
     pm.updateMovie(m);
   } catch (MapException e) {
     throw new ServerFailureException(e.getMessage());
   }
 }
 public void deleteMovie(int id) throws ServerFailureException, ObjectNotFoundException {
   try {
     pm.deleteMovie(id);
   } catch (MapException e) {
     throw new ServerFailureException(e.getMessage());
   }
 }
 public Movie getMovieById(int id) throws ServerFailureException, ObjectNotFoundException {
   try {
     return pm.getMovieById(id);
   } catch (MapException e) {
     throw new ServerFailureException(e.getMessage());
   }
 }
 public void addMovie(Movie m) throws ServerFailureException {
   try {
     pm.insertMovie(m);
   } catch (MapException e) {
     throw new ServerFailureException(e.getMessage());
   }
 }
 public List getAllMovieRatings() throws ServerFailureException {
   try {
     return pm.getAllMovieRatings();
   } catch (MapException e) {
     throw new ServerFailureException(e.getMessage());
   }
 }
 public void deleteAllMovies() throws ServerFailureException {
   try {
     pm.deleteAllMovies();
   } catch (MapException e) {
     throw new ServerFailureException(e.getMessage());
   }
 }
 public boolean validateUser(String userId, String password) throws ServerFailureException {
   try {
     return pm.validateUser(userId, password);
   } catch (MapException e) {
     throw new ServerFailureException(e.getMessage());
   }
 }
 private BusinessDelegate() throws ServerFailureException {
   super();
   try {
     pm = PersistenceMapFactory.getInstance().getMap();
   } catch (MapException e) {
     throw new ServerFailureException(e.getMessage());
   }
 }
Esempio n. 9
0
 private void check(String expected, MapException ex) {
   String msg = ex.getMessage();
   boolean ends = msg.startsWith(expected);
   assertEquals(
       "Message should have started with: \""
           + expected
           + ".\"  Full message was \""
           + msg
           + "\".",
       true,
       ends);
   boolean resolvedThings = msg.endsWith("[]");
   assertEquals(true, resolvedThings);
 }