{
VirtualLibraryEngine vengine = (VirtualLibraryEngine) getEngine();
Integer targetUserId = getTargetUserId();
Person target = vengine.readPerson(targetUserId);
List selectedBooks = getSelectedBooks();
int count = Tapestry.size(selectedBooks);
if (count == 0)
{
setError(selectAtLeastOneBook(target.getNaturalName()));
return;
}
Integer[] bookIds = (Integer[]) selectedBooks.toArray(new Integer[count]);
int i = 0;
while (true)
{
IOperations operations = vengine.getOperations();
try
{
operations.transferBooks(targetUserId, bookIds);
break;
}
catch (FinderException ex)
{
throw new ApplicationRuntimeException(ex);
}
catch (RemoteException ex)
{
vengine.rmiFailure(updateFailure(), ex, i++);
}
}
MyLibrary myLibrary = getMyLibrary();
myLibrary.setMessage(transferedBooks(count, target.getNaturalName()));
myLibrary.activate();
}