@Override
 public void deleteMovie(long movieId) {
   try {
     InitialContext ctx = new InitialContext();
     MovieManager mm = (MovieManager) ctx.lookup("de.hsh.is2.imdb.logic.MovieManager");
     mm.deleteMovie(movieId);
   } catch (Exception e) {
     new ShowErrorDialog("Fehler beim Löschen des Films", e);
   }
 }
 @Override
 public List<Movie> runSearch(String search) {
   List<Movie> movies;
   try {
     InitialContext ctx = new InitialContext();
     MovieManager mm = (MovieManager) ctx.lookup("de.hsh.is2.imdb.logic.MovieManager");
     movies = mm.getMovieList(search);
   } catch (Exception e) {
     new ShowErrorDialog("Fehler beim der Suche", e);
     movies = new ArrayList<Movie>();
   }
   return movies;
 }
  private void movieDialog(Long movieId) {
    MovieManager mm = null;
    GenreManager gm = null;
    try {
      InitialContext ctx = new InitialContext();
      mm = (MovieManager) ctx.lookup("de.hsh.is2.imdb.logic.MovieManager");
      gm = (GenreManager) ctx.lookup("de.hsh.is2.imdb.logic.GenreManager");
    } catch (Exception e) {
      e.printStackTrace();
    }

    Movie movie;
    if (movieId == null) movie = new Movie();
    else {
      try {
        movie = mm.getMovie(movieId);
      } catch (Exception e) {
        new ShowErrorDialog("Fehler beim Laden des Films", e);
        return;
      }
    }

    List<Genre> allGenres;
    try {
      allGenres = gm.getGenres();
    } catch (Exception e) {
      new ShowErrorDialog("Fehler beim Laden der Genres", e);
      return;
    }

    MovieDialog movieDialog = new MovieDialog(new MovieDialogCallbackImpl(), allGenres);
    movieDialog.setMovie(movie);

    boolean finished = false;
    while (!finished) {
      movieDialog.setVisible(true);
      finished = true;

      if (movieDialog.getOutcome().equals("ok")) {
        try {
          mm.insertUpdateMovie(movie, false);
        } catch (ImdbExceptionVersion e) {
          int result =
              JOptionPane.showConfirmDialog(
                  null,
                  "Ein andereR BenutzerIn hat diesen Film zwischenzeitlich ge�ndert. Wollen Sie trotzdem Speichern und die anderen �nderungen ggf. �berschreiben?");
          if (result == JOptionPane.YES_OPTION) {
            try {
              mm.insertUpdateMovie(movie, true);
            } catch (ImdbException e1) {
              new ShowErrorDialog("Fehler beim Speichern des Films", e);
              finished = false; // Movie Dialog offen halten
            }
          } else if (result == JOptionPane.NO_OPTION) finished = false;
        } catch (ImdbException e) {
          new ShowErrorDialog("Fehler beim Speichern des Films", e);
          finished = false; // Movie Dialog offen halten
        }
      }
    }
  }