}
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {
OsWorkflowContext context = OsWorkflowContextHolder.getWorkflowContext();
context.setCaller(getCaller(request));
if (isAllowOverrideWithRequestParameter()) {
long instanceIdFromRequest = RequestUtils.getLongParameter(request, getOverrideRequestParameterKey(), Long.MIN_VALUE);
if (instanceIdFromRequest != Long.MIN_VALUE) {
System.out.println("Setting instance id");
context.setInstanceId(instanceIdFromRequest);
}
else if (isSessionStorageEnabled()) {
HttpSession session = request.getSession();
Object instanceId = session.getAttribute(SESSION_KEY_INSTANCE_ID);
if ((instanceId != null) && (instanceId instanceof Long)) {
context.setInstanceId(((Long) instanceId).longValue());
}
}
}