Object[] parameters = cycle.getServiceParameters();
Integer bookPK = (Integer) parameters[0];
Visit visit = (Visit) getPage().getVisit();
Home home = (Home) cycle.getPage("Home");
VirtualLibraryEngine vengine = (VirtualLibraryEngine)cycle.getEngine();
int i = 0;
while (true)
{
try
{
IOperations bean = vengine.getOperations();
Book book = bean.borrowBook(bookPK, visit.getUserId());
home.setMessage("Borrowed: " + book.getTitle());
break;
}
catch (BorrowException ex)
{
vengine.presentError(ex.getMessage(), cycle);
return;
}
catch (FinderException ex)
{
throw new ApplicationRuntimeException("Unable to find book or user. ", ex);
}
catch (RemoteException ex)
{
vengine.rmiFailure("Remote exception borrowing book.", ex, i++);
}
}
cycle.activate(home);
}