if (sb.peers != null) {
final int maxCount = Math.min(1000, sb.peers.newsPool.size(tableID));
final Iterator<NewsDB.Record> recordIterator = sb.peers.newsPool.recordIterator(tableID, false);
NewsDB.Record record;
Seed seed;
int i = 0;
while ((recordIterator.hasNext()) && (i < maxCount)) {
record = recordIterator.next();
if (record == null) continue;
seed = sb.peers.getConnected(record.originator());
if (seed == null) seed = sb.peers.getDisconnected(record.originator());
final String category = record.category();
prop.put("table_list_" + i + "_id", record.id());
prop.putHTML("table_list_" + i + "_ori", (seed == null) ? record.originator() : seed.getName());
prop.put("table_list_" + i + "_cre", GenericFormatter.SHORT_SECOND_FORMATTER.format(record.created()));
prop.put("table_list_" + i + "_crerfcdate", HeaderFramework.formatRFC1123(record.created()));
prop.putHTML("table_list_" + i + "_cat", category);
prop.put("table_list_" + i + "_rec", (record.received() == null) ? "-" : GenericFormatter.SHORT_SECOND_FORMATTER.format(record.received()));
prop.put("table_list_" + i + "_dis", record.distributed());
final Map<String, String> attributeMap = record.attributes();
prop.putHTML("table_list_" + i + "_att", attributeMap.toString());
int j = 0;
if (!attributeMap.isEmpty()) {
for (final Entry<String, String> attribute: attributeMap.entrySet()) {
prop.put("table_list_" + i + "_attributes_" + j + "_name", attribute.getKey());
prop.putHTML("table_list_" + i + "_attributes_" + j + "_value", attribute.getValue());
j++;
}
}
prop.put("table_list_" + i + "_attributes", j);
// generating link / title / description (taken over from Surftips.java)
String link, title, description;
if (category.equals(NewsPool.CATEGORY_CRAWL_START)) {
link = record.attribute("startURL", "");
title = (record.attribute("intention", "").isEmpty()) ? link : record.attribute("intention", "");
description = "Crawl Start Point";
} else if (category.equals(NewsPool.CATEGORY_PROFILE_UPDATE)) {
link = record.attribute("homepage", "");
title = "Home Page of " + record.attribute("nickname", "");
description = "Profile Update";
} else if (category.equals(NewsPool.CATEGORY_BOOKMARK_ADD)) {
link = record.attribute("url", "");
title = record.attribute("title", "");
description = "Bookmark: " + record.attribute("description", "");
} else if (category.equals(NewsPool.CATEGORY_SURFTIPP_ADD)) {
link = record.attribute("url", "");
title = record.attribute("title", "");
description = "Surf Tipp: " + record.attribute("description", "");
} else if (category.equals(NewsPool.CATEGORY_SURFTIPP_VOTE_ADD)) {
link = record.attribute("url", "");
title = record.attribute("title", "");
description = record.attribute("url", "");
} else if (category.equals(NewsPool.CATEGORY_WIKI_UPDATE)) {
link = (seed == null)? "" : "http://" + seed.getPublicAddress() + "/Wiki.html?page=" + record.attribute("page", "");
title = record.attribute("author", "Anonymous") + ": " + record.attribute("page", "");
description = "Wiki Update: " + record.attribute("description", "");
} else if (category.equals(NewsPool.CATEGORY_BLOG_ADD)) {
link = (seed == null)? "" : "http://" + seed.getPublicAddress() + "/Blog.html?page=" + record.attribute("page", "");
title = record.attribute("author", "Anonymous") + ": " + record.attribute("page", "");
description = "Blog Entry: " + record.attribute("subject", "");
} else {
link = "";
title = "";