private void loadEveryDayForm(ActionForm form, ActionRequest req) {
    String[] everyDay = req.getParameterValues("everyDay");

    ContentImporterForm contentImporterForm = (ContentImporterForm) form;
    if (UtilMethods.isSet(everyDay) && contentImporterForm.isEveryInfo()) {
      for (String dayOfWeek : everyDay) {
        if (dayOfWeek.equals("MON")) contentImporterForm.setMonday(true);
        else if (dayOfWeek.equals("TUE")) contentImporterForm.setTuesday(true);
        else if (dayOfWeek.equals("WED")) contentImporterForm.setWednesday(true);
        else if (dayOfWeek.equals("THU")) contentImporterForm.setThusday(true);
        else if (dayOfWeek.equals("FRI")) contentImporterForm.setFriday(true);
        else if (dayOfWeek.equals("SAT")) contentImporterForm.setSaturday(true);
        else if (dayOfWeek.equals("SUN")) contentImporterForm.setSunday(true);
      }

      contentImporterForm.setEveryInfo(true);
      contentImporterForm.setEvery("isDays");
    } else {
      contentImporterForm.setEvery("");
      contentImporterForm.setMonday(false);
      contentImporterForm.setTuesday(false);
      contentImporterForm.setWednesday(false);
      contentImporterForm.setThusday(false);
      contentImporterForm.setFriday(false);
      contentImporterForm.setSaturday(false);
      contentImporterForm.setSunday(false);
    }
  }
  private void _populateForm(ActionForm form, CronScheduledTask scheduler) {
    try {
      BeanUtils.copyProperties(form, scheduler);
      ContentImporterForm contentImporterForm = ((ContentImporterForm) form);

      SimpleDateFormat sdf = new SimpleDateFormat(WebKeys.DateFormats.DOTSCHEDULER_DATE2);

      if (scheduler.getStartDate() != null) {
        contentImporterForm.setHaveStartDate(true);
      } else {
        contentImporterForm.setHaveStartDate(true);
        contentImporterForm.setStartDate(sdf.format(new Date()));
      }

      if (scheduler.getEndDate() != null) {
        contentImporterForm.setHaveEndDate(true);
      } else {
        contentImporterForm.setHaveEndDate(true);
        contentImporterForm.setEndDate(sdf.format(new Date()));
      }

      if (UtilMethods.isSet(scheduler.getCronExpression())) {
        StringTokenizer cronExpressionTokens = new StringTokenizer(scheduler.getCronExpression());
        String token;
        String[] intervalTokens;
        String[] rangeTokens;

        // Seconds Cron Expression
        if (cronExpressionTokens.hasMoreTokens()) {
          token = cronExpressionTokens.nextToken();

          if (token.equals("*")) {
            contentImporterForm.setAtInfo(false);
            contentImporterForm.setAt(null);
            contentImporterForm.setAtTimeSecond(0);
          } else {
            intervalTokens = token.split("/");
            rangeTokens = intervalTokens[0].split("-");

            if (rangeTokens.length == 2) {
              contentImporterForm.setAtInfo(true);
              contentImporterForm.setAt("isBetween");
              try {
                contentImporterForm.setBetweenFromSecond(Integer.parseInt(rangeTokens[0]));
                contentImporterForm.setBetweenToSecond(Integer.parseInt(rangeTokens[1]));
              } catch (Exception e) {
                contentImporterForm.setBetweenFromSecond(0);
                contentImporterForm.setBetweenToSecond(0);
              }
            } else {
              contentImporterForm.setAtInfo(true);
              contentImporterForm.setAt("isTime");
              try {
                contentImporterForm.setAtTimeSecond(Integer.parseInt(intervalTokens[0]));
              } catch (Exception e) {
                contentImporterForm.setAtTimeSecond(0);
              }
            }
          }
        }

        contentImporterForm.setEachInfo(false);

        // Minutes Cron Expression
        if (cronExpressionTokens.hasMoreTokens()) {
          token = cronExpressionTokens.nextToken();

          if (token.equals("*")) {
            contentImporterForm.setAtInfo(false);
            contentImporterForm.setAt(null);
            contentImporterForm.setAtTimeMinute(0);
          } else {
            intervalTokens = token.split("/");
            rangeTokens = intervalTokens[0].split("-");

            if (rangeTokens.length == 2) {
              contentImporterForm.setAtInfo(true);
              contentImporterForm.setAt("isBetween");
              try {
                contentImporterForm.setBetweenFromMinute(Integer.parseInt(rangeTokens[0]));
                contentImporterForm.setBetweenToMinute(Integer.parseInt(rangeTokens[1]));
              } catch (Exception e) {
                contentImporterForm.setBetweenFromMinute(0);
                contentImporterForm.setBetweenToMinute(0);
              }
            } else {
              contentImporterForm.setAtInfo(true);
              contentImporterForm.setAt("isTime");
              try {
                contentImporterForm.setAtTimeMinute(Integer.parseInt(intervalTokens[0]));
              } catch (Exception e) {
                contentImporterForm.setAtTimeMinute(0);
              }
            }

            if (intervalTokens.length == 2) {
              try {
                contentImporterForm.setEachMinutes(Integer.parseInt(intervalTokens[1]));
                contentImporterForm.setEachInfo(true);
              } catch (Exception e) {
                contentImporterForm.setEachMinutes(0);
              }
            }
          }
        }

        // Hours Cron Expression
        if (cronExpressionTokens.hasMoreTokens()) {
          token = cronExpressionTokens.nextToken();

          if (token.equals("*")) {
            contentImporterForm.setAtInfo(false);
            contentImporterForm.setAt(null);
            contentImporterForm.setAtTimeHour(0);
          } else {
            intervalTokens = token.split("/");
            rangeTokens = intervalTokens[0].split("-");

            if (rangeTokens.length == 2) {
              contentImporterForm.setAtInfo(true);
              contentImporterForm.setAt("isBetween");
              try {
                contentImporterForm.setBetweenFromHour(Integer.parseInt(rangeTokens[0]));
                contentImporterForm.setBetweenToHour(Integer.parseInt(rangeTokens[1]));
              } catch (Exception e) {
                contentImporterForm.setBetweenFromHour(0);
                contentImporterForm.setBetweenToHour(0);
              }
            } else {
              contentImporterForm.setAtInfo(true);
              contentImporterForm.setAt("isTime");
              try {
                contentImporterForm.setAtTimeHour(Integer.parseInt(intervalTokens[0]));
              } catch (Exception e) {
                contentImporterForm.setAtTimeHour(0);
              }
            }

            if (intervalTokens.length == 2) {
              try {
                contentImporterForm.setEachHours(Integer.parseInt(intervalTokens[1]));
                contentImporterForm.setEachInfo(true);
              } catch (Exception e) {
                contentImporterForm.setEachHours(0);
              }
            }
          }
        }

        contentImporterForm.setEveryInfo(false);
        contentImporterForm.setEvery(null);

        // Days of Month Cron Expression
        if (cronExpressionTokens.hasMoreTokens()) {
          token = cronExpressionTokens.nextToken();

          if (token.equals("*") || token.equals("?")) {
            contentImporterForm.setEveryDateDay(-1);
          } else {
            try {
              contentImporterForm.setEveryDateDay(Integer.parseInt(token));
              contentImporterForm.setEveryInfo(true);
              contentImporterForm.setEvery("isDate");
            } catch (Exception e) {
              contentImporterForm.setEveryDateDay(-1);
            }
          }
        }

        // Months Cron Expression
        if (cronExpressionTokens.hasMoreTokens()) {
          token = cronExpressionTokens.nextToken();

          if (token.equals("*")) {
            contentImporterForm.setEveryDateMonth(-1);
          } else {
            try {
              contentImporterForm.setEveryDateMonth(Integer.parseInt(token));
              contentImporterForm.setEveryInfo(true);
              contentImporterForm.setEvery("isDate");
            } catch (Exception e) {
              contentImporterForm.setEveryDateMonth(-1);
            }
          }
        }

        // Days of Week Cron Expression
        if (cronExpressionTokens.hasMoreTokens()) {
          token = cronExpressionTokens.nextToken();

          if ((!token.equals("*")) && (!token.equals("?"))) {
            StringTokenizer daysOfWeek = new StringTokenizer(token, ",");
            String dayOfWeek;

            for (; daysOfWeek.hasMoreTokens(); ) {
              dayOfWeek = daysOfWeek.nextToken();

              if (dayOfWeek.equals("MON")) contentImporterForm.setMonday(true);
              else if (dayOfWeek.equals("TUE")) contentImporterForm.setTuesday(true);
              else if (dayOfWeek.equals("WED")) contentImporterForm.setWednesday(true);
              else if (dayOfWeek.equals("THU")) contentImporterForm.setThusday(true);
              else if (dayOfWeek.equals("FRI")) contentImporterForm.setFriday(true);
              else if (dayOfWeek.equals("SAT")) contentImporterForm.setSaturday(true);
              else if (dayOfWeek.equals("SUN")) contentImporterForm.setSunday(true);
            }

            contentImporterForm.setEveryInfo(true);
            contentImporterForm.setEvery("isDays");
          }
        }

        // Years Cron Expression
        if (cronExpressionTokens.hasMoreTokens()) {
          token = cronExpressionTokens.nextToken();

          if (token.equals("*")) {
            contentImporterForm.setEveryDateYear(-1);
          } else {
            try {
              contentImporterForm.setEveryDateYear(Integer.parseInt(token));
              contentImporterForm.setEveryInfo(true);
              contentImporterForm.setEvery("isDate");
            } catch (Exception e) {
              contentImporterForm.setEveryDateYear(-1);
            }
          }
        }
      }

      Map properties = scheduler.getProperties();
      contentImporterForm.setStructure((String) properties.get("structure"));

      String[] fields = {};
      if (UtilMethods.isSet(properties.get("fields"))) {
        String[] strFields = ((String) properties.get("fields")).split(",");
        List<String> longFields = new ArrayList<String>(strFields.length);
        for (String field : strFields) {
          longFields.add(field);
        }

        String[] tempArray = new String[longFields.size()];
        for (int pos = 0; pos < longFields.size(); ++pos) {
          tempArray[pos] = longFields.get(pos);
        }
        fields = tempArray;
      }

      contentImporterForm.setFields(fields);
      contentImporterForm.setFilePath((String) properties.get("filePath"));
      contentImporterForm.setReportEmail((String) properties.get("reportEmail"));
      contentImporterForm.setCsvSeparatorDelimiter(
          (String) properties.get("csvSeparatorDelimiter"));
      contentImporterForm.setCsvTextDelimiter((String) properties.get("csvTextDelimiter"));
      contentImporterForm.setLanguage((Long.parseLong((String) properties.get("language"))));
      contentImporterForm.setHaveCronExpression((Boolean) properties.get("haveCronExpression"));

      if (UtilMethods.isSet(properties.get("publishContent")))
        contentImporterForm.setPublishContent(
            new Boolean((String) properties.get("publishContent")));

      if (UtilMethods.isSet(properties.get("saveWithoutVersions")))
        contentImporterForm.setSaveWithoutVersions(
            new Boolean((String) properties.get("saveWithoutVersions")));

      if (UtilMethods.isSet(properties.get("deleteAllContent")))
        contentImporterForm.setDeleteAllContent(
            new Boolean((String) properties.get("deleteAllContent")));

      contentImporterForm.setNewForm(false);
    } catch (Exception e) {
      Logger.warn(this, e.getMessage());
    }
  }