public abstract Integer getTargetUserId();
public void formSubmit(IRequestCycle cycle)
{
VirtualLibraryEngine vengine = (VirtualLibraryEngine) getEngine();
Integer targetUserId = getTargetUserId();
Person target = vengine.readPerson(targetUserId);
List selectedBooks = getSelectedBooks();
int count = Tapestry.size(selectedBooks);
if (count == 0)
{
setError(format("select-at-least-one-book", 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(getMessage("update-failure"), ex, i++);
}
}
MyLibrary myLibrary = (MyLibrary) cycle.getPage("MyLibrary");