X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=source%2Fmircoders%2Fproducer%2FPDFPreFormattingProducerNode.java;h=50e69bf27037a145c8e4b764dac0ad0b88d81571;hb=4451d4c8c25d46e9c405e966ff6bd016a1512f4f;hp=84e7e62c9bd8dc44262c009643b873b5a82b0900;hpb=4943e2fa10f39dfec27f22fe2ab4be59586d8e9d;p=mir.git diff --git a/source/mircoders/producer/PDFPreFormattingProducerNode.java b/source/mircoders/producer/PDFPreFormattingProducerNode.java index 84e7e62c..50e69bf2 100755 --- a/source/mircoders/producer/PDFPreFormattingProducerNode.java +++ b/source/mircoders/producer/PDFPreFormattingProducerNode.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,36 +18,39 @@ * 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 the com.oreilly.servlet library, 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. + * 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. */ package mircoders.producer; -import java.util.*; -import java.io.*; - -import mir.util.*; -import mir.producer.*; -import mir.entity.*; -import mir.entity.adapter.*; -import mir.log.*; +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.EntityBrowser; +import mir.entity.adapter.EntityAdapter; +import mir.log.LoggerToWriterAdapter; +import mir.log.LoggerWrapper; import mir.misc.StringUtil; +import mir.producer.ProducerFailure; +import mir.producer.ProducerNode; +import mir.util.CachingRewindableIterator; import mir.util.HTMLRoutines; - - -import mircoders.entity.*; -import mircoders.storage.*; - -//because images are returned as a template model!(maybe not needed after all!) -//import freemarker.template.*; +import mir.util.ParameterExpander; +import mircoders.entity.EntityContent; +import mircoders.entity.EntityImages; +import mircoders.storage.DatabaseImages; public class PDFPreFormattingProducerNode implements ProducerNode { @@ -102,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); @@ -110,14 +119,14 @@ public class PDFPreFormattingProducerNode implements ProducerNode { theContent = StringUtil.convertNewline2Break(theContent); if (images == null){ - HashMap row = new HashMap(); + Map row = new HashMap(); row.put("text",theContent); row.put("hasImage","0"); brokenUpContent.add(row); } if (images != null){ //need to add checks for out of content! - HashMap row0 = new HashMap(); + Map row0 = new HashMap(); if (numCharsInAnImagelessRow>(theContent).length()){ row0.put("text",theContent); outOfText = true; @@ -132,8 +141,8 @@ public class PDFPreFormattingProducerNode implements ProducerNode { brokenUpContent.add(row0); aLogger.debug("CP1 is "+ currentPosition); while(images.hasNext()){ - HashMap row1 = new HashMap(); - HashMap row2 = new HashMap(); + Map row1 = new HashMap(); + Map row2 = new HashMap(); EntityImages currentImage=(EntityImages) images.next(); float img_width=(new Float(currentImage.getValue("img_width"))).floatValue(); float img_height=(new Float(currentImage.getValue("img_height"))).floatValue(); @@ -193,7 +202,7 @@ public class PDFPreFormattingProducerNode implements ProducerNode { aLogger.debug("CP3 is "+ currentPosition); } - HashMap row3 = new HashMap(); + Map row3 = new HashMap(); if (! outOfText){ row3.put("text",theContent.substring(currentPosition)); row3.put("hasImage","0");