Methods Summary |
---|
public void | ejbActivate()
|
public void | ejbCreate()
try {
InitialContext ic = new InitialContext();
personHome = (LocalEJBPersonHome)ic.lookup("java:comp/env/ejb/local/Person");
} catch(Exception ex) {
throw new EJBException("Error looking up PersonHome: " + ex, ex);
}
|
public void | ejbPassivate()
|
public void | ejbRemove()
|
public PeopleDTO | findByName(java.lang.String firstName, java.lang.String lastName)
Collection c = null;
if (firstName != null && lastName != null) {
c = personHome.findByName(firstName, lastName);
} else if (firstName != null) {
c = personHome.findByFirstName(firstName);
} else if (lastName != null) {
c = personHome.findByLastName(lastName);
} else {
c = personHome.findAll();
}
return getDTOFromCollection(c);
|
private PeopleDTO | getDTOFromCollection(java.util.Collection people)
PeopleDTO dto = new PeopleDTO();
for (Iterator i = people.iterator(); i.hasNext();) {
LocalEJBPerson ejbPerson = (LocalEJBPerson)i.next();
dto.addPerson(new Person(ejbPerson.getFirstName(),
ejbPerson.getLastName(),
ejbPerson.getPhoneNumber()));
}
return dto;
|
public void | setSessionContext(SessionContext aContext)
context=aContext;
|