svn commit: r501715 - in /ofbiz/trunk/applications/content/src/org/ofbiz/content: content/ContentServices.java content/ContentWorker.java content/UploadContentAndImage.java data/DataResourceWorker.java data/DataServices.java layout/LayoutWorker.java

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

svn commit: r501715 - in /ofbiz/trunk/applications/content/src/org/ofbiz/content: content/ContentServices.java content/ContentWorker.java content/UploadContentAndImage.java data/DataResourceWorker.java data/DataServices.java layout/LayoutWorker.java

jacopoc
Author: jacopoc
Date: Tue Jan 30 19:47:19 2007
New Revision: 501715

URL: http://svn.apache.org/viewvc?view=rev&rev=501715
Log:
Fixed bad formatting: tabs to 4-spaces.

Modified:
    ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServices.java
    ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java
    ofbiz/trunk/applications/content/src/org/ofbiz/content/content/UploadContentAndImage.java
    ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java
    ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataServices.java
    ofbiz/trunk/applications/content/src/org/ofbiz/content/layout/LayoutWorker.java

Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServices.java?view=diff&rev=501715&r1=501714&r2=501715
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServices.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServices.java Tue Jan 30 19:47:19 2007
@@ -133,11 +133,11 @@
         String direction = (String)context.get("direction");
         if (UtilValidate.isEmpty(direction)) direction="To";
         Map traversMap = new HashMap();
-     traversMap.put("contentId", contentId);
-     traversMap.put("direction", direction);
-     traversMap.put("contentAssocTypeId", contentAssocTypeId);
-     try {
-     Map thisResults = dispatcher.runSync("traverseContent", traversMap);
+            traversMap.put("contentId", contentId);
+            traversMap.put("direction", direction);
+            traversMap.put("contentAssocTypeId", contentAssocTypeId);
+            try {
+                Map thisResults = dispatcher.runSync("traverseContent", traversMap);
             String errorMsg = ServiceUtil.getErrorMessage(thisResults);
             if (UtilValidate.isNotEmpty(errorMsg) ) {
                 Debug.logError( "Problem in traverseContent. " + errorMsg, module);
@@ -145,9 +145,9 @@
             }
             Map nodeMap = (Map)thisResults.get("nodeMap");
             walkParentTree(nodeMap, parentList);
-     } catch (GenericServiceException e) {
+            } catch (GenericServiceException e) {
             return ServiceUtil.returnFailure(e.getMessage());
-     }
+            }
         return results;
     }
     

Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java?view=diff&rev=501715&r1=501714&r2=501715
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java Tue Jan 30 19:47:19 2007
@@ -899,7 +899,7 @@
         GenericValue view = null;
         if (contentId == null) {
             Debug.logError("ContentId is null", module);
-         return view;
+            return view;
         }
         Map results = null;
         List contentTypes = null;

Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/content/UploadContentAndImage.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/UploadContentAndImage.java?view=diff&rev=501715&r1=501714&r2=501715
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/content/UploadContentAndImage.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/content/UploadContentAndImage.java Tue Jan 30 19:47:19 2007
@@ -447,14 +447,13 @@
             ftlContext.put("userLogin", userLogin);
             Object objSequenceNum = passedParams.get("caSequenceNum");
             if (objSequenceNum != null ) {
-             if (objSequenceNum instanceof String) {
-             Long sequenceNum = null;
-             try {
-                 sequenceNum = new Long((String)objSequenceNum);
-                 } catch(NumberFormatException e) {
-                 }
+                if (objSequenceNum instanceof String) {
+                    Long sequenceNum = null;
+                    try {
+                        sequenceNum = new Long((String)objSequenceNum);
+                    } catch(NumberFormatException e) {}
                     passedParams.put("caSequenceNum", sequenceNum);
-               }
+                }
             }
 
             GenericValue contentAssocDataResourceViewFrom = delegator.makeValue("ContentAssocDataResourceViewFrom",null);

Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java?view=diff&rev=501715&r1=501714&r2=501715
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java Tue Jan 30 19:47:19 2007
@@ -608,7 +608,7 @@
                     templateRoot.put("globalNodeTrail", null); // Force getCurrentContent to query for subContent
                     //if (Debug.infoOn()) Debug.logInfo("in renderDataResourceAsTextCache, templateRoot :" + templateRoot ,"");
                     //StringWriter sw = new StringWriter();
-             // get the full text of the DataResource
+                    // get the full text of the DataResource
                     String templateText = getDataResourceTextCache(dataResource, mimeTypeId, locale, templateRoot, delegator);
                     FreeMarkerWorker.renderTemplate("DataResource:" + dataResourceId, templateText, templateRoot, out);
                     //if (Debug.infoOn()) Debug.logInfo("in renderDataResourceAsText, sw:" + sw.toString(),"");
@@ -728,9 +728,9 @@
                     rootDir = (String) context.get("rootDir");
             }
             if (mimeTypeId != null && mimeTypeId.startsWith("image")) {
-             writeDataResourceText(dataResource, mimeTypeId, locale, context, delegator, outWriter);
+                writeDataResourceText(dataResource, mimeTypeId, locale, context, delegator, outWriter);
             } else {
-             renderFile(dataResourceTypeId, dataResource.getString("objectInfo"), rootDir, outWriter);
+                renderFile(dataResourceTypeId, dataResource.getString("objectInfo"), rootDir, outWriter);
             }
         } else {
             throw new GeneralException("The dataResourceTypeId [" + dataResourceTypeId + "] is not supported in renderDataResourceAsText");
@@ -819,10 +819,11 @@
         } else if (dataResourceTypeId.indexOf("_FILE") >= 0) {
             String rootDir = (String) context.get("rootDir");
             dataResourceMimeTypeId = dataResource.getString("mimeTypeId");
-            if (dataResourceMimeTypeId == null || dataResourceMimeTypeId.startsWith("text"))
-             renderFile(dataResourceTypeId, dataResource.getString("objectInfo"), rootDir, outWriter);
-            else
+            if (dataResourceMimeTypeId == null || dataResourceMimeTypeId.startsWith("text")) {
+                renderFile(dataResourceTypeId, dataResource.getString("objectInfo"), rootDir, outWriter);
+            } else {
                 writeText( dataResourceId, dataResourceMimeTypeId, "text/html", outWriter);
+            }
         } else {
             throw new GeneralException("The dataResourceTypeId [" + dataResourceTypeId + "] is not supported in renderDataResourceAsText");
         }
@@ -1046,72 +1047,72 @@
     }
 
     public static void streamDataResource(OutputStream os, GenericDelegator delegator, String dataResourceId, String https, String webSiteId, Locale locale, String rootDir) throws IOException, GeneralException {
-     try {
-         GenericValue dataResource = delegator.findByPrimaryKeyCache("DataResource", UtilMisc.toMap("dataResourceId", dataResourceId));
-     if (dataResource == null) {
+        try {
+            GenericValue dataResource = delegator.findByPrimaryKeyCache("DataResource", UtilMisc.toMap("dataResourceId", dataResourceId));
+            if (dataResource == null) {
                 throw new GeneralException("Error in streamDataResource: DataResource with ID [" + dataResourceId + "] was not found.");
-     }
-        String dataResourceTypeId = dataResource.getString("dataResourceTypeId");
-        if (UtilValidate.isEmpty(dataResourceTypeId)) {
-            dataResourceTypeId = "SHORT_TEXT";
-        }
-        String mimeTypeId = dataResource.getString("mimeTypeId");
-        if (UtilValidate.isEmpty(mimeTypeId)) {
-         mimeTypeId = "text/html";
-        }
-
-        if (dataResourceTypeId.equals("SHORT_TEXT")) {
-            String text = dataResource.getString("objectInfo");
-            os.write(text.getBytes());
-        } else if (dataResourceTypeId.equals("ELECTRONIC_TEXT")) {
-            GenericValue electronicText = delegator.findByPrimaryKeyCache("ElectronicText", UtilMisc.toMap("dataResourceId", dataResourceId));
-            if (electronicText != null) {
-             String text = electronicText.getString("textData");
-             if (text != null) os.write(text.getBytes());
-            }
-        } else if (dataResourceTypeId.equals("IMAGE_OBJECT")) {
-         byte[] imageBytes = acquireImage(delegator, dataResource);
-         if (imageBytes != null) os.write(imageBytes);
-        } else if (dataResourceTypeId.equals("LINK")) {
-         String text = dataResource.getString("objectInfo");
-            os.write(text.getBytes());
-        } else if (dataResourceTypeId.equals("URL_RESOURCE")) {
-            URL url = new URL(dataResource.getString("objectInfo"));
-            if (url.getHost() == null) { // is relative
-                String prefix = buildRequestPrefix(delegator, locale, webSiteId, https);
-                String sep = "";
-                //String s = "";
-                if (url.toString().indexOf("/") != 0 && prefix.lastIndexOf("/") != (prefix.length() - 1)) {
-                    sep = "/";
-                }
-                String s2 = prefix + sep + url.toString();
-                url = new URL(s2);
-            }
+            }
+            String dataResourceTypeId = dataResource.getString("dataResourceTypeId");
+            if (UtilValidate.isEmpty(dataResourceTypeId)) {
+                dataResourceTypeId = "SHORT_TEXT";
+            }
+            String mimeTypeId = dataResource.getString("mimeTypeId");
+            if (UtilValidate.isEmpty(mimeTypeId)) {
+                mimeTypeId = "text/html";
+            }
+    
+            if (dataResourceTypeId.equals("SHORT_TEXT")) {
+                String text = dataResource.getString("objectInfo");
+                os.write(text.getBytes());
+            } else if (dataResourceTypeId.equals("ELECTRONIC_TEXT")) {
+                GenericValue electronicText = delegator.findByPrimaryKeyCache("ElectronicText", UtilMisc.toMap("dataResourceId", dataResourceId));
+                if (electronicText != null) {
+                    String text = electronicText.getString("textData");
+                    if (text != null) os.write(text.getBytes());
+                }
+            } else if (dataResourceTypeId.equals("IMAGE_OBJECT")) {
+                byte[] imageBytes = acquireImage(delegator, dataResource);
+                if (imageBytes != null) os.write(imageBytes);
+            } else if (dataResourceTypeId.equals("LINK")) {
+                String text = dataResource.getString("objectInfo");
+                os.write(text.getBytes());
+            } else if (dataResourceTypeId.equals("URL_RESOURCE")) {
+                URL url = new URL(dataResource.getString("objectInfo"));
+                if (url.getHost() == null) { // is relative
+                    String prefix = buildRequestPrefix(delegator, locale, webSiteId, https);
+                    String sep = "";
+                    //String s = "";
+                    if (url.toString().indexOf("/") != 0 && prefix.lastIndexOf("/") != (prefix.length() - 1)) {
+                        sep = "/";
+                    }
+                    String s2 = prefix + sep + url.toString();
+                    url = new URL(s2);
+                }
                 InputStream in = url.openStream();
                 int c;
                 while ((c = in.read()) != -1) {
                     os.write(c);
                 }
-        } else if (dataResourceTypeId.indexOf("_FILE") >= 0) {
-            String objectInfo = dataResource.getString("objectInfo");
-            File inputFile = getContentFile(dataResourceTypeId, objectInfo, rootDir);
-     //long fileSize = inputFile.length();
-     FileInputStream fis = new FileInputStream(inputFile);
-     int c;
-     while ((c = fis.read()) != -1) {
-     os.write(c);
-     }
-        } else {
-            throw new GeneralException("The dataResourceTypeId [" + dataResourceTypeId + "] is not supported in streamDataResource");
-        }
-     } catch(GenericEntityException e) {
+            } else if (dataResourceTypeId.indexOf("_FILE") >= 0) {
+                String objectInfo = dataResource.getString("objectInfo");
+                File inputFile = getContentFile(dataResourceTypeId, objectInfo, rootDir);
+                //long fileSize = inputFile.length();
+                FileInputStream fis = new FileInputStream(inputFile);
+                int c;
+                while ((c = fis.read()) != -1) {
+                    os.write(c);
+                }
+            } else {
+                throw new GeneralException("The dataResourceTypeId [" + dataResourceTypeId + "] is not supported in streamDataResource");
+            }
+        } catch(GenericEntityException e) {
             throw new GeneralException("Error in streamDataResource", e);
-     }
+        }
     }
     
     public static ByteWrapper getContentAsByteWrapper(GenericDelegator delegator, String dataResourceId, String https, String webSiteId, Locale locale, String rootDir) throws IOException, GeneralException {
-     ByteArrayOutputStream baos = new ByteArrayOutputStream();
-     streamDataResource(baos, delegator, dataResourceId, https, webSiteId, locale, rootDir);
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        streamDataResource(baos, delegator, dataResourceId, https, webSiteId, locale, rootDir);
         ByteWrapper byteWrapper = new ByteWrapper(baos.toByteArray());
         return byteWrapper;
     }

Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataServices.java?view=diff&rev=501715&r1=501714&r2=501715
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataServices.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataServices.java Tue Jan 30 19:47:19 2007
@@ -250,19 +250,19 @@
      * A top-level service for updating a DataResource and ElectronicText together.
      */
     public static Map updateDataResourceAndText(DispatchContext dctx, Map context) {
-   Map thisResult = updateDataResourceMethod(dctx, context);
-   if (thisResult.get(ModelService.RESPONSE_MESSAGE) != null) {
-       return ServiceUtil.returnError((String) thisResult.get(ModelService.ERROR_MESSAGE));
-   }
+        Map thisResult = updateDataResourceMethod(dctx, context);
+        if (thisResult.get(ModelService.RESPONSE_MESSAGE) != null) {
+            return ServiceUtil.returnError((String) thisResult.get(ModelService.ERROR_MESSAGE));
+        }
         String dataResourceTypeId = (String) context.get("dataResourceTypeId");
         if (dataResourceTypeId != null && dataResourceTypeId.equals("ELECTRONIC_TEXT")) {
-       thisResult = updateElectronicText(dctx, context);
-       if (thisResult.get(ModelService.RESPONSE_MESSAGE) != null) {
-           return ServiceUtil.returnError((String) thisResult.get(ModelService.ERROR_MESSAGE));
-       }
-   }
-     return ServiceUtil.returnSuccess();
- }
+            thisResult = updateElectronicText(dctx, context);
+            if (thisResult.get(ModelService.RESPONSE_MESSAGE) != null) {
+                return ServiceUtil.returnError((String) thisResult.get(ModelService.ERROR_MESSAGE));
+            }
+        }
+        return ServiceUtil.returnSuccess();
+    }
 
 
 
@@ -345,13 +345,13 @@
                 try {
                     electronicText = delegator.findByPrimaryKey("ElectronicText", UtilMisc.toMap("dataResourceId", dataResourceId));
                     if (electronicText != null) {
-                     electronicText.put("textData", textData);
-                     electronicText.store();
+                        electronicText.put("textData", textData);
+                        electronicText.store();
                     } else {
-                     electronicText = delegator.makeValue("ElectronicText", null);
-                     electronicText.put("dataResourceId", dataResourceId);
-                     electronicText.put("textData", textData);
-                     electronicText.create();
+                            electronicText = delegator.makeValue("ElectronicText", null);
+                            electronicText.put("dataResourceId", dataResourceId);
+                            electronicText.put("textData", textData);
+                            electronicText.create();
                     }
                 } catch (GenericEntityException e) {
                     Debug.logWarning(e, module);
@@ -504,10 +504,10 @@
                     if (Debug.infoOn()) Debug.logInfo("imageDataResource(U):" + imageDataResource, module);
                     if (Debug.infoOn()) Debug.logInfo("imageBytes(U):" + imageBytes, module);
                     if (imageDataResource == null) {
-                     return createImageMethod(dctx, context);
+                        return createImageMethod(dctx, context);
                     } else {
                         imageDataResource.setBytes("imageData", imageBytes);
-                     imageDataResource.store();
+                        imageDataResource.store();
                     }
                 } catch (GenericEntityException e) {
                     return ServiceUtil.returnError(e.getMessage());

Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/layout/LayoutWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/layout/LayoutWorker.java?view=diff&rev=501715&r1=501714&r2=501715
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/layout/LayoutWorker.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/layout/LayoutWorker.java Tue Jan 30 19:47:19 2007
@@ -76,9 +76,9 @@
         FileItem imageFi = null;
         for (int i=0; i < lst.size(); i++) {
             fi = (FileItem)lst.get(i);
-    String fn = fi.getName();
-    String fieldName = fi.getFieldName();
-    String fieldStr = fi.getString();
+            String fn = fi.getName();
+            String fieldName = fi.getFieldName();
+            String fieldStr = fi.getString();
             if (fi.isFormField()) {
                 formInput.put(fieldName, fieldStr);
             //Debug.logVerbose("in uploadAndStoreImage, fieldName:" + fieldName + " fieldStr:" + fieldStr, "");