lots of comments on restructuring
authorrk <rk>
Mon, 4 Feb 2002 21:27:26 +0000 (21:27 +0000)
committerrk <rk>
Mon, 4 Feb 2002 21:27:26 +0000 (21:27 +0000)
source/mircoders/producer/ProducerStartPage.java

index 8030959..c8d7ca1 100755 (executable)
@@ -83,23 +83,27 @@ public class ProducerStartPage extends Producer {
     SimpleHash contentHash;
 
     // get the topiclist
+    /** @todo should be fetched via ModuleTopics in one rush / no sql!
+     *  something like topicsModule.getTopicsList returning the SimpleList */
     entityList = topicsModule.getByWhereClause("","title",-1);
     SimpleList topicList = HTMLTemplateProcessor.makeSimpleList(entityList);
 
     // get the imclinks
+    /** @todo don't we want to preproduce and include the imcs? */
     entityList = linksImcsModule.getByWhereClause("", "sortpriority, title", -1);
     SimpleList imcList = HTMLTemplateProcessor.makeSimpleList(entityList);
-
     EntityList theParentList = linksImcsModule.getByWhereClause("to_parent_id=NULL", "sortpriority, title", -1);
     SimpleList parentList = HTMLTemplateProcessor.makeSimpleList(theParentList);
 
     // get the newswire
+    /** @todo same with newswire, should be fetched via moduleContent.getNewswire() */
     whereClause="is_published=true AND to_article_type = 1";
     entityList = contentModule.getContent(whereClause,"date desc, webdb_create desc",0,newsPerPage);
     SimpleList newsWireList = HTMLTemplateProcessor.makeSimpleList(entityList);
     for (int i=0; i < entityList.size();i++) {
       currentContent = (EntityContent)entityList.elementAt(i);
       try {
+          /** @todo all this should be done inside EntityContent and on demand */
           //fetching/setting the images
           upMediaEntityList = DatabaseContentToMedia.getInstance().getUploadedMedia(currentContent);
           if (upMediaEntityList!=null && upMediaEntityList.getCount()>=1) {
@@ -157,6 +161,7 @@ public class ProducerStartPage extends Producer {
     theLog.printDebugInfo("############### got newswire");
 
     // get the startarticle and the related images
+    /** @todo this should move to moduleContent.getStartArticle */
     whereClause="is_published=true AND to_article_type=4";
     entityList = contentModule.getContent(whereClause,"date desc, webdb_create desc",0,1);
     //if no startspecial exists
@@ -171,6 +176,7 @@ public class ProducerStartPage extends Producer {
           //media to content
           currentMediaList = DatabaseContentToMedia.getInstance().getUploadedMedia(currentContent);
           contentHash = (SimpleHash)startItemList.get(k);
+          /** @todo this should move to Entity */
                                        if (currentMediaList!=null && currentMediaList.getCount()>=1) {
             SimpleList mediaListAudio = new SimpleList();
             SimpleList mediaListImages = new SimpleList();
@@ -235,6 +241,7 @@ public class ProducerStartPage extends Producer {
     theLog.printDebugInfo("############### got breaking");
 
     // get the articles
+    /** @todo moduleContent.getArticles() */
     whereClause="is_published=true AND to_article_type=2";
     orderBy="date desc, webdb_create desc";
     entityList = contentModule.getContent(whereClause, orderBy, 0, itemsPerPage);
@@ -244,7 +251,9 @@ public class ProducerStartPage extends Producer {
       try {
           //media to content
           currentMediaList = DatabaseContentToMedia.getInstance().getUploadedMedia(currentContent);
+          theLog.printDebugInfo("############### getting contenthash");
           contentHash = (SimpleHash)featureList.get(k);
+          theLog.printDebugInfo("############### building media lists");
                                        if (currentMediaList!=null && currentMediaList.getCount()>=1) {
             SimpleList mediaListAudio = new SimpleList();
             SimpleList mediaListImages = new SimpleList();
@@ -266,6 +275,7 @@ public class ProducerStartPage extends Producer {
                 //we most likely need further info
                 upMedia = mediaStorage.selectById(upMedia.getId());
                 upMediaSimpleHash.put("url", mediaHandler.getListView(upMedia, mediaType));
+                /** @todo String comparison here should never work .equals()  !!!! */
                 if (upMedia.getValue("is_published") == "1") {
                   if (mediaHandler.isImage()) {
                     mediaListImages.add(upMediaSimpleHash);
@@ -286,13 +296,13 @@ public class ProducerStartPage extends Producer {
           } //end if currentMediaList != null
 
                                        //convert to html
+          theLog.printDebugInfo("############### html conversion");
                                        if ( ((SimpleScalar)contentHash.get("is_html")).getAsString().equals("0") ) {
                                                SimpleScalar tempScalar = (SimpleScalar)contentHash.get("description");
                                                String temp = StringUtil.createHTML(tempScalar.getAsString(),imageRoot,mailLinkName,extLinkName,intLinkName);
                                                temp = StringUtil.decodeHTMLinTags(temp);
                                                contentHash.put("description",temp);
                                        }
-
                        } catch (Exception e) {
         logHTML(htmlout, "Producer.StartPage error id: " + currentContent.getId() + ", skipping");
         theLog.printError("Producer.StartPage error id: " + currentContent.getId() + ", skipping"+e.toString());
@@ -300,7 +310,10 @@ public class ProducerStartPage extends Producer {
     } //enf for featurueList.size..
     theLog.printDebugInfo("############### got featurelist");
 
-    // Zusaetzlich Informationen
+    /** @todo the following should be the only thing left done here. a lot of redundancies are gone then,
+     *  code is more readable, and caching stuff, mass changes, etc. can be done in one spot */
+
+    // Additional Information
     startPageModel = new SimpleHash();
     startPageModel.put("breakingnews", breakingList);
     startPageModel.put("topics", topicList);