Exemplo n.º 1
0
  private String getOwner(String ownerId) {

    String owner = ownerId;
    if (ownerId != null) {
      HTUser user = LoginHelper.get().getUser(ownerId);
      if (user != null) {
        owner = user.getFullName();
      }
    }
    return owner;
  }
Exemplo n.º 2
0
  @Override
  protected void doGet(HttpServletRequest request, HttpServletResponse resp)
      throws ServletException, IOException {
    // super.doGet(req, resp);

    HttpSession session = null;
    Request wiraRequest = new Request();

    try {
      session = request.getSession(true);
      SessionHelper.setHttpRequest(request);
    } catch (Exception e) {
      e.printStackTrace();
    }

    Response response = new Response();

    try {
      DB.beginTransaction();
      wiraRequest.setCommandName(IncomingRequestImpl.NEWAPPROVALREQUESTCOMMAND);

      String parameter = request.getParameter("docType");
      RequestType requestType = RequestType.getRequestType(parameter);

      // Create Context and set it
      wiraRequest.setContext(createContext(request, requestType, wiraRequest));

      HTUser user = new HTUser();
      user.setUserId(wiraRequest.getContext("ownerId").toString());
      if (session != null) session.setAttribute(ServerConstants.USER, user);

      // Submit
      IncomingRequestImpl handler = new IncomingRequestImpl();
      handler.executeClientRequest(wiraRequest, response);

      // Response
      PrintWriter out = resp.getWriter();
      BusinessKey key = response.getBusinessKey();
      assert key != null;

      resp.setContentType("text/json");
      out.println(
          "Response:"
              + key.getDocumentId()
              + " : "
              + key.getProcessInstanceId()
              + ":"
              + key.getSessionId()
              + "</b>");
      out.close();

      DB.commitTransaction();
    } catch (Exception e) {
      DB.rollback();
      e.printStackTrace();
      throw new RuntimeException(e);
    } finally {
      if (session != null) {
        session.invalidate();
      }

      DB.closeSession();
      SessionHelper.setHttpRequest(null);
      JBPMHelper.clearRequestData();
    }
  }