bufix media
[mir.git] / source / mircoders / producer / PDFPreFormattingProducerNode.java
index 86ad9a9..50e69bf 100755 (executable)
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  * In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with  any library licensed under the Apache Software License, 
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library 
- * (or with modified versions of the above that use the same license as the above), 
- * and distribute linked combinations including the two.  You must obey the 
- * GNU General Public License in all respects for all of the code used other than 
- * the above mentioned libraries.  If you modify this file, you may extend this 
- * exception to your version of the file, but you are not obligated to do so.  
+ * the code of this program with  any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two.  You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries.  If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
  * If you do not wish to do so, delete this exception statement from your version.
  */
 
@@ -33,10 +33,12 @@ package mircoders.producer;
 import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.Map;
+import java.util.Vector;
 
 import mir.entity.Entity;
-import mir.entity.EntityList;
+import mir.entity.EntityBrowser;
 import mir.entity.adapter.EntityAdapter;
 import mir.log.LoggerToWriterAdapter;
 import mir.log.LoggerWrapper;
@@ -48,10 +50,7 @@ import mir.util.HTMLRoutines;
 import mir.util.ParameterExpander;
 import mircoders.entity.EntityContent;
 import mircoders.entity.EntityImages;
-import mircoders.storage.DatabaseContentToMedia;
-
-//because images are returned as a template model!(maybe not needed after all!)
-//import freemarker.template.*;
+import mircoders.storage.DatabaseImages;
 
 
 public class PDFPreFormattingProducerNode implements ProducerNode {
@@ -106,7 +105,13 @@ public class PDFPreFormattingProducerNode implements ProducerNode {
       ArrayList brokenUpContent = new ArrayList();
 
 
-      EntityList images=DatabaseContentToMedia.getInstance().getImages((EntityContent)entity);
+      Vector extraTables = new Vector();
+      extraTables.add("content_x_media cxm");
+      Iterator images = new EntityBrowser(
+        DatabaseImages.getInstance(), "i", extraTables,
+          "cxm.content_id="+entity.getId()+"and cxm.media_id=i.id",
+          "i.id desc", 30, -1, 0);
+
       String theContent = ((EntityContent) entity).getValue("content_data");
       //remove pesky characters
       theContent = HTMLRoutines.encodeXML(theContent);