Module Breaking / Producer Startpage cleanup
authorrk <rk>
Sun, 17 Feb 2002 23:53:22 +0000 (23:53 +0000)
committerrk <rk>
Sun, 17 Feb 2002 23:53:22 +0000 (23:53 +0000)
source/mir/storage/Database.java
source/mircoders/module/ModuleBreaking.java
source/mircoders/producer/ProducerStartPage.java

index 5c40ac2..1c6d2a2 100755 (executable)
@@ -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());
index bec0c2f..4ae817c 100755 (executable)
@@ -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());
index 4f9b9fd..329b0ce 100755 (executable)
@@ -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 */
   }
 }