@Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { TokenClient tc = Configuration.getInstance().getTokenClient(); String rtoken = request.getParameter("token"); String pToken; String user; if (rtoken != null) { Property[] properties = tc.getTokenProperties(rtoken); user = PropertyUtils.getProperty(properties, AuthenticationConstants.PROPERTY_USER) .getValue() .toString(); pToken = rtoken; } else { ApplicationState state = ApplicationState.getCurrentInstance(new HttpServletRequestWrapper(request)); User currentUser = state.getCurrentUser(); pToken = currentUser.getToken(); user = currentUser.getName(); } ITaskManagementService taskManager = getTMS(request, pToken); Task[] tasks = taskManager.getAvailableTasks("Task", "ORDER BY T._creationDate"); FormManager fmanager = FormManagerBroker.getInstance().getFormManager(); ServletOutputStream outputStream = response.getOutputStream(); String filename = "tasks for " + user + getFileExt(); response.setContentType(getFileMimeType()); response.addHeader("Content-disposition", "attachment; filename=\"" + filename + "\""); generateFile(request, pToken, user, tasks, fmanager, outputStream); } catch (Exception e) { throw new ServletException(e); } }
protected void fillModel(Map model) { final UIFWApplicationState state = ApplicationState.getCurrentInstance(_request); final String token = state.getCurrentUser().getToken(); final String user = state.getCurrentUser().getName(); try { TasksCollector collector = new TasksCollector(_request, user, token); model.put("tasks", collector.retrieveTasks()); } catch (Exception ex) { _errors.add( new ActionError( -1, null, "com_intalio_bpms_workflow_tasks_retrieve_error", null, ActionError.getStackTrace(ex), null, null)); _log.error("Error while retrieving task list", ex); } model.put("participantToken", token); model.put("currentUser", user); model.put("refreshTime", Configuration.getInstance().getRefreshTime()); }