command = application.getDefaultHTMLCommand(sessionVariable.getEvent());
}
if (command != null) {
if (command.requiresMapping()) {
DataModel actModel = sessionVariable.getActState().getModel();
if (actModel != null) {
mapRequestParametersToModel(request, actModel);
}
}
try {
FWLog.debug("execute command " + command.getClass());
doSwitchState = command.execute(sessionVariable);
// do not try to create a response, if the command handles the response itself
if (command.handlesResponse()) {
return;
}
} catch (Exception e) {
application.handleException(sessionVariable, e);
}
}
if (doSwitchState) {
HTMLTransition defaultTransition = application.getDefaultHTMLTransition(sessionVariable.getEvent());
HTMLState targetState = defaultTransition == null ? null : defaultTransition.getTargetState();
if (BackButtonHTMLFunction.BACK_EVENT.equals(sessionVariable.getEvent())) {
targetState = sessionVariable.getActState();
FWLog.debug("targetState = " + targetState.getName());
}
if (targetState == null) {
sessionVariable.doStateTransition();
} else {
sessionVariable.getStateMachine().setActState(targetState);
}
String childName = sessionVariable.getChild();
if (childName != null) {
if (oldState.getModel() != null) {
try {
DataModel child = oldState.getModel().getChild(childName);
sessionVariable.getActState().setModel(child);
if (sessionVariable.getDuplicate()) {
sessionVariable.getActState().startDuplicatePopup();
}
} catch (Exception e) {
//ignore
}
}
}
}
actState = sessionVariable.getActState();
DataModel actModel = actState.getModel();
FWLog.debug("ACT MODEL = " + (actModel == null ? "null" : actModel.getFieldName()));
sessionVariable.storeActState();
sessionVariable.getResolver().getVariableStore().setVariable(VariableStore.STATE, actState.getName());
sessionVariable.getResolver().getVariableStore().setVariable(VariableStore.REQUEST_URL, request.getRequestURL().toString());