FileDocCategorySizeDatePackage
DeleteMovie.javaAPI DocExample1132Tue Dec 24 13:30:42 GMT 2002com.mediamania.prototype

DeleteMovie

public class DeleteMovie extends com.mediamania.MediaManiaApp

Fields Summary
private String
movieTitle
Constructors Summary
public DeleteMovie(String title)

        movieTitle = title;
    
Methods Summary
public voidexecute()

        Movie movie = PrototypeQueries.getMovie(pm, movieTitle);
        if( movie == null ){
            System.err.print("Could not access movie with title of ");
            System.err.println(movieTitle);
            return;
        }
        Set cast = movie.getCast();
        Iterator iter = cast.iterator();
        while( iter.hasNext() ){
            Role role = (Role) iter.next();
            Actor actor = role.getActor();
            actor.removeRole(role);
        }
        pm.deletePersistentAll(cast);
        pm.deletePersistent(movie);
    
public static voidmain(java.lang.String[] args)

        String title = args[0];
        DeleteMovie deleteMovie = new DeleteMovie(title);
        deleteMovie.executeTransaction();