public static Situation buildSituation(Request request) throws WorkflowException {
Role[] roles;
try {
roles = PolicyAuthorizer.getRoles(request);
} catch (AccessControlException e) {
throw new WorkflowException(e);
}
Session session = request.getSession(false);
if (session == null) {
throw new WorkflowException("Session not initialized!");
}
Identity identity = Identity.getIdentity(session);
return WorkflowFactory.newInstance().buildSituation(roles, identity);
}