raiseWarning(target, feedbackForm, invalidReasonIfAny);
return false;
}
final CommandContext commandContext = getServicesInjector().lookupService(CommandContext.class);
final Command command;
if (commandContext != null) {
command = commandContext.getCommand();
command.setExecutor(Executor.USER);
} else {
command = null;
}
// the object store could raise an exception (eg uniqueness constraint)
// so we handle it here.
try {
// could be programmatic flushing, so must include in the try... finally
final ObjectAdapter resultAdapter = executeActionHandlingApplicationExceptions();
// flush any queued changes, so concurrency or violation exceptions (if any)
// will be thrown here
getTransactionManager().flushTransaction();
ActionResultResponse resultResponse = ActionResultResponseType.determineAndInterpretResult(this.getActionModel(), target, resultAdapter);
resultResponse.getHandlingStrategy().handleResults(this, resultResponse);
if (actionModel.isBookmarkable()) {
bookmarkPage(actionModel);
}
if(actionPrompt != null) {
actionPrompt.closePrompt(target);
// cos will be reused next time, so mustn't cache em.
actionModel.clearArguments();
}
return true;
} catch (RuntimeException ex) {
String message = recognizeException(ex, target, feedbackForm);
if (message != null) {
// no need to add to message broker, should already have been added...
if(feedbackForm == null) {
// forward on instead to void page
// (otherwise, we'll have rendered an action parameters page
// and so we'll be staying on that page)
ActionResultResponseHandlingStrategy.REDIRECT_TO_VOID.handleResults(this, null);
}
return false;
}
// not handled, so capture and propagate
if(command != null) {
command.setException(Throwables.getStackTraceAsString(ex));
}
throw ex;
}
}