Read entries from a data store @return list of matching URLWebPage objects @throws Exception
(
DataStore<String, WebPage> store, Mark requiredMark, String... fields)
| 98 | * @throws Exception |
| 99 | */ |
| 100 | public static ArrayList<URLWebPage> readContents( |
| 101 | DataStore<String, WebPage> store, Mark requiredMark, String... fields) |
| 102 | throws Exception { |
| 103 | ArrayList<URLWebPage> l = new ArrayList<URLWebPage>(); |
| 104 | |
| 105 | Query<String, WebPage> query = store.newQuery(); |
| 106 | if (fields != null) { |
| 107 | query.setFields(fields); |
| 108 | } |
| 109 | |
| 110 | Result<String, WebPage> results = store.execute(query); |
| 111 | while (results.next()) { |
| 112 | try { |
| 113 | WebPage page = results.get(); |
| 114 | String url = results.getKey(); |
| 115 | |
| 116 | if (page == null) |
| 117 | continue; |
| 118 | |
| 119 | if (requiredMark != null && requiredMark.checkMark(page) == null) |
| 120 | continue; |
| 121 | |
| 122 | l.add(new URLWebPage(TableUtil.unreverseUrl(url), WebPage.newBuilder( |
| 123 | page).build())); |
| 124 | } catch (Exception e) { |
| 125 | e.printStackTrace(); |
| 126 | } |
| 127 | } |
| 128 | return l; |
| 129 | } |
| 130 | |
| 131 | /** |
| 132 | * Creates a new JettyServer with one static root context |
no test coverage detected