Methods Summary |
---|
public void | addEntry(int id, java.lang.String owner, java.lang.String firstName, java.lang.String lastName, java.lang.String phoneNumber)
abeHome.create(id, owner, firstName, lastName, phoneNumber);
|
public void | ejbActivate()
init();
|
public void | ejbCreate(java.lang.String userName)
this.userName = userName;
init();
|
public void | ejbPassivate() abeHome = null;
|
public void | ejbRemove() abeHome = null;
|
public PeopleDTO | findByName(java.lang.String firstName, java.lang.String lastName)
Collection c = null;
if (firstName != null && lastName != null) {
c = abeHome.findByName(userName, firstName, lastName);
} else if (firstName != null) {
c = abeHome.findByFirstName(userName, firstName);
} else if (lastName != null) {
c = abeHome.findByLastName(userName, lastName);
} else {
c = abeHome.findAll(userName);
}
return (getDTOFromCollection(c));
|
private PeopleDTO | getDTOFromCollection(java.util.Collection people)
PeopleDTO dto = new PeopleDTO();
for (Iterator i = people.iterator(); i.hasNext();) {
LocalAddressBookEntry entry = (LocalAddressBookEntry)i.next();
dto.addPerson(new Person(entry.getFirstName(),
entry.getLastName(),
entry.getPhoneNumber()));
}
return dto;
|
private void | init()
try {
InitialContext ic = new InitialContext();
abeHome =
(LocalAddressBookEntryHome)ic.lookup("java:comp/env/ejb/local/AddressBookEntry");
} catch(Exception ex) {
throw new EJBException("Error activating", ex);
}
|
public void | setSessionContext(SessionContext aContext)
context=aContext;
|