producerContent debugging / pageCount inserted
authorrk <rk>
Sun, 17 Feb 2002 22:03:16 +0000 (22:03 +0000)
committerrk <rk>
Sun, 17 Feb 2002 22:03:16 +0000 (22:03 +0000)
source/mircoders/entity/EntityContent.java
source/mircoders/producer/ProducerContent.java

index 47b7ef9..958f697 100755 (executable)
@@ -354,17 +354,16 @@ public class EntityContent extends Entity
     return DatabaseContentToMedia.getInstance().getAudio(this) ;
   }
 
-  private SimpleList getVideoForContent()
+  private EntityList getVideoForContent()
     throws StorageObjectException, TemplateModelException
   {
     return DatabaseContentToMedia.getInstance().getVideo(this) ;
   }
 
-  private SimpleList getOtherMediaForContent()
+  private EntityList getOtherMediaForContent()
     throws StorageObjectException, TemplateModelException
   {
-    return HTMLTemplateProcessor.makeSimpleList(
-             DatabaseContentToMedia.getInstance().getOther(this) );
+    return DatabaseContentToMedia.getInstance().getOther(this);
   }
 
 }
index 290bd15..8e8ace1 100755 (executable)
@@ -57,7 +57,7 @@ public class ProducerContent extends Producer {
   {
 
     long                startTime = System.currentTimeMillis();
-
+    int                 pageCount=0;
 
     String              whereClause = " ";
     String              orderBy = " ";
@@ -88,37 +88,38 @@ public class ProducerContent extends Producer {
                                                 -1, userEntity);
     }
 
-    for(int i=0;i<batchEntityList.size();i++) {
-      currentContent = (EntityContent)batchEntityList.elementAt(i);
-
-      try {
-
-        SimpleHash mergeData=new SimpleHash();
-        mergeData.put("content", currentContent);
-        String date = currentContent.getValue("date");
-        String year = date.substring(0,4);
-        String month = date.substring(4,6);
-        htmlFileName =  producerDocRoot + "/" + year + "/" + month + "/" +
-                        currentContent.getValue("id") + ".shtml";
-
-        //produce html
-        boolean retVal = produce(contentTemplate, htmlFileName, mergeData, htmlout);
-        if ( retVal ) currentContent.setProduced(true);
-
-      }
-      catch(Exception e)
-      {
-        String errorText = "Producer.Content ERROR while producing content ID:"
-                  + currentContent.getId()+", skipping it :: "+e.toString();
-        logHTML(htmlout, errorText);
-        theLog.printError(errorText);
-      }
-
-    }//for
-
+    if (batchEntityList!=null) {
+      for(int i=0;i<batchEntityList.size();i++) {
+        currentContent = (EntityContent)batchEntityList.elementAt(i);
+
+        try {
+
+          SimpleHash mergeData=new SimpleHash();
+          mergeData.put("content", currentContent);
+          String date = currentContent.getValue("date");
+          String year = date.substring(0,4);
+          String month = date.substring(4,6);
+          htmlFileName =  producerDocRoot + "/" + year + "/" + month + "/" +
+                          currentContent.getValue("id") + ".shtml";
+
+          //produce html
+          boolean retVal = produce(contentTemplate, htmlFileName, mergeData, htmlout);
+          if ( retVal ) currentContent.setProduced(true);
+
+        }
+        catch(Exception e)
+        {
+          String errorText = "Producer.Content ERROR while producing content ID:"
+                    + currentContent.getId()+", skipping it :: "+e.toString();
+          logHTML(htmlout, errorText);
+          theLog.printError(errorText);
+        }
+        pageCount++;
+      }//for
+    }
     // timing and message to browser
-    logHTML(htmlout, "Producer.Content finished: " +
-            (System.currentTimeMillis() - startTime) + " ms.");
+    logHTML(htmlout, "Producer.Content finished producing " +
+            (System.currentTimeMillis() - startTime) + " ms. ("+ pageCount+")");
 
     /** @todo here we should have a link back to admin logged */
     /** @todo why no syncing here? */