FileDocCategorySizeDatePackage
EJBFacadePersonCommand.javaAPI DocExample1582Sun Jul 20 19:00:10 BST 2003antipatterns.model

EJBFacadePersonCommand

public class EJBFacadePersonCommand extends Object implements PersonCommand

Fields Summary
private String
firstName
private String
lastName
private List
people
private PersonFacadeHome
personFacadeHome
Constructors Summary
Methods Summary
public java.util.ListgetPeople()

        return people;
    
public voidinitialize(javax.servlet.http.HttpSession session)

        Hashtable properties = new Properties();
        //properties.put(Context.INITIAL_CONTEXT_FACTORY,
        //    "com.sun.jndi.cosnaming.CNCtxFactory");
        //properties.put(Context.PROVIDER_URL, "iiop://wgs97-74:1050");
        
        InitialContext ic = new InitialContext(properties);
        Object personRef = ic.lookup("ejb/PersonFacade");
        
        personFacadeHome =
        (PersonFacadeHome)PortableRemoteObject.narrow(personRef, PersonFacadeHome.class);
    
public voidrunCommand()

        
        try {
            PersonFacade facade = personFacadeHome.create();
            PeopleDTO peopleDto = facade.findByName(firstName, lastName);
            
            people = peopleDto.getPeople();
        } catch(Exception ex) {
            ex.printStackTrace();
            return;
        }
        
    
public voidsetFirstName(java.lang.String firstName)

        this.firstName = firstName;
    
public voidsetLastName(java.lang.String lastName)

        this.lastName = lastName;