From 3dea10cf0d0fa9042930ef387cdc7e8ff3e6ed71 Mon Sep 17 00:00:00 2001 From: rk Date: Sun, 17 Feb 2002 23:53:22 +0000 Subject: [PATCH] Module Breaking / Producer Startpage cleanup --- source/mir/storage/Database.java | 20 ++++------------- source/mircoders/module/ModuleBreaking.java | 3 +-- source/mircoders/producer/ProducerStartPage.java | 28 ++++++------------------ 3 files changed, 12 insertions(+), 39 deletions(-) diff --git a/source/mir/storage/Database.java b/source/mir/storage/Database.java index 5c40ac21..1c6d2a27 100755 --- a/source/mir/storage/Database.java +++ b/source/mir/storage/Database.java @@ -406,6 +406,10 @@ public class Database implements StorageObject { // build sql-statement + + /** @todo count sql string should only be assembled if we really count + * see below at the end of method //rk */ + if (wc != null && wc.length() == 0) { wc = null; } @@ -434,22 +438,6 @@ public class Database implements StorageObject { try { con = getPooledCon(); stmt = con.createStatement(); - // counting rows - - /** @todo select count(*) should be optimized: - * 1. it should take place after select statement because in some - * cases it is not necessary anymore. - * 2. it is only needed if entitylist needs information about how - * many datasets there are overall - * - * optimization: - * - * if we manage to have the full information about allData already - * with the select statement, then we set it in entitylist, other - * wise we fetch it. /rk - * */ - - // hier select rs = executeSql(stmt, selectSql.toString()); diff --git a/source/mircoders/module/ModuleBreaking.java b/source/mircoders/module/ModuleBreaking.java index bec0c2f5..4ae817c5 100755 --- a/source/mircoders/module/ModuleBreaking.java +++ b/source/mircoders/module/ModuleBreaking.java @@ -43,8 +43,7 @@ public class ModuleBreaking extends AbstractModule public EntityList getBreakingNews() { EntityList returnList = null; try { - EntityList entityList = getByWhereClause(null,"webdb_create desc",0,5); - returnList = entityList; + returnList = getByWhereClause(null,"webdb_create desc",0,5); } catch (Exception ex) { theLog.printWarning("--getBreakingNews(): could not fetch Breaking News" + ex.toString()); diff --git a/source/mircoders/producer/ProducerStartPage.java b/source/mircoders/producer/ProducerStartPage.java index 4f9b9fd1..329b0ceb 100755 --- a/source/mircoders/producer/ProducerStartPage.java +++ b/source/mircoders/producer/ProducerStartPage.java @@ -35,42 +35,28 @@ public class ProducerStartPage extends Producer { public void handle(PrintWriter htmlout, EntityUsers user, boolean force,boolean sync) throws StorageObjectException, ModuleException { + long startTime = System.currentTimeMillis(); printHTML(htmlout, "Producer.StartPage: started"); - long sessionConnectTime = 0; - long startTime = (new java.util.Date()).getTime(); - String nowWebdbDate = StringUtil.date2webdbDate(new GregorianCalendar()); - EntityList entityList; - - // get the newswire - entityList = contentModule.getNewsWire(0,newsPerPage); - SimpleList newsWireList = HTMLTemplateProcessor.makeSimpleList(entityList); - // get the startarticle - entityList = contentModule.getStartArticle(); - SimpleList startItemList = HTMLTemplateProcessor.makeSimpleList(entityList); - // get the features - entityList = contentModule.getFeatures(0,itemsPerPage); - SimpleList featureList = HTMLTemplateProcessor.makeSimpleList(entityList); - SimpleHash startPageModel = new SimpleHash(); // breaking news ModuleBreaking breakingModule = new ModuleBreaking(DatabaseBreaking.getInstance()); startPageModel.put("breakingnews", breakingModule.getBreakingNews()); - startPageModel.put("topics", topicsModule.getTopicsList()); - startPageModel.put("newswire", newsWireList); - startPageModel.put("startspecial", startItemList); - startPageModel.put("features", featureList); + startPageModel.put("newswire", contentModule.getNewsWire(0,newsPerPage)); + startPageModel.put("startspecial", contentModule.getStartArticle()); + startPageModel.put("features", contentModule.getFeatures(0,itemsPerPage)); produce(startPageTemplate, producerDocRoot + "/index.shtml", startPageModel, htmlout); // Finish - sessionConnectTime = new java.util.Date().getTime() - startTime; - logHTML(htmlout, "Producer.Startpage finished: " + sessionConnectTime + " ms."); + logHTML(htmlout, "Producer.Startpage finished: " + ( + System.currentTimeMillis() - startTime) + " ms."); if(sync==true){ Helper.rsync(); logHTML(htmlout, "Producer.Startpage: rsync done"); } + /** @todo we should have a link back to startpage here */ } } -- 2.11.0