FileDocCategorySizeDatePackage
GetActorRoles.javaAPI DocExample1235Tue Dec 24 13:56:36 GMT 2002com.mediamania.prototype

GetActorRoles

public class GetActorRoles extends com.mediamania.MediaManiaApp

Fields Summary
private String
actorName
Constructors Summary
public GetActorRoles(String actor)

    actorName = actor;
Methods Summary
public voidexecute()

public voidgetRoles()

    Transaction tx = pm.currentTransaction();
    tx.begin();
    Actor actor = PrototypeQueries.getActor(pm, actorName);
    if( actor == null ){
        System.out.print("There is no actor named ");
        System.out.println(actorName);
        tx.rollback();
        return;		
    }
    Set roles = actor.getRoles();
    Iterator iter = roles.iterator();
    while( iter.hasNext() ){
        Role role = (Role) iter.next();
        String roleName = role.getName();
        Movie movie = role.getMovie();
        String title = movie.getTitle();
        System.out.print(title);
        System.out.print(";");
        System.out.println(roleName);		
    }
    tx.commit();
public static voidmain(java.lang.String[] args)

    GetActorRoles actorRoles = new GetActorRoles(args[0]);
    actorRoles.getRoles();