svn commit: r757086 [3/4] - in /ofbiz/trunk/applications/content/src: ./ org/ofbiz/content/ org/ofbiz/content/blog/ org/ofbiz/content/cms/ org/ofbiz/content/compdoc/ org/ofbiz/content/content/ org/ofbiz/content/data/ org/ofbiz/content/layout/ org/ofbiz...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r757086 [3/4] - in /ofbiz/trunk/applications/content/src: ./ org/ofbiz/content/ org/ofbiz/content/blog/ org/ofbiz/content/cms/ org/ofbiz/content/compdoc/ org/ofbiz/content/content/ org/ofbiz/content/data/ org/ofbiz/content/layout/ org/ofbiz...

doogie-3
Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/openoffice/OpenOfficeByteArrayInputStream.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/openoffice/OpenOfficeByteArrayInputStream.java?rev=757086&r1=757085&r2=757086&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/openoffice/OpenOfficeByteArrayInputStream.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/openoffice/OpenOfficeByteArrayInputStream.java Sat Mar 21 23:43:51 2009
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- *
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -31,44 +31,44 @@
  */
 
 public class OpenOfficeByteArrayInputStream extends ByteArrayInputStream implements XInputStream, XSeekable {
-    
+
     public static final String module = OpenOfficeByteArrayInputStream.class.getName();
-    
+
     public OpenOfficeByteArrayInputStream(byte [] bytes) {
         super(bytes);
     }
-    
-    
+
+
     public long getPosition() throws com.sun.star.io.IOException {
         return this.pos;
     }
-    
+
     public long getLength() throws com.sun.star.io.IOException {
         return this.count;
     }
-    
+
     public void seek(long pos1) throws com.sun.star.io.IOException, IllegalArgumentException {
         this.pos = (int)pos1;
     }
 
-    public void skipBytes(int pos1) throws BufferSizeExceededException,
+    public void skipBytes(int pos1) throws BufferSizeExceededException,
                                              NotConnectedException, com.sun.star.io.IOException {
         skip(pos1);
     }
 
     public void closeInput() throws NotConnectedException, com.sun.star.io.IOException {
-        
+
         try {
             close();
         } catch ( IOException e) {
             String errMsg = e.getMessage();
             throw new com.sun.star.io.IOException( errMsg, this );
         }
-        
+
     }
-    
+
     public int readBytes(byte [][]buf, int pos2) throws BufferSizeExceededException, NotConnectedException, com.sun.star.io.IOException {
-        
+
         int bytesRead = 0;
         byte [] buf2 = new byte[pos2];
         try {
@@ -77,7 +77,7 @@
             String errMsg = e.getMessage();
             throw new com.sun.star.io.IOException( errMsg, this );
         }
-        
+
         if (bytesRead > 0) {
             if (bytesRead < pos2) {
                 byte [] buf3 = new byte[bytesRead];

Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/openoffice/OpenOfficeByteArrayOutputStream.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/openoffice/OpenOfficeByteArrayOutputStream.java?rev=757086&r1=757085&r2=757086&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/openoffice/OpenOfficeByteArrayOutputStream.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/openoffice/OpenOfficeByteArrayOutputStream.java Sat Mar 21 23:43:51 2009
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- *
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -33,7 +33,7 @@
 public class OpenOfficeByteArrayOutputStream extends ByteArrayOutputStream implements XOutputStream {
 
     public static final String module = OpenOfficeByteArrayOutputStream.class.getName();
-    
+
     public OpenOfficeByteArrayOutputStream() {
         super();
         // TODO Auto-generated constructor stub
@@ -63,7 +63,7 @@
               throw(new com.sun.star.io.IOException(e.getMessage()));
           }
       }
-      
+
       public void flush()
       {
           try {

Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/openoffice/OpenOfficeServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/openoffice/OpenOfficeServices.java?rev=757086&r1=757085&r2=757086&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/openoffice/OpenOfficeServices.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/openoffice/OpenOfficeServices.java Sat Mar 21 23:43:51 2009
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- *
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -66,7 +66,7 @@
      * and "/" for Linux/Unix.
      */
     public static Map<String, Object> convertDocumentByteBuffer(DispatchContext dctx, Map<String, ? extends Object> context) {
-        
+
         Map results = ServiceUtil.returnSuccess();
         GenericDelegator delegator = dctx.getDelegator();
         XMultiComponentFactory xmulticomponentfactory = null;
@@ -78,7 +78,7 @@
         String fileOutName = "OOOUT_" + uniqueSeqNum;
         File fileIn = null;
         File fileOut = null;
-        
+
         ByteBuffer inByteBuffer = (ByteBuffer) context.get("inByteBuffer");
         String inputMimeType = (String) context.get("inputMimeType");
         String outputMimeType = (String) context.get("outputMimeType");
@@ -88,17 +88,17 @@
         // if these are empty don't worry, the OpenOfficeWorker down below will take care of it
         String oooHost = (String) context.get("oooHost");
         String oooPort = (String) context.get("oooPort");
-        
-        try {  
+
+        try {
             xmulticomponentfactory = OpenOfficeWorker.getRemoteServer(oooHost, oooPort);
             byte[] inByteArray = inByteBuffer.getBytes();
-            
+
             // The following line work in linux, but not Windows or Mac environment. It is preferred because it does not use temporary files
             //OpenOfficeByteArrayInputStream oobais = new OpenOfficeByteArrayInputStream(inByteArray);
             //Debug.logInfo("Doing convertDocumentByteBuffer, inBytes size is [" + inByteArray.length + "]", module);
              //OpenOfficeByteArrayOutputStream baos = OpenOfficeWorker.convertOODocByteStreamToByteStream(xmulticomponentfactory, oobais, inputMimeType, outputMimeType);
-            
-            
+
+
             String tempDir = UtilProperties.getPropertyValue("content", "content.temp.dir");
             fileIn = new File(tempDir + fileInName);
             FileOutputStream fos = new FileOutputStream(fileIn);
@@ -114,7 +114,7 @@
                 baos.write(c);
             }
             fis.close();
-            
+
             results.put("outByteBuffer", new ByteBuffer(baos.toByteArray()));
             baos.close();
 
@@ -142,7 +142,7 @@
      */
     public static Map<String, Object> convertDocument(DispatchContext dctx, Map<String, ? extends Object> context) {
         XMultiComponentFactory xmulticomponentfactory = null;
-        
+
         String stringUrl = "file:///" + context.get("filenameFrom");
         String stringConvertedFile = "file:///" + context.get("filenameTo");
         String filterName = "file:///" + context.get("filterName");
@@ -150,11 +150,11 @@
         // if these are empty don't worry, the OpenOfficeWorker down below will take care of it
         String oooHost = (String) context.get("oooHost");
         String oooPort = (String) context.get("oooPort");
-        
-        try {    
+
+        try {
             xmulticomponentfactory = OpenOfficeWorker.getRemoteServer(oooHost, oooPort);
             OpenOfficeWorker.convertOODocToFile(xmulticomponentfactory, stringUrl, stringConvertedFile, filterName);
-            
+
             Map results = ServiceUtil.returnSuccess();
             return results;
         } catch (IOException e) {
@@ -171,7 +171,7 @@
      */
     public static Map<String, Object> convertDocumentFileToFile(DispatchContext dctx, Map<String, ? extends Object> context) {
         XMultiComponentFactory xmulticomponentfactory = null;
-        
+
         String stringUrl = (String) context.get("filenameFrom");
         String stringConvertedFile = (String) context.get("filenameTo");
         String inputMimeType = (String) context.get("inputMimeType");
@@ -180,8 +180,8 @@
         // if these are empty don't worry, the OpenOfficeWorker down below will take care of it
         String oooHost = (String) context.get("oooHost");
         String oooPort = (String) context.get("oooPort");
-        
-        try {    
+
+        try {
             xmulticomponentfactory = OpenOfficeWorker.getRemoteServer(oooHost, oooPort);
             File inputFile = new File(stringUrl);
             long fileSize = inputFile.length();
@@ -199,7 +199,7 @@
             fis.close();
             oobais.close();
             oobaos.close();
-            
+
             Map results = ServiceUtil.returnSuccess();
             return results;
         } catch (IOException e) {
@@ -216,7 +216,7 @@
      */
     public static Map<String, Object> convertDocumentStreamToStream(DispatchContext dctx, Map<String, ? extends Object> context) {
         XMultiComponentFactory xmulticomponentfactory = null;
-        
+
         String stringUrl = "file:///" + context.get("filenameFrom");
         String stringConvertedFile = "file:///" + context.get("filenameTo");
         String inputMimeType = (String) context.get("inputMimeType");
@@ -225,8 +225,8 @@
         // if these are empty don't worry, the OpenOfficeWorker down below will take care of it
         String oooHost = (String) context.get("oooHost");
         String oooPort = (String) context.get("oooPort");
-        
-        try {    
+
+        try {
             xmulticomponentfactory = OpenOfficeWorker.getRemoteServer(oooHost, oooPort);
             File inputFile = new File(stringUrl);
             long fileSize = inputFile.length();
@@ -244,7 +244,7 @@
             fis.close();
             oobais.close();
             oobaos.close();
-            
+
             Map results = ServiceUtil.returnSuccess();
             return results;
         } catch (IOException e) {
@@ -261,7 +261,7 @@
      */
     public static Map<String, Object> compareDocuments(DispatchContext dctx, Map<String, ? extends Object> context) {
         XMultiComponentFactory xmulticomponentfactory = null;
-        
+
         String stringUrl = "file:///" + context.get("filenameFrom");
         String stringOriginalFile = "file:///" + context.get("filenameOriginal");
         String stringOutFile = "file:///" + context.get("filenameOut");
@@ -269,8 +269,8 @@
         // if these are empty don't worry, the OpenOfficeWorker down below will take care of it
         String oooHost = (String)context.get("oooHost");
         String oooPort = (String)context.get("oooPort");
-        
-        try {    
+
+        try {
             xmulticomponentfactory = OpenOfficeWorker.getRemoteServer(oooHost, oooPort);
         } catch (IOException e) {
             Debug.logError(e, "Error in OpenOffice operation: ", module);
@@ -280,31 +280,31 @@
             return ServiceUtil.returnError(e.toString());
         }
         //System.out.println("xmulticomponentfactory: " + xmulticomponentfactory);
-      
+
         // Converting the document to the favoured type
         try {
             // Composing the URL
-            
-            
+
+
             // Query for the XPropertySet interface.
             XPropertySet xpropertysetMultiComponentFactory = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xmulticomponentfactory);
-            
+
             // Get the default context from the office server.
             Object objectDefaultContext = xpropertysetMultiComponentFactory.getPropertyValue("DefaultContext");
-            
+
             // Query for the interface XComponentContext.
             XComponentContext xcomponentcontext = (XComponentContext) UnoRuntime.queryInterface(XComponentContext.class, objectDefaultContext);
-            
+
             /* A desktop environment contains tasks with one or more
                frames in which components can be loaded. Desktop is the
                environment for components which can instanciate within
                frames. */
-            
+
             Object desktopObj = xmulticomponentfactory.createInstanceWithContext("com.sun.star.frame.Desktop", xcomponentcontext);
             XDesktop desktop = (XDesktop) UnoRuntime.queryInterface(XDesktop.class, desktopObj);
             XComponentLoader xcomponentloader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, desktopObj);
-          
-            
+
+
             // Preparing properties for loading the document
             PropertyValue propertyvalue[] = new PropertyValue[ 1 ];
             // Setting the flag for hidding the open document
@@ -315,13 +315,13 @@
             //propertyvalue[ 1 ] = new PropertyValue();
             //propertyvalue[ 1 ].Name = "FilterName";
             //propertyvalue[ 1 ].Value = "HTML (StarWriter)";
-            
+
             // Loading the wanted document
             Object objectDocumentToStore = xcomponentloader.loadComponentFromURL(stringUrl, "_blank", 0, propertyvalue);
-            
+
             // Getting an object that will offer a simple way to store a document to a URL.
             XStorable xstorable = (XStorable) UnoRuntime.queryInterface(XStorable.class, objectDocumentToStore);
-            
+
             // Preparing properties for comparing the document
             propertyvalue = new PropertyValue[ 1 ];
             // Setting the flag for overwriting
@@ -337,8 +337,8 @@
             Object dispatchHelperObj = xmulticomponentfactory.createInstanceWithContext("com.sun.star.frame.DispatchHelper", xcomponentcontext);
             XDispatchHelper dispatchHelper = (XDispatchHelper) UnoRuntime.queryInterface(XDispatchHelper.class, dispatchHelperObj);
             XDispatchProvider dispatchProvider = (XDispatchProvider) UnoRuntime.queryInterface(XDispatchProvider.class, frame);
-            dispatchHelper.executeDispatch(dispatchProvider, ".uno:CompareDocuments", "", 0, propertyvalue);      
-            
+            dispatchHelper.executeDispatch(dispatchProvider, ".uno:CompareDocuments", "", 0, propertyvalue);
+
             // Preparing properties for storing the document
             propertyvalue = new PropertyValue[ 1 ];
             // Setting the flag for overwriting
@@ -349,18 +349,18 @@
             //propertyvalue[ 1 ] = new PropertyValue();
             //propertyvalue[ 1 ].Name = "FilterName";
             //propertyvalue[ 1 ].Value = context.get("convertFilterName");
-            
+
             Debug.logInfo("stringOutFile: "+stringOutFile, module);
             // Storing and converting the document
             xstorable.storeToURL(stringOutFile, propertyvalue);
-            
+
             // Getting the method dispose() for closing the document
             XComponent xcomponent = (XComponent) UnoRuntime.queryInterface(XComponent.class,
             xstorable);
-            
+
             // Closing the converted document
             xcomponent.dispose();
-            
+
             Map results = ServiceUtil.returnSuccess();
             return results;
         } catch (Exception e) {

Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/openoffice/OpenOfficeWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/openoffice/OpenOfficeWorker.java?rev=757086&r1=757085&r2=757086&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/openoffice/OpenOfficeWorker.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/openoffice/OpenOfficeWorker.java Sat Mar 21 23:43:51 2009
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- *
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -47,22 +47,22 @@
 
 /**
  * OpenOfficeWorker Class
- *
- * Note that for this to work you must start OpenOffice with a command such as the following:
+ *
+ * Note that for this to work you must start OpenOffice with a command such as the following:
  *   <code>soffice -accept=socket,host=localhost,port=8100;urp;</code>
  */
 public class OpenOfficeWorker{
 
     public static final String module = OpenOfficeWorker.class.getName();
-    
+
     /**
      * Use OpenOffice to convert documents between types
      */
     public static XMultiComponentFactory getRemoteServer(String host, String port) throws IOException, Exception {
-        
+
         if (UtilValidate.isEmpty(host)) host = UtilProperties.getPropertyValue("openoffice-uno", "oo.host", "localhost");
         if (UtilValidate.isEmpty(port)) port = UtilProperties.getPropertyValue("openoffice-uno", "oo.port", "8100");
-        
+
         XMultiComponentFactory xmulticomponentfactory = null;
         XComponentContext xcomponentcontext = null;
         Object objectUrlResolver = null;
@@ -74,24 +74,24 @@
             registered. Component context to be granted to a component for running.
             Arbitrary values can be retrieved from the context. */
             xcomponentcontext = com.sun.star.comp.helper.Bootstrap.createInitialComponentContext(null);
-        
+
             /* Gets the service manager instance to be used (or null). This method has
             been added for convenience, because the service manager is a often used
             object. */
             xmulticomponentfactory = xcomponentcontext.getServiceManager();
-        
+
             /* Creates an instance of the component UnoUrlResolver which
             supports the services specified by the factory. */
             objectUrlResolver = xmulticomponentfactory.createInstanceWithContext("com.sun.star.bridge.UnoUrlResolver", xcomponentcontext);
-        
+
             // Create a new url resolver
             xurlresolver = (XUnoUrlResolver) UnoRuntime.queryInterface(XUnoUrlResolver.class, objectUrlResolver);
-        
+
             // Resolves an object that is specified as follow:
             // uno:<connection description>;<protocol description>;<initial object name>
             String url = "uno:socket,host=" + host + ",port=" + port + ";urp;StarOffice.ServiceManager";
             objectInitial = xurlresolver.resolve(url);
-        
+
             // Create a service manager from the initial object
             xmulticomponentfactory = (XMultiComponentFactory) UnoRuntime.queryInterface(XMultiComponentFactory.class, objectInitial);
         } catch (Exception e) {
@@ -112,13 +112,13 @@
             Debug.logError(e, errMsg, module);
             throw new IllegalArgumentException(errMsg);
         }
-        
+
         return xmulticomponentfactory;
     }
 
     public static String listFilterNamesEvent(HttpServletRequest request, HttpServletResponse response) {
         XMultiComponentFactory factory = null;
-        
+
         try {
             factory = getRemoteServer("localhost", "8100");
             List filterList = getFilterNames(factory);
@@ -131,10 +131,10 @@
             return "error";
         }
         return "success";
-    }    
-    
+    }
+
     public static List getFilterNames(XMultiComponentFactory xmulticomponentfactory) throws Exception {
-        XPropertySet xPropertySet = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, xmulticomponentfactory);        
+        XPropertySet xPropertySet = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, xmulticomponentfactory);
         Object oDefaultContext = xPropertySet.getPropertyValue("DefaultContext");
         XComponentContext xComponentContext = (XComponentContext) UnoRuntime.queryInterface(XComponentContext.class, oDefaultContext);
 
@@ -142,7 +142,7 @@
         Object filterFactory = xmulticomponentfactory.createInstanceWithContext("com.sun.star.document.FilterFactory", xComponentContext);
         XNameAccess xNameAccess = (XNameAccess)UnoRuntime.queryInterface(XNameAccess.class, filterFactory);
         String [] filterNames = xNameAccess.getElementNames();
-        
+
         //String [] serviceNames = filterFactory.getAvailableServiceNames();
         for (int i=0; i < filterNames.length; i++) {
             String s = filterNames[i];
@@ -160,28 +160,28 @@
         List filterNameList = UtilMisc.toListArray(filterNames);
         return filterNameList;
     }
-    
+
     public static void convertOODocToFile(XMultiComponentFactory xmulticomponentfactory, String fileInPath, String fileOutPath, String outputMimeType) throws FileNotFoundException, IOException, MalformedURLException, Exception {
         // Converting the document to the favoured type
         // Query for the XPropertySet interface.
         XPropertySet xpropertysetMultiComponentFactory = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xmulticomponentfactory);
-        
+
         // Get the default context from the office server.
         Object objectDefaultContext = xpropertysetMultiComponentFactory.getPropertyValue("DefaultContext");
-        
+
         // Query for the interface XComponentContext.
         XComponentContext xcomponentcontext = (XComponentContext) UnoRuntime.queryInterface(XComponentContext.class, objectDefaultContext);
-        
+
         /* A desktop environment contains tasks with one or more
            frames in which components can be loaded. Desktop is the
            environment for components which can instanciate within
            frames. */
-        
+
         Object desktopObj = xmulticomponentfactory.createInstanceWithContext("com.sun.star.frame.Desktop", xcomponentcontext);
         //XDesktop desktop = (XDesktop) UnoRuntime.queryInterface(XDesktop.class, desktopObj);
         XComponentLoader xcomponentloader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, desktopObj);
-      
-        
+
+
         // Preparing properties for loading the document
         PropertyValue propertyvalue[] = new PropertyValue[ 2 ];
         // Setting the flag for hidding the open document
@@ -197,10 +197,10 @@
         String stringUrl = convertToUrl(fileInPath, xcomponentcontext);
         Debug.logInfo("stringUrl:" + stringUrl, module);
         Object objectDocumentToStore = xcomponentloader.loadComponentFromURL(stringUrl, "_blank", 0, propertyvalue);
-        
-        // Getting an object that will offer a simple way to store a document to a URL.
+
+        // Getting an object that will offer a simple way to store a document to a URL.
         XStorable xstorable = (XStorable) UnoRuntime.queryInterface(XStorable.class, objectDocumentToStore);
-        
+
         // Preparing properties for converting the document
         propertyvalue = new PropertyValue[ 3 ];
         // Setting the flag for overwriting
@@ -210,52 +210,52 @@
         // Setting the filter name
         // Preparing properties for converting the document
         String filterName = getFilterNameFromMimeType(outputMimeType);
-        
+
         propertyvalue[ 1 ] = new PropertyValue();
         propertyvalue[ 1 ].Name = "FilterName";
-        propertyvalue[ 1 ].Value = filterName;  
-        
+        propertyvalue[ 1 ].Value = filterName;
+
         propertyvalue[2] = new PropertyValue();
         propertyvalue[2].Name = "CompressionMode";
         propertyvalue[2].Value = "1";
-        
+
         // Storing and converting the document
         //File newFile = new File(stringConvertedFile);
         //newFile.createNewFile();
-        
+
         String stringConvertedFile = convertToUrl(fileOutPath, xcomponentcontext);
         Debug.logInfo("stringConvertedFile: "+stringConvertedFile, module);
         xstorable.storeToURL(stringConvertedFile, propertyvalue);
-        
+
         // Getting the method dispose() for closing the document
         XComponent xcomponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xstorable);
-        
+
         // Closing the converted document
         xcomponent.dispose();
         return;
     }
-    
-    public static OpenOfficeByteArrayOutputStream convertOODocByteStreamToByteStream(XMultiComponentFactory xmulticomponentfactory,
+
+    public static OpenOfficeByteArrayOutputStream convertOODocByteStreamToByteStream(XMultiComponentFactory xmulticomponentfactory,
             OpenOfficeByteArrayInputStream is, String inputMimeType, String outputMimeType) throws Exception {
-        
+
         // Query for the XPropertySet interface.
         XPropertySet xpropertysetMultiComponentFactory = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xmulticomponentfactory);
-        
+
         // Get the default context from the office server.
         Object objectDefaultContext = xpropertysetMultiComponentFactory.getPropertyValue("DefaultContext");
-        
+
         // Query for the interface XComponentContext.
         XComponentContext xcomponentcontext = (XComponentContext) UnoRuntime.queryInterface(XComponentContext.class, objectDefaultContext);
-        
+
         /* A desktop environment contains tasks with one or more
            frames in which components can be loaded. Desktop is the
            environment for components which can instanciate within
            frames. */
-        
+
         Object desktopObj = xmulticomponentfactory.createInstanceWithContext("com.sun.star.frame.Desktop", xcomponentcontext);
         //XDesktop desktop = (XDesktop) UnoRuntime.queryInterface(XDesktop.class, desktopObj);
         XComponentLoader xcomponentloader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, desktopObj);
-        
+
         // Preparing properties for loading the document
         PropertyValue propertyvalue[] = new PropertyValue[2];
         // Setting the flag for hidding the open document
@@ -266,23 +266,23 @@
         propertyvalue[1] = new PropertyValue();
         propertyvalue[1].Name = "InputStream";
         propertyvalue[1].Value = is;
-        
+
         // Loading the wanted document
         Object objectDocumentToStore = xcomponentloader.loadComponentFromURL("private:stream", "_blank", 0, propertyvalue);
         if (objectDocumentToStore == null) {
             Debug.logError("Could not get objectDocumentToStore object from xcomponentloader.loadComponentFromURL", module);
         }
-        
+
         // Getting an object that will offer a simple way to store a document to a URL.
         XStorable xstorable = (XStorable) UnoRuntime.queryInterface(XStorable.class, objectDocumentToStore);
         if (xstorable == null) {
             Debug.logError("Could not get XStorable object from UnoRuntime.queryInterface", module);
         }
-        
+
         // Preparing properties for converting the document
         String filterName = getFilterNameFromMimeType(outputMimeType);
         propertyvalue = new PropertyValue[4];
-        
+
         propertyvalue[0] = new PropertyValue();
         propertyvalue[0].Name = "OutputStream";
         OpenOfficeByteArrayOutputStream os = new OpenOfficeByteArrayOutputStream();
@@ -299,19 +299,19 @@
         propertyvalue[2] = new PropertyValue();
         propertyvalue[2].Name = "CompressionMode";
         propertyvalue[2].Value = "1";
-        
+
         xstorable.storeToURL("private:stream", propertyvalue);
         //xstorable.storeToURL("file:///home/byersa/testdoc1_file.pdf", propertyvalue);
-        
+
         // Getting the method dispose() for closing the document
         XComponent xcomponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xstorable);
-        
+
         // Closing the converted document
         xcomponent.dispose();
-      
+
         return os;
     }
-    
+
     public static String getFilterNameFromMimeType(String mimeType) {
         String filterName = "";
         if (UtilValidate.isEmpty(mimeType)) {
@@ -328,7 +328,7 @@
         return filterName;
 
     }
-    
+
     public static String getExtensionFromMimeType(String mimeType) {
         String extension = "";
         if (UtilValidate.isEmpty(mimeType)) {
@@ -354,5 +354,5 @@
 
         return returnUrl;
     }
-    
+
 }

Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/output/OutputServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/output/OutputServices.java?rev=757086&r1=757085&r2=757086&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/output/OutputServices.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/output/OutputServices.java Sat Mar 21 23:43:51 2009
@@ -1,259 +1,259 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
- * under the License.
- *******************************************************************************/
-package org.ofbiz.content.output;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-
-import javax.print.Doc;
-import javax.print.DocFlavor;
-import javax.print.DocPrintJob;
-import javax.print.PrintService;
-import javax.print.PrintServiceLookup;
-import javax.print.SimpleDoc;
-import javax.print.attribute.DocAttribute;
-import javax.print.attribute.DocAttributeSet;
-import javax.print.attribute.HashDocAttributeSet;
-import javax.print.attribute.HashPrintRequestAttributeSet;
-import javax.print.attribute.HashPrintServiceAttributeSet;
-import javax.print.attribute.PrintRequestAttribute;
-import javax.print.attribute.PrintRequestAttributeSet;
-import javax.print.attribute.PrintServiceAttributeSet;
-import javax.print.attribute.standard.PrinterName;
-import javax.xml.transform.stream.StreamSource;
-
-import org.ofbiz.base.util.Debug;
-import org.ofbiz.base.util.UtilDateTime;
-import org.ofbiz.base.util.UtilProperties;
-import org.ofbiz.base.util.UtilValidate;
-import org.ofbiz.base.util.collections.MapStack;
-import org.ofbiz.service.DispatchContext;
-import org.ofbiz.service.ServiceUtil;
-import org.ofbiz.webapp.view.ApacheFopWorker;
-import org.ofbiz.widget.fo.FoFormRenderer;
-import org.ofbiz.widget.fo.FoScreenRenderer;
-import org.ofbiz.widget.screen.ScreenRenderer;
-
-import javolution.util.FastMap;
-import org.apache.fop.apps.Fop;
-import org.apache.fop.apps.MimeConstants;
+ * under the License.
+ *******************************************************************************/
+package org.ofbiz.content.output;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.print.Doc;
+import javax.print.DocFlavor;
+import javax.print.DocPrintJob;
+import javax.print.PrintService;
+import javax.print.PrintServiceLookup;
+import javax.print.SimpleDoc;
+import javax.print.attribute.DocAttribute;
+import javax.print.attribute.DocAttributeSet;
+import javax.print.attribute.HashDocAttributeSet;
+import javax.print.attribute.HashPrintRequestAttributeSet;
+import javax.print.attribute.HashPrintServiceAttributeSet;
+import javax.print.attribute.PrintRequestAttribute;
+import javax.print.attribute.PrintRequestAttributeSet;
+import javax.print.attribute.PrintServiceAttributeSet;
+import javax.print.attribute.standard.PrinterName;
+import javax.xml.transform.stream.StreamSource;
+
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.UtilDateTime;
+import org.ofbiz.base.util.UtilProperties;
+import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.base.util.collections.MapStack;
+import org.ofbiz.service.DispatchContext;
+import org.ofbiz.service.ServiceUtil;
+import org.ofbiz.webapp.view.ApacheFopWorker;
+import org.ofbiz.widget.fo.FoFormRenderer;
+import org.ofbiz.widget.fo.FoScreenRenderer;
+import org.ofbiz.widget.screen.ScreenRenderer;
+
+import javolution.util.FastMap;
+import org.apache.fop.apps.Fop;
+import org.apache.fop.apps.MimeConstants;
 
 
-/**
+/**
  * Output Services
- */
-public class OutputServices {
+ */
+public class OutputServices {
 
-    public final static String module = OutputServices.class.getName();
+    public final static String module = OutputServices.class.getName();
 
-    protected static final FoScreenRenderer foScreenRenderer = new FoScreenRenderer();
-    protected static final FoFormRenderer foFormRenderer = new FoFormRenderer();
+    protected static final FoScreenRenderer foScreenRenderer = new FoScreenRenderer();
+    protected static final FoFormRenderer foFormRenderer = new FoFormRenderer();
 
-    public static Map<String, Object> sendPrintFromScreen(DispatchContext dctx, Map<String, ? extends Object> serviceContext) {
-
-        Locale locale = (Locale) serviceContext.get("locale");
-        String screenLocation = (String) serviceContext.remove("screenLocation");
-        Map screenContext = (Map) serviceContext.remove("screenContext");
-        String contentType = (String) serviceContext.remove("contentType");
-        String printerContentType = (String) serviceContext.remove("printerContentType");
-
-        if (UtilValidate.isEmpty(screenContext)) {
-            screenContext = FastMap.newInstance();
-        }
-        screenContext.put("locale", locale);
-        if (UtilValidate.isEmpty(contentType)) {
-            contentType = "application/postscript";
-        }
-        if (UtilValidate.isEmpty(printerContentType)) {
-            printerContentType = contentType;
-        }
-
-        try {
-
-            MapStack screenContextTmp = MapStack.create();
-            screenContextTmp.put("locale", locale);
-
-            Writer writer = new StringWriter();
-            // substitute the freemarker variables...
-            ScreenRenderer screensAtt = new ScreenRenderer(writer, screenContextTmp, foScreenRenderer);
-            screensAtt.populateContextForService(dctx, screenContext);
-            screenContextTmp.putAll(screenContext);
-            screensAtt.getContext().put("formStringRenderer", foFormRenderer);
-            screensAtt.render(screenLocation);
-
-            // create the input stream for the generation
-            StreamSource src = new StreamSource(new StringReader(writer.toString()));
-
-            // create the output stream for the generation
-            ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
-            Fop fop = ApacheFopWorker.createFopInstance(baos, MimeConstants.MIME_PDF);
-            ApacheFopWorker.transform(src, null, fop);
-
-            baos.flush();
-            baos.close();
-
-            // Print is sent
-            DocFlavor psInFormat = new DocFlavor.INPUT_STREAM(printerContentType);
-            InputStream bais = new ByteArrayInputStream(baos.toByteArray());
-
-            DocAttributeSet docAttributeSet = new HashDocAttributeSet();
-            List docAttributes = (List) serviceContext.remove("docAttributes");
-            if (UtilValidate.isNotEmpty(docAttributes)) {
-                for (Object da : docAttributes) {
-                    Debug.logInfo("Adding DocAttribute: " + da, module);
-                    docAttributeSet.add((DocAttribute) da);
-                }
-            }
-
-            Doc myDoc = new SimpleDoc(bais, psInFormat, docAttributeSet);
-
-            PrintService printer = null;
-
-            // lookup the print service for the supplied printer name
-            String printerName = (String) serviceContext.remove("printerName");
-            if (UtilValidate.isNotEmpty(printerName)) {
-
-                PrintServiceAttributeSet printServiceAttributes = new HashPrintServiceAttributeSet();
-                printServiceAttributes.add(new PrinterName(printerName, locale));
-
-                PrintService[] printServices = PrintServiceLookup.lookupPrintServices(null, printServiceAttributes);
-                if (printServices.length > 0) {
-                    printer = printServices[0];
-                    Debug.logInfo("Using printer: " + printer.getName(), module);
-                    if (!printer.isDocFlavorSupported(psInFormat)) {
-                        return ServiceUtil.returnError("DocFlavor [" + psInFormat + "] not supported by printer: " + printer.getName());
-                    }
-                }
-                if (printer == null) {
-                    return ServiceUtil.returnError("No printer found with name: " + printerName);
-                }
-
-            } else {
-
-                // if no printer name was supplied, try to get the default printer
-                printer = PrintServiceLookup.lookupDefaultPrintService();
-                if (printer != null) {
-                    Debug.logInfo("No printer name supplied, using default printer: " + printer.getName(), module);
-                }
-            }
-
-            if (printer == null) {
-                return ServiceUtil.returnError("No printer available");
-            }
-
-
-            PrintRequestAttributeSet praset = new HashPrintRequestAttributeSet();
-            List printRequestAttributes = (List) serviceContext.remove("printRequestAttributes");
-            if (UtilValidate.isNotEmpty(printRequestAttributes)) {
-                for (Object pra : printRequestAttributes) {
-                    Debug.logInfo("Adding PrintRequestAttribute: " + pra, module);
-                    praset.add((PrintRequestAttribute) pra);
-                }
-            }
-            DocPrintJob job = printer.createPrintJob();
-            job.print(myDoc, praset);
-
-
-        } catch (Exception e) {
-            String errMsg = "Error rendering [" + contentType + "]: " + e.toString();
-            Debug.logError(e, errMsg, module);
-            return ServiceUtil.returnError(errMsg);
-        }
-
-        return ServiceUtil.returnSuccess();
-    }
-
-    public static Map<String, Object> createFileFromScreen(DispatchContext dctx, Map<String, ? extends Object> serviceContext) {
-
-        Locale locale = (Locale) serviceContext.get("locale");
-        String screenLocation = (String) serviceContext.remove("screenLocation");
-        Map screenContext = (Map) serviceContext.remove("screenContext");
-        String contentType = (String) serviceContext.remove("contentType");
-        String filePath = (String) serviceContext.remove("filePath");
-        String fileName = (String) serviceContext.remove("fileName");
-
-        if (UtilValidate.isEmpty(screenContext)) {
-            screenContext = FastMap.newInstance();
-        }
-        screenContext.put("locale", locale);
-        if (UtilValidate.isEmpty(contentType)) {
-            contentType = "application/pdf";
-        }
-
-        try {
-            MapStack screenContextTmp = MapStack.create();
-            screenContextTmp.put("locale", locale);
-
-            Writer writer = new StringWriter();
-            // substitute the freemarker variables...
-            ScreenRenderer screensAtt = new ScreenRenderer(writer, screenContextTmp, foScreenRenderer);
-            screensAtt.populateContextForService(dctx, screenContext);
-            screenContextTmp.putAll(screenContext);
-            screensAtt.getContext().put("formStringRenderer", foFormRenderer);
-            screensAtt.render(screenLocation);
-
-            // create the input stream for the generation
-            StreamSource src = new StreamSource(new StringReader(writer.toString()));
-
-            // create the output stream for the generation
-            ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
-            Fop fop = ApacheFopWorker.createFopInstance(baos, MimeConstants.MIME_PDF);
-            ApacheFopWorker.transform(src, null, fop);
-
-            baos.flush();
-            baos.close();
-
-            fileName += UtilDateTime.nowAsString();
-            if ("application/pdf".equals(contentType)) {
-                fileName += ".pdf";
-            } else if ("application/postscript".equals(contentType)) {
-                fileName += ".ps";
-            } else if ("text/plain".equals(contentType)) {
-                fileName += ".txt";
-            }
-            if (UtilValidate.isEmpty(filePath)) {
-                filePath = UtilProperties.getPropertyValue("content.properties", "content.output.path", "/output");
-            }
-            File file = new File(filePath, fileName);
-
-            FileOutputStream fos = new FileOutputStream(file);
-            fos.write(baos.toByteArray());
-            fos.close();
-
-        } catch (Exception e) {
-            String errMsg = "Error rendering [" + contentType + "]: " + e.toString();
-            Debug.logError(e, errMsg, module);
-            return ServiceUtil.returnError(errMsg);
-        }
+    public static Map<String, Object> sendPrintFromScreen(DispatchContext dctx, Map<String, ? extends Object> serviceContext) {
+
+        Locale locale = (Locale) serviceContext.get("locale");
+        String screenLocation = (String) serviceContext.remove("screenLocation");
+        Map screenContext = (Map) serviceContext.remove("screenContext");
+        String contentType = (String) serviceContext.remove("contentType");
+        String printerContentType = (String) serviceContext.remove("printerContentType");
+
+        if (UtilValidate.isEmpty(screenContext)) {
+            screenContext = FastMap.newInstance();
+        }
+        screenContext.put("locale", locale);
+        if (UtilValidate.isEmpty(contentType)) {
+            contentType = "application/postscript";
+        }
+        if (UtilValidate.isEmpty(printerContentType)) {
+            printerContentType = contentType;
+        }
+
+        try {
+
+            MapStack screenContextTmp = MapStack.create();
+            screenContextTmp.put("locale", locale);
+
+            Writer writer = new StringWriter();
+            // substitute the freemarker variables...
+            ScreenRenderer screensAtt = new ScreenRenderer(writer, screenContextTmp, foScreenRenderer);
+            screensAtt.populateContextForService(dctx, screenContext);
+            screenContextTmp.putAll(screenContext);
+            screensAtt.getContext().put("formStringRenderer", foFormRenderer);
+            screensAtt.render(screenLocation);
+
+            // create the input stream for the generation
+            StreamSource src = new StreamSource(new StringReader(writer.toString()));
+
+            // create the output stream for the generation
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+            Fop fop = ApacheFopWorker.createFopInstance(baos, MimeConstants.MIME_PDF);
+            ApacheFopWorker.transform(src, null, fop);
+
+            baos.flush();
+            baos.close();
+
+            // Print is sent
+            DocFlavor psInFormat = new DocFlavor.INPUT_STREAM(printerContentType);
+            InputStream bais = new ByteArrayInputStream(baos.toByteArray());
+
+            DocAttributeSet docAttributeSet = new HashDocAttributeSet();
+            List docAttributes = (List) serviceContext.remove("docAttributes");
+            if (UtilValidate.isNotEmpty(docAttributes)) {
+                for (Object da : docAttributes) {
+                    Debug.logInfo("Adding DocAttribute: " + da, module);
+                    docAttributeSet.add((DocAttribute) da);
+                }
+            }
+
+            Doc myDoc = new SimpleDoc(bais, psInFormat, docAttributeSet);
+
+            PrintService printer = null;
+
+            // lookup the print service for the supplied printer name
+            String printerName = (String) serviceContext.remove("printerName");
+            if (UtilValidate.isNotEmpty(printerName)) {
+
+                PrintServiceAttributeSet printServiceAttributes = new HashPrintServiceAttributeSet();
+                printServiceAttributes.add(new PrinterName(printerName, locale));
+
+                PrintService[] printServices = PrintServiceLookup.lookupPrintServices(null, printServiceAttributes);
+                if (printServices.length > 0) {
+                    printer = printServices[0];
+                    Debug.logInfo("Using printer: " + printer.getName(), module);
+                    if (!printer.isDocFlavorSupported(psInFormat)) {
+                        return ServiceUtil.returnError("DocFlavor [" + psInFormat + "] not supported by printer: " + printer.getName());
+                    }
+                }
+                if (printer == null) {
+                    return ServiceUtil.returnError("No printer found with name: " + printerName);
+                }
+
+            } else {
+
+                // if no printer name was supplied, try to get the default printer
+                printer = PrintServiceLookup.lookupDefaultPrintService();
+                if (printer != null) {
+                    Debug.logInfo("No printer name supplied, using default printer: " + printer.getName(), module);
+                }
+            }
+
+            if (printer == null) {
+                return ServiceUtil.returnError("No printer available");
+            }
+
+
+            PrintRequestAttributeSet praset = new HashPrintRequestAttributeSet();
+            List printRequestAttributes = (List) serviceContext.remove("printRequestAttributes");
+            if (UtilValidate.isNotEmpty(printRequestAttributes)) {
+                for (Object pra : printRequestAttributes) {
+                    Debug.logInfo("Adding PrintRequestAttribute: " + pra, module);
+                    praset.add((PrintRequestAttribute) pra);
+                }
+            }
+            DocPrintJob job = printer.createPrintJob();
+            job.print(myDoc, praset);
+
+
+        } catch (Exception e) {
+            String errMsg = "Error rendering [" + contentType + "]: " + e.toString();
+            Debug.logError(e, errMsg, module);
+            return ServiceUtil.returnError(errMsg);
+        }
+
+        return ServiceUtil.returnSuccess();
+    }
+
+    public static Map<String, Object> createFileFromScreen(DispatchContext dctx, Map<String, ? extends Object> serviceContext) {
+
+        Locale locale = (Locale) serviceContext.get("locale");
+        String screenLocation = (String) serviceContext.remove("screenLocation");
+        Map screenContext = (Map) serviceContext.remove("screenContext");
+        String contentType = (String) serviceContext.remove("contentType");
+        String filePath = (String) serviceContext.remove("filePath");
+        String fileName = (String) serviceContext.remove("fileName");
+
+        if (UtilValidate.isEmpty(screenContext)) {
+            screenContext = FastMap.newInstance();
+        }
+        screenContext.put("locale", locale);
+        if (UtilValidate.isEmpty(contentType)) {
+            contentType = "application/pdf";
+        }
+
+        try {
+            MapStack screenContextTmp = MapStack.create();
+            screenContextTmp.put("locale", locale);
+
+            Writer writer = new StringWriter();
+            // substitute the freemarker variables...
+            ScreenRenderer screensAtt = new ScreenRenderer(writer, screenContextTmp, foScreenRenderer);
+            screensAtt.populateContextForService(dctx, screenContext);
+            screenContextTmp.putAll(screenContext);
+            screensAtt.getContext().put("formStringRenderer", foFormRenderer);
+            screensAtt.render(screenLocation);
+
+            // create the input stream for the generation
+            StreamSource src = new StreamSource(new StringReader(writer.toString()));
+
+            // create the output stream for the generation
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+            Fop fop = ApacheFopWorker.createFopInstance(baos, MimeConstants.MIME_PDF);
+            ApacheFopWorker.transform(src, null, fop);
+
+            baos.flush();
+            baos.close();
+
+            fileName += UtilDateTime.nowAsString();
+            if ("application/pdf".equals(contentType)) {
+                fileName += ".pdf";
+            } else if ("application/postscript".equals(contentType)) {
+                fileName += ".ps";
+            } else if ("text/plain".equals(contentType)) {
+                fileName += ".txt";
+            }
+            if (UtilValidate.isEmpty(filePath)) {
+                filePath = UtilProperties.getPropertyValue("content.properties", "content.output.path", "/output");
+            }
+            File file = new File(filePath, fileName);
+
+            FileOutputStream fos = new FileOutputStream(file);
+            fos.write(baos.toByteArray());
+            fos.close();
+
+        } catch (Exception e) {
+            String errMsg = "Error rendering [" + contentType + "]: " + e.toString();
+            Debug.logError(e, errMsg, module);
+            return ServiceUtil.returnError(errMsg);
+        }
 
-        return ServiceUtil.returnSuccess();
-    }
+        return ServiceUtil.returnSuccess();
+    }
 
-}
+}

Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/report/JREntityListIteratorDataSource.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/report/JREntityListIteratorDataSource.java?rev=757086&r1=757085&r2=757086&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/report/JREntityListIteratorDataSource.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/report/JREntityListIteratorDataSource.java Sat Mar 21 23:43:51 2009
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- *
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -32,7 +32,7 @@
  * <code>JREntityListIteratorDataSource</code>
  */
 public class JREntityListIteratorDataSource implements JRDataSource {
-    
+
     public static final String module = JREntityListIteratorDataSource.class.getName();
 
     private EntityListIterator entityListIterator = null;

Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/report/JRMapCollectionDataSource.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/report/JRMapCollectionDataSource.java?rev=757086&r1=757085&r2=757086&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/report/JRMapCollectionDataSource.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/report/JRMapCollectionDataSource.java Sat Mar 21 23:43:51 2009
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- *
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY

Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/search/ContentDocument.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/search/ContentDocument.java?rev=757086&r1=757085&r2=757086&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/search/ContentDocument.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/search/ContentDocument.java Sat Mar 21 23:43:51 2009
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- *
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY

Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/search/DataResourceDocument.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/search/DataResourceDocument.java?rev=757086&r1=757085&r2=757086&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/search/DataResourceDocument.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/search/DataResourceDocument.java Sat Mar 21 23:43:51 2009
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- *
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY

Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/search/SearchEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/search/SearchEvents.java?rev=757086&r1=757085&r2=757086&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/search/SearchEvents.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/search/SearchEvents.java Sat Mar 21 23:43:51 2009
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- *
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -43,7 +43,7 @@
 public class SearchEvents {
 
     public static final String module = SearchEvents.class.getName();
-    
+
     public static String indexTree(HttpServletRequest request, HttpServletResponse response) {
 
         Map result;

Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/search/SearchServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/search/SearchServices.java?rev=757086&r1=757085&r2=757086&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/search/SearchServices.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/search/SearchServices.java Sat Mar 21 23:43:51 2009
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- *
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY

Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/PdfSurveyServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/PdfSurveyServices.java?rev=757086&r1=757085&r2=757086&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/PdfSurveyServices.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/PdfSurveyServices.java Sat Mar 21 23:43:51 2009
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- *
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -69,11 +69,11 @@
  */
 
 public class PdfSurveyServices {
-    
+
     public static final String module = PdfSurveyServices.class.getName();
 
     /**
-     *
+     *
      */
     public static Map<String, Object> buildSurveyFromPdf(DispatchContext dctx, Map<String, ? extends Object> context) {
         GenericDelegator delegator = dctx.getDelegator();
@@ -89,7 +89,7 @@
             PdfStamper pdfStamper = new PdfStamper(pdfReader, os);
             AcroFields acroFields = pdfStamper.getAcroFields();
             Map acroFieldMap = acroFields.getFields();
-            
+
             String contentId = (String) context.get("contentId");
             GenericValue survey = null;
             surveyId = (String) context.get("surveyId");
@@ -101,12 +101,12 @@
                 survey = delegator.createSetNextSeqId(survey);
                 surveyId = survey.getString("surveyId");
             }
-            
+
             // create a SurveyQuestionCategory to put the questions in
-            Map createCategoryResultMap = dispatcher.runSync("createSurveyQuestionCategory",
+            Map createCategoryResultMap = dispatcher.runSync("createSurveyQuestionCategory",
                     UtilMisc.<String, Object>toMap("description", "From AcroForm in Content [" + contentId + "] for Survey [" + surveyId + "]", "userLogin", userLogin));
             String surveyQuestionCategoryId = (String) createCategoryResultMap.get("surveyQuestionCategoryId");
-            
+
             pdfStamper.setFormFlattening(true);
             Iterator i = acroFieldMap.keySet().iterator();
             while (i.hasNext()) {
@@ -135,13 +135,13 @@
                     surveyQuestion.set("surveyQuestionTypeId", "TEXT_SHORT");
                     Debug.logWarning("Building Survey from PDF, fieldName=[" + fieldName + "]: don't know how to handle field type: " + type + "; defaulting to short text", module);
                 }
-                
+
                 // ==== create a good sequenceNum based on tab order or if no tab order then the page location
-                
+
                 Integer tabPage = (Integer) item.page.get(0);
                 Integer tabOrder = (Integer) item.tabOrder.get(0);
                 Debug.logInfo("tabPage=" + tabPage + ", tabOrder=" + tabOrder, module);
-                
+
                 //array of float  multiple of 5. For each of this groups the values are: [page, llx, lly, urx, ury]
                 float[] fieldPositions = acroFields.getFieldPositions(fieldName);
                 float fieldPage = fieldPositions[0];
@@ -159,15 +159,15 @@
                     sequenceNum = Long.valueOf((long) fieldPage * 10000 + (long) fieldLly * 1000 + (long) fieldLlx);
                     Debug.logInfo("fieldPage=" + fieldPage + ", fieldLlx=" + fieldLlx + ", fieldLly=" + fieldLly + ", fieldUrx=" + fieldUrx + ", fieldUry=" + fieldUry + ", sequenceNum=" + sequenceNum, module);
                 }
-                
+
                 // TODO: need to find something better to put into these fields...
                 String annotation = null;
                 Iterator widgetIter = item.widgets.iterator();
                 while (widgetIter.hasNext()) {
                     PdfDictionary dict = (PdfDictionary) widgetIter.next();
-                    
+
                     // if the "/Type" value is "/Annot", then get the value of "/TU" for the annotation
-                    
+
                     /* Interesting... this doesn't work, I guess we have to iterate to find the stuff...
                     PdfObject typeValue = dict.get(new PdfName("/Type"));
                     if (typeValue != null && "/Annot".equals(typeValue.toString())) {
@@ -175,16 +175,16 @@
                         annotation = tuValue.toString();
                     }
                     */
-                    
+
                     PdfObject typeValue = null;
                     PdfObject tuValue = null;
-                    
+
                     Set dictKeys = dict.getKeys();
                     Iterator dictKeyIter = dictKeys.iterator();
                     while (dictKeyIter.hasNext()) {
                         PdfName dictKeyName = (PdfName) dictKeyIter.next();
                         PdfObject dictObject = dict.get(dictKeyName);
-                        
+
                         if ("/Type".equals(dictKeyName.toString())) {
                             typeValue = dictObject;
                         } else if ("/TU".equals(dictKeyName.toString())) {
@@ -196,7 +196,7 @@
                         annotation = tuValue.toString();
                     }
                 }
-                
+
                 surveyQuestion.set("description", fieldName);
                 if (UtilValidate.isNotEmpty(annotation)) {
                     surveyQuestion.set("question", annotation);
@@ -214,7 +214,7 @@
 
                 surveyQuestion.create();
                 surveyQuestionAppl.create();
-            }            
+            }
             pdfStamper.close();
             if (UtilValidate.isNotEmpty(contentId)) {
                 survey = delegator.findByPrimaryKey("Survey", UtilMisc.toMap("surveyId", surveyId));
@@ -233,20 +233,20 @@
             Debug.logError(e, errMsg, module);
             return ServiceUtil.returnError(errMsg);
         }
-        
+
         Map results = ServiceUtil.returnSuccess();
         results.put("surveyId", surveyId);
         return results;
     }
-    
+
     /**
-     *
+     *
      */
     public static Map<String, Object> buildSurveyResponseFromPdf(DispatchContext dctx, Map<String, ? extends Object> context) {
 
         String surveyResponseId = null;
         try {
-            
+
             GenericDelegator delegator = dctx.getDelegator();
             String partyId = (String)context.get("partyId");
             String surveyId = (String)context.get("surveyId");
@@ -264,15 +264,15 @@
                 surveyResponse.set("lastModifiedDate", UtilDateTime.nowTimestamp());
                 surveyResponse.create();
             }
-            
+
             ByteArrayOutputStream os = new ByteArrayOutputStream();
             ByteBuffer byteBuffer = getInputByteBuffer(context, delegator);
             PdfReader r = new PdfReader(byteBuffer.array());
             PdfStamper s = new PdfStamper(r,os);
             AcroFields fs = s.getAcroFields();
             Map hm = fs.getFields();
-            
-            
+
+
             s.setFormFlattening(true);
             Iterator i = hm.keySet().iterator();
             while (i.hasNext()) {
@@ -280,13 +280,13 @@
                 //AcroFields.Item item = fs.getFieldItem(fieldName);
                 //int type = fs.getFieldType(fieldName);
                 String value = fs.getField(fieldName);
-                
+
                 List questions = delegator.findByAnd("SurveyQuestionAndAppl", UtilMisc.toMap("surveyId", surveyId, "externalFieldRef", fieldName));
                 if (questions.size() == 0 ) {
                     Debug.logInfo("No question found for surveyId:" + surveyId + " and externalFieldRef:" + fieldName, module);
                     continue;
                 }
-                
+
                 GenericValue surveyQuestionAndAppl = (GenericValue)questions.get(0);
                 String surveyQuestionId = (String)surveyQuestionAndAppl.get("surveyQuestionId");
                 String surveyQuestionTypeId = (String)surveyQuestionAndAppl.get("surveyQuestionTypeId");
@@ -296,7 +296,7 @@
                 }
 
                 delegator.create(surveyResponseAnswer);
-            }            
+            }
             s.close();
         } catch (GenericEntityException e) {
             String errMsg = "Error generating PDF: " + e.toString();
@@ -310,7 +310,7 @@
             Debug.logError(e, errMsg, module);
             return ServiceUtil.returnError(errMsg);
         }
-        
+
         Map results = ServiceUtil.returnSuccess();
         results.put("surveyResponseId", surveyResponseId);
         return results;
@@ -319,7 +319,7 @@
     /**
      */
     public static Map<String, Object> getAcroFieldsFromPdf(DispatchContext dctx, Map<String, ? extends Object> context) {
-        
+
         Map acroFieldMap = FastMap.newInstance();
         try {
             ByteArrayOutputStream os = new ByteArrayOutputStream();
@@ -329,21 +329,21 @@
             PdfStamper s = new PdfStamper(r,os);
             AcroFields fs = s.getAcroFields();
             Map map = fs.getFields();
-            
+
             s.setFormFlattening(true);
-            
+
             // Debug code to get the values for setting TDP
     //        String[] sa = fs.getAppearanceStates("TDP");
     //        for (int i=0;i<sa.length;i++)
     //            Debug.log("Appearance="+sa[i]);
-            
+
             Iterator iter = map.keySet().iterator();
             while (iter.hasNext()) {
                 String fieldName=(String)iter.next();
                 String parmValue = fs.getField(fieldName);
                 acroFieldMap.put(fieldName, parmValue);
-            }            
-                
+            }
+
         } catch (DocumentException e) {
             System.err.println(e.getMessage());
             ServiceUtil.returnError(e.getMessage());
@@ -354,16 +354,16 @@
             System.err.println(ioe.getMessage());
             ServiceUtil.returnError(ioe.getMessage());
         }
-        
+
     Map results = ServiceUtil.returnSuccess();
     results.put("acroFieldMap", acroFieldMap);
     return results;
     }
-    
+
     /**
      */
     public static Map<String, Object> setAcroFields(DispatchContext dctx, Map<String, ? extends Object> context) {
-        
+
         Map results = ServiceUtil.returnSuccess();
         GenericDelegator delegator = dctx.getDelegator();
         try {
@@ -374,14 +374,14 @@
             PdfStamper s = new PdfStamper(r, baos);
             AcroFields fs = s.getAcroFields();
             Map map = fs.getFields();
-            
+
             s.setFormFlattening(true);
-            
+
             // Debug code to get the values for setting TDP
     //      String[] sa = fs.getAppearanceStates("TDP");
     //      for (int i=0;i<sa.length;i++)
     //          Debug.log("Appearance="+sa[i]);
-            
+
             Iterator iter = map.keySet().iterator();
             while (iter.hasNext()) {
                 String fieldName=(String)iter.next();
@@ -399,11 +399,11 @@
                 }   else {
                     fieldValue=(String)obj;
                 }
-            
+
                 if (UtilValidate.isNotEmpty(fieldValue))
                     fs.setField(fieldName, fieldValue);
-            }      
-                
+            }
+
             s.close();
             baos.close();
             ByteBuffer outByteBuffer = ByteBuffer.wrap(baos.toByteArray());
@@ -424,11 +424,11 @@
             System.err.println(ioe.getMessage());
             ServiceUtil.returnError(ioe.getMessage());
         }
-        
+
     return results;
     }
-    
-    
+
+
     /**
      */
     public static Map<String, Object> buildPdfFromSurveyResponse(DispatchContext dctx, Map<String, ? extends Object> rcontext) {
@@ -457,10 +457,10 @@
                     }
                 }
             }
-        
+
             ByteArrayOutputStream baos = new ByteArrayOutputStream();
             PdfWriter.getInstance(document, baos);
-            
+
             List responses = delegator.findByAnd("SurveyResponseAnswer", UtilMisc.toMap("surveyResponseId", surveyResponseId));
             Iterator iter = responses.iterator();
             while (iter.hasNext()) {
@@ -497,10 +497,10 @@
             System.err.println(e.getMessage());
             ServiceUtil.returnError(e.getMessage());
         }
-        
+
         return results;
     }
-    
+
     /**
      * Returns list of maps with "question"->SurveyQuestion and "response"->SurveyResponseAnswer
      */
@@ -520,7 +520,7 @@
                     surveyId = surveyResponse.getString("surveyId");
                 }
             }
-        
+
             List responses = delegator.findByAnd("SurveyResponseAnswer", UtilMisc.toMap("surveyResponseId", surveyResponseId));
             Iterator iter = responses.iterator();
             while (iter.hasNext()) {
@@ -535,10 +535,10 @@
             System.err.println(e.getMessage());
             ServiceUtil.returnError(e.getMessage());
         }
-        
+
         return results;
     }
-    
+
     /**
      */
     public static Map<String, Object> setAcroFieldsFromSurveyResponse(DispatchContext dctx, Map<String, ? extends Object> context) {
@@ -548,7 +548,7 @@
         Map acroFieldMap = FastMap.newInstance();
         String surveyResponseId = (String)context.get("surveyResponseId");
         String acroFormContentId = null;
-    
+
         try {
             String surveyId = null;
             if (UtilValidate.isNotEmpty(surveyResponseId)) {
@@ -564,7 +564,7 @@
                     acroFormContentId = survey.getString("acroFormContentId");
                 }
             }
-            
+
             List responses = delegator.findByAnd("SurveyResponseAnswer", UtilMisc.toMap("surveyResponseId", surveyResponseId));
             Iterator iter = responses.iterator();
             while (iter.hasNext()) {
@@ -573,10 +573,10 @@
                 String surveyQuestionId = (String) surveyResponseAnswer.get("surveyQuestionId");
 
                 GenericValue surveyQuestion = delegator.findByPrimaryKeyCache("SurveyQuestion", UtilMisc.toMap("surveyQuestionId", surveyQuestionId));
-                
+
                 List surveyQuestionApplList = EntityUtil.filterByDate(delegator.findByAndCache("SurveyQuestionAppl", UtilMisc.toMap("surveyId", surveyId, "surveyQuestionId", surveyQuestionId), UtilMisc.toList("-fromDate")), false);
                 GenericValue surveyQuestionAppl = EntityUtil.getFirst(surveyQuestionApplList);
-                
+
                 String questionType = surveyQuestion.getString("surveyQuestionTypeId");
                 String fieldName = surveyQuestionAppl.getString("externalFieldRef");
                 if ("OPTION".equals(questionType)) {
@@ -599,7 +599,7 @@
             System.err.println(e.getMessage());
             ServiceUtil.returnError(e.getMessage());
         }
-        
+
         try {
             ModelService modelService = dispatcher.getDispatchContext().getModelService("setAcroFields");
             Map ctx = modelService.makeValid(context, "IN");
@@ -629,14 +629,14 @@
             System.err.println(e.getMessage());
             ServiceUtil.returnError(e.getMessage());
         }
-            
+
     return results;
     }
-    
+
     public static ByteBuffer getInputByteBuffer(Map context, GenericDelegator delegator) throws GeneralException {
-        
+
         ByteBuffer inputByteBuffer = (ByteBuffer)context.get("inputByteBuffer");
-        
+
         if (inputByteBuffer == null) {
             String pdfFileNameIn = (String)context.get("pdfFileNameIn");
             String contentId = (String)context.get("contentId");
@@ -655,7 +655,7 @@
             } else if (UtilValidate.isNotEmpty(contentId)) {
                 try {
                     Locale locale = (Locale)context.get("locale");
-                    String https = (String)context.get("https");
+                    String https = (String)context.get("https");
                     String webSiteId = (String)context.get("webSiteId");
                     String rootDir = (String)context.get("rootDir");
                     GenericValue content = delegator.findByPrimaryKeyCache("Content", UtilMisc.toMap("contentId", contentId));

Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/SurveyWrapper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/SurveyWrapper.java?rev=757086&r1=757085&r2=757086&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/SurveyWrapper.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/SurveyWrapper.java Sat Mar 21 23:43:51 2009
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- *
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -177,7 +177,7 @@
         } else {
             currentAnswers = this.getResponseAnswers(null);
         }
-        
+
         Map sqaaWithColIdListByMultiRespId = FastMap.newInstance();
         Iterator surveyQuestionAndApplIter = surveyQuestionAndAppls.iterator();
         while (surveyQuestionAndApplIter.hasNext()) {
@@ -260,7 +260,7 @@
         if (this.edit) {
             return true;
         }
-        
+
         GenericValue survey = this.getSurvey();
         if (!"Y".equals(survey.getString("allowMultiple")) || !"Y".equals(survey.getString("allowUpdate"))) {
             return false;
@@ -404,7 +404,7 @@
         boolean beganTransaction = false;
         try {
             beganTransaction = TransactionUtil.begin();
-            
+
             EntityListIterator eli = this.getEli(question);
             if (startIndex > 0 && number > 0) {
                 resp = eli.getPartialList(startIndex, number);
@@ -537,14 +537,14 @@
         boolean beganTransaction = false;
         try {
             beganTransaction = TransactionUtil.begin();
-            
+
             long[] result = { 0, 0, 0 };
             // index 0 = total responses
             // index 1 = total yes
             // index 2 = total no
-    
+
             EntityListIterator eli = this.getEli(question);
-    
+
             if (eli != null) {
                 GenericValue value;
                 while (((value = (GenericValue) eli.next()) != null)) {
@@ -555,10 +555,10 @@
                     }
                     result[0]++; // increment the count
                 }
-    
+
                 eli.close();
             }
-    
+
             return result;
         } catch (GenericEntityException e) {
             try {
@@ -589,9 +589,9 @@
         boolean beganTransaction = false;
         try {
             beganTransaction = TransactionUtil.begin();
-            
+
             EntityListIterator eli = this.getEli(question);
-    
+
             if (eli != null) {
                 GenericValue value;
                 while (((value = (GenericValue) eli.next()) != null)) {
@@ -617,7 +617,7 @@
                     }
                     result[0]++; // increment the count
                 }
-    
+
                 eli.close();
             }
         } catch (GenericEntityException e) {
@@ -678,7 +678,7 @@
         boolean beganTransaction = false;
         try {
             beganTransaction = TransactionUtil.begin();
-            
+
             EntityListIterator eli = this.getEli(question);
             if (eli != null) {
                 GenericValue value;
@@ -695,7 +695,7 @@
                         total++; // increment the count
                     }
                 }
-    
+
                 eli.close();
             }
         } catch (GenericEntityException e) {

Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/view/SimpleContentViewHandler.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/view/SimpleContentViewHandler.java?rev=757086&r1=757085&r2=757086&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/view/SimpleContentViewHandler.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/view/SimpleContentViewHandler.java Sat Mar 21 23:43:51 2009
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- *
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -49,10 +49,10 @@
  * This handler will use JPublish to generate the XSL-FO
  */
 public class SimpleContentViewHandler extends AbstractViewHandler {
-    
+
     public static final String module = SimpleContentViewHandler.class.getName();
     protected ServletContext servletContext = null;
-    
+
     public void init(ServletContext context) throws ViewHandlerException {
         this.servletContext = context;
     }
@@ -60,7 +60,7 @@
      * @see org.ofbiz.webapp.view.ViewHandler#render(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
      */
     public void render(String name, String page, String info, String contentType, String encoding, HttpServletRequest request, HttpServletResponse response) throws ViewHandlerException {
-        
+
         String contentId = request.getParameter("contentId");
         String rootContentId = request.getParameter("rootContentId");
         String mapKey = request.getParameter("mapKey");
@@ -73,7 +73,7 @@
         String rootDir = null;
         String webSiteId = null;
         String https = null;
-        
+
         if (UtilValidate.isEmpty(rootDir)) {
             rootDir = servletContext.getRealPath("/");
         }

Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/CheckPermissionTransform.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/CheckPermissionTransform.java?rev=757086&r1=757085&r2=757086&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/CheckPermissionTransform.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/CheckPermissionTransform.java Sat Mar 21 23:43:51 2009
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- *
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -104,7 +104,7 @@
                     //Debug.logInfo("in CheckPermission, trailCsv(2):" + trailCsv,"");
                     //Debug.logInfo("in CheckPermission, contentId(2):" + templateCtx.get("contentId"),"");
                     //Debug.logInfo("in CheckPermission, subContentId(2):" + templateCtx.get("subContentId"),"");
-            
+
                 GenericValue currentContent = null;
         String contentAssocPredicateId = (String)templateCtx.get("contentAssocPredicateId");
                 String strNullThruDatesOnly = (String)templateCtx.get("nullThruDatesOnly");
@@ -126,12 +126,12 @@
                     currentContent.put("ownerContentId", templateCtx.get("ownerContentId"));
                 }
                     //Debug.logInfo("in CheckPermission, currentContent(1):" + currentContent.get("contentId"),"");
-        
+
                 Security security = null;
                 if (request != null) {
                     security = (Security) request.getAttribute("security");
                 }
-            
+
                 String statusId = (String)currentContent.get("statusId");
                 String passedStatusId = (String)templateCtx.get("statusId");
                 List statusList = StringUtil.split(passedStatusId, "|");
@@ -139,7 +139,7 @@
                     statusList = FastList.newInstance();
                 if (UtilValidate.isNotEmpty(statusId) && !statusList.contains(statusId)) {
                     statusList.add(statusId);
-                }
+                }
                 String targetPurpose = (String)templateCtx.get("contentPurposeList");
                 List purposeList = StringUtil.split(targetPurpose, "|");
                 String entityOperation = (String)templateCtx.get("entityOperation");
@@ -155,9 +155,9 @@
                     throw new IOException("targetOperationList has zero size.");
                 }
                 List roleList = FastList.newInstance();
-        
+
                 String privilegeEnumId = (String)currentContent.get("privilegeEnumId");
-                Map results = EntityPermissionChecker.checkPermission(currentContent, statusList, userLogin, purposeList, targetOperationList, roleList, delegator, security, entityOperation, privilegeEnumId, quickCheckContentId);
+                Map results = EntityPermissionChecker.checkPermission(currentContent, statusList, userLogin, purposeList, targetOperationList, roleList, delegator, security, entityOperation, privilegeEnumId, quickCheckContentId);
 
                 boolean isError = ModelService.RESPOND_ERROR.equals(results.get(ModelService.RESPONSE_MESSAGE));
                 if (isError) {
@@ -167,7 +167,7 @@
                 String permissionStatus = (String) results.get("permissionStatus");
 
                 if (UtilValidate.isEmpty(permissionStatus) || !permissionStatus.equals("granted")) {
-                
+
                     String errorMessage = "Permission to add response is denied (2)";
                     PermissionRecorder recorder = (PermissionRecorder)results.get("permissionRecorder");
                         //Debug.logInfo("recorder(0):" + recorder, "");

Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/EditRenderSubContentCacheTransform.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/EditRenderSubContentCacheTransform.java?rev=757086&r1=757085&r2=757086&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/EditRenderSubContentCacheTransform.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/EditRenderSubContentCacheTransform.java Sat Mar 21 23:43:51 2009
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- *
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -46,14 +46,14 @@
 //import com.clarkware.profiler.Profiler;
 /**
  * EditRenderSubContentCacheTransform - Freemarker Transform for URLs (links)
- *
+ *
  * This is an interactive FreeMarker tranform that allows the user to modify the contents that are placed within it.
  */
 public class EditRenderSubContentCacheTransform implements TemplateTransformModel {
 
     public static final String module = EditRenderSubContentCacheTransform.class.getName();
     public static final String [] saveKeyNames = {"contentId", "subContentId", "subDataResourceTypeId", "mimeTypeId", "whenMap", "locale",  "wrapTemplateId", "encloseWrapText", "nullThruDatesOnly"};
-    
+
     /**
      * A wrapper for the FreeMarkerWorker version.
      */
@@ -138,7 +138,7 @@
                     String wrapTemplateId = (String)templateCtx.get("wrapTemplateId");
                     if (UtilValidate.isNotEmpty(wrapTemplateId)) {
                         templateCtx.put("wrappedContent", wrappedContent);
-                        
+
                     //Map templateRoot = FreeMarkerWorker.createEnvironmentMap(env);
                     Map templateRoot = null;
                     Map templateRootTemplate = (Map)templateCtx.get("templateRootTemplate");
@@ -149,7 +149,7 @@
                     } else {
                         templateRoot = UtilMisc.makeMapWritable(templateRootTemplate);
                     }
-                        
+
                         templateRoot.put("context", templateCtx);
         if (Debug.verboseOn()) {
             Set kySet = templateCtx.keySet();
@@ -159,7 +159,7 @@
                 Object val = templateCtx.get(ky);
             }
         }
-                        
+
                         String mimeTypeId = (String)templateCtx.get("mimeTypeId");
                         Locale locale = null;
                         try {
@@ -173,7 +173,7 @@
                             Debug.logError(e2, "Error rendering content" + e2.getMessage(), module);
                             throw new IOException("Error rendering content" + e2.toString());
                         }
-                        
+
                 } else {
                     out.write(wrappedContent);
                 }