Esempio n. 1
0
  @Override
  protected boolean shouldRemoveRow(WdbcResult result, int row) {
    String img = (String) result.getCell(row, "img");
    String link = (String) result.getCell(row, "link");

    if (link == null || img == null) {
      return true;
    } else {
      if (img.indexOf("next_page") > 0) {
        return false;
      } else {
        return true;
      }
    }
  }
Esempio n. 2
0
  @Override
  protected boolean shouldRemoveRow(WdbcResult result, int row) {
    String date = (String) result.getCell(row, "date");
    String title = (String) result.getCell(row, "title");
    String link = (String) result.getCell(row, "link");

    if (link == null || title == null || date == null) {
      return true;
    } else {
      Date time = getTime(date.trim());

      if (time == null) {
        return true;
      }

      Calendar cal = Calendar.getInstance();

      cal.add(Calendar.DATE, -m_maxDays);
      result.setValue(row, "date", m_format.format(time));

      if (link.startsWith("/")) {
        URL lastUri = m_session.getLastUrl();

        if (lastUri != null) {
          try {
            result.setValue(row, "link", new URL(lastUri, link).toExternalForm());
          } catch (MalformedURLException e) {
            // ignore it
          }
        }
      }

      if (time.after(cal.getTime())) {
        return false;
      } else {
        return true;
      }
    }
  }