public static List<UserJournalFormBean> getUserJournalFormData(
      List<UserJournalBean> listUserJournalBean) {

    List<UserJournalFormBean> listFormBean = new ArrayList<UserJournalFormBean>();
    Double mark = null;

    for (UserJournalBean userJournalBean : listUserJournalBean) {
      UserJournalFormBean formBean = new UserJournalFormBean();
      List<Double> marks = userJournalBean.getMarks();
      if (marks != null) {
        if (marks.size() > 0) {
          mark = marks.get(0);
          formBean.setMark1(mark == null ? null : mark.toString());
        }
        if (marks.size() > 1) {
          mark = marks.get(1);
          formBean.setMark2(mark == null ? null : mark.toString());
        }
        if (marks.size() > 2) {
          mark = marks.get(2);
          formBean.setMark3(mark == null ? null : mark.toString());
        }
      }
      Integer numberOfAttempts = userJournalBean.getNumberOfAttempts();
      formBean.setNumberOfAttempts(numberOfAttempts != null ? numberOfAttempts.toString() : null);
      String markDate =
          CalendarHelper.FormatDate(userJournalBean.getMarkDate(), "dd-MM-yyyy HH:mm");
      formBean.setMarkDate(CalendarHelper.ParseDate(markDate));
      formBean.setComment(userJournalBean.getComment());
      listFormBean.add(formBean);
    }

    return listFormBean;
  }
  public static List<UserJournalFormBean> getUserJournalFormData(Map<String, String[]> parameters) {

    List<UserJournalFormBean> listFormBean = new ArrayList<UserJournalFormBean>();

    String[] marks1 = parameters.get("mark1");
    String[] marks2 = parameters.get("mark2");
    String[] marks3 = parameters.get("mark3");
    String[] numberOfAttempts = parameters.get("numberOfAttempts");
    String[] markDates = parameters.get("markDate");
    String[] comments = parameters.get("comment");

    for (int i = 0; comments != null && i < comments.length; ++i) {
      UserJournalFormBean formBean = new UserJournalFormBean();
      if (marks1 != null && !marks1[i].isEmpty()) {
        formBean.setMark1(marks1[i].trim());
      }
      if (marks2 != null && !marks2[i].isEmpty()) {
        formBean.setMark2(marks2[i].trim());
      }
      if (marks3 != null && !marks3[i].isEmpty()) {
        formBean.setMark3(marks3[i].trim());
      }
      if (numberOfAttempts != null && !numberOfAttempts[i].isEmpty()) {
        formBean.setNumberOfAttempts(numberOfAttempts[i].trim());
      }
      if (markDates != null && (markDates[i] != null & markDates[i] != "")) {
        formBean.setMarkDate(CalendarHelper.ParseDate(markDates[i]));
      }
      formBean.setComment(comments[i]);
      listFormBean.add(formBean);
    }

    return listFormBean;
  }
  public static List<UserJournalBean> getUserJournalBean(
      List<UserJournalBean> listUserJournalBean,
      List<UserJournalFormBean> listFormBean,
      GroupTask groupTask) {

    int counter = 0;
    String mark = null;
    for (UserJournalBean userJournalBean : listUserJournalBean) {
      UserJournalFormBean bean = listFormBean.get(counter);

      List<Double> marks = new ArrayList<Double>();
      if (groupTask.getMarksCount() > 0) {
        mark = bean.getMark1();
        marks.add(mark == null || mark.isEmpty() ? null : Double.valueOf(mark));
      }
      if (groupTask.getMarksCount() > 1) {
        mark = bean.getMark2();
        marks.add(mark == null || mark.isEmpty() ? null : Double.valueOf(mark));
      }
      if (groupTask.getMarksCount() > 2) {
        mark = bean.getMark3();
        marks.add(mark == null || mark.isEmpty() ? null : Double.valueOf(mark));
      }
      userJournalBean.setMarks(marks);
      userJournalBean.setMarkDate(bean.getMarkDate());
      userJournalBean.setComment(bean.getComment().isEmpty() ? null : bean.getComment());
      String numberOfAttempts = bean.getNumberOfAttempts();
      userJournalBean.setNumberOfAttempts(
          numberOfAttempts == null || numberOfAttempts.isEmpty()
              ? null
              : Integer.valueOf(numberOfAttempts));
      ++counter;
    }

    return listUserJournalBean;
  }