Esempio n. 1
0
  @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);
    }
  }
Esempio n. 2
0
 public TasksCollectionAdapter() {
   super();
   _manager = (GenericFormManager) FormManagerBroker.getInstance().getFormManager();
 }