private void print(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ParseException {
    String confName = request.getParameter(ProjConst.CONF_NAME);
    String userId = request.getParameter(ProjConst.USER_ID);

    User user = UserDao.getInstance().getUserById(Long.parseLong(userId));
    Conference conference = ConferenceDao.getInstance().getConferenceByName(confName);

    JsonObject jsonObject = new JsonObject();

    String resultSuccess;
    String message;

    try {
      String[] header = new String[] {"         " + conference.getName()};
      String[] stringToPrint = new String[3];
      Date today = new Date();
      SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
      stringToPrint[0] = "Date: " + sdf.format(today);
      stringToPrint[1] = "My Name: " + user.getName();
      stringToPrint[2] = "My Company: " + user.getCompany().getName();

      TextPrinter tp = new TextPrinter();
      tp.doPrint(header, stringToPrint, true);

      resultSuccess = "true";
      message = "Participant tag is printing";

    } catch (Exception e) {
      resultSuccess = "false";
      message = e.getMessage();
    }

    response.setContentType("application/json;charset=UTF-8");
    PrintWriter out = response.getWriter();
    try {
      Gson gson = new Gson();
      String json;
      jsonObject.addProperty("resultSuccess", resultSuccess);
      jsonObject.addProperty("message", message);
      json = gson.toJson(jsonObject);
      out.write(json);
      out.flush();
    } finally {
      out.close();
    }
  }
  private void getConferences(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ParseException {
    String userId = request.getParameter(ProjConst.USER_ID);
    String filter = request.getParameter("filter");

    User user = UserDao.getInstance().getUserById(Long.parseLong(userId));

    // JsonObject jsonObject = new JsonObject();

    // String resultSuccess;
    // String message;

    List<String> confList = new LinkedList<String>();

    try {
      List<Conference> conferences =
          ConferencesUsersDao.getInstance().getScopedConferenceByDate(user, filter);
      for (Conference conf : conferences) {
        confList.add(conf.getName());
      }
      // message = "Conference successfully added";
      // resultSuccess = "true";

    } catch (Exception e) {
      // message = "Found problem while adding conference";
      // resultSuccess = "false";
    }

    response.setContentType("application/json;charset=UTF-8");
    PrintWriter out = response.getWriter();
    try {
      Gson gson = new Gson();
      String json;
      json = gson.toJson(confList);

      out.write(json);
      out.flush();
    } finally {
      out.close();
    }
  }
  private void removeUser(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ParseException {
    String confName = request.getParameter(ProjConst.CONF_NAME);
    String userId = request.getParameter(ProjConst.USER_ID);

    User user = UserDao.getInstance().getUserById(Long.parseLong(userId));
    Conference conference = ConferenceDao.getInstance().getConferenceByName(confName);

    JsonObject jsonObject = new JsonObject();

    String resultSuccess;
    String message;
    try {
      // ConferencesUsersDao.getInstance().removeUserFromConference(conference, user);
      ConferencesParticipantsDao.getInstance().removeUserArrivalFromConference(conference, user);
      resultSuccess = "true";
      message =
          "User "
              + user.getName()
              + " removed from arrival list to conference "
              + conference.getName();

    } catch (Exception e) {
      resultSuccess = "false";
      message = "Failed to update user arrival";
    }

    response.setContentType("application/json;charset=UTF-8");
    PrintWriter out = response.getWriter();
    try {
      Gson gson = new Gson();
      String json;
      jsonObject.addProperty("resultSuccess", resultSuccess);
      jsonObject.addProperty("message", message);
      json = gson.toJson(jsonObject);
      out.write(json);
      out.flush();
    } finally {
      out.close();
    }
  }