svn commit: r1065124 - in /ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl: RenderSubContentCacheTransform.java RenderSubContentTransform.java

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

svn commit: r1065124 - in /ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl: RenderSubContentCacheTransform.java RenderSubContentTransform.java

mrisaliti
Author: mrisaliti
Date: Sat Jan 29 22:08:50 2011
New Revision: 1065124

URL: http://svn.apache.org/viewvc?rev=1065124&view=rev
Log:
Remove some java compilation warnings of RenderSubContentCacheTransform/RenderSubContentTransform(OFBIZ-4102)

Modified:
    ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/RenderSubContentCacheTransform.java
    ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/RenderSubContentTransform.java

Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/RenderSubContentCacheTransform.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/RenderSubContentCacheTransform.java?rev=1065124&r1=1065123&r2=1065124&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/RenderSubContentCacheTransform.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/RenderSubContentCacheTransform.java Sat Jan 29 22:08:50 2011
@@ -20,7 +20,6 @@ package org.ofbiz.content.webapp.ftl;
 
 import java.io.IOException;
 import java.io.Writer;
-import java.sql.Timestamp;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
@@ -33,7 +32,7 @@ import javolution.util.FastMap;
 
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.GeneralException;
-import org.ofbiz.base.util.UtilDateTime;
+import org.ofbiz.base.util.UtilGenerics;
 import org.ofbiz.base.util.UtilProperties;
 import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.base.util.template.FreeMarkerWorker;
@@ -58,7 +57,7 @@ public class RenderSubContentCacheTransf
     public static final String [] saveKeyNames = {"contentId", "subContentId", "subDataResourceTypeId", "mimeTypeId", "whenMap", "locale",  "wrapTemplateId", "encloseWrapText", "nullThruDatesOnly", "globalNodeTrail"};
 
     public Writer getWriter(final Writer out, Map args) {
-        final StringBuilder buf = new StringBuilder();
+        // final StringBuilder buf = new StringBuilder();
         final Environment env = Environment.getCurrentEnvironment();
         //final Map templateCtx = FreeMarkerWorker.getWrappedObject("context", env);
         //final Map templateCtx = FastMap.newInstance();
@@ -66,15 +65,15 @@ public class RenderSubContentCacheTransf
         final Delegator delegator = FreeMarkerWorker.getWrappedObject("delegator", env);
         final HttpServletRequest request = FreeMarkerWorker.getWrappedObject("request", env);
         final HttpServletResponse response = FreeMarkerWorker.getWrappedObject("response", env);
-        final Map templateRoot = FreeMarkerWorker.createEnvironmentMap(env);
+        final Map<String, Object> templateRoot = FreeMarkerWorker.createEnvironmentMap(env);
         //if (Debug.infoOn()) Debug.logInfo("in RenderSubContent, contentId(0):" + templateRoot.get("contentId"), module);
         FreeMarkerWorker.getSiteParameters(request, templateRoot);
-        final Map savedValuesUp = FastMap.newInstance();
+        final Map<String, Object> savedValuesUp = FastMap.newInstance();
         FreeMarkerWorker.saveContextValues(templateRoot, upSaveKeyNames, savedValuesUp);
         FreeMarkerWorker.overrideWithArgs(templateRoot, args);
         //if (Debug.infoOn()) Debug.logInfo("in RenderSubContent, contentId(2):" + templateRoot.get("contentId"), module);
         final GenericValue userLogin = FreeMarkerWorker.getWrappedObject("userLogin", env);
-        List trail = (List)templateRoot.get("globalNodeTrail");
+        List<Map<String, ? extends Object>> trail = UtilGenerics.checkList(templateRoot.get("globalNodeTrail"));
         //if (Debug.infoOn()) Debug.logInfo("in Render(0), globalNodeTrail ." + trail , module);
         String contentAssocPredicateId = (String)templateRoot.get("contentAssocPredicateId");
         String strNullThruDatesOnly = (String)templateRoot.get("nullThruDatesOnly");
@@ -136,32 +135,34 @@ public class RenderSubContentCacheTransf
 
             @Override
             public void close() throws IOException {
-                List globalNodeTrail = (List)templateRoot.get("globalNodeTrail");
-                //if (Debug.infoOn()) Debug.logInfo("Render close, globalNodeTrail(2a):" + FreeMarkerWorker.nodeTrailToCsv(globalNodeTrail), "");
+                // List<Map<String, ? extends Object>> globalNodeTrail = UtilGenerics.checkList(templateRoot.get("globalNodeTrail"));
+                // if (Debug.infoOn()) Debug.logInfo("Render close, globalNodeTrail(2a):" + FreeMarkerWorker.nodeTrailToCsv(globalNodeTrail), "");
                 try {
                     renderSubContent();
-                FreeMarkerWorker.reloadValues(templateRoot, savedValuesUp, env);
-                 //if (Debug.infoOn()) Debug.logInfo("in Render(2), globalNodeTrail ." + getWrapped(env, "globalNodeTrail") , module);
+                    FreeMarkerWorker.reloadValues(templateRoot, savedValuesUp, env);
+                    //if (Debug.infoOn()) Debug.logInfo("in Render(2), globalNodeTrail ." + getWrapped(env, "globalNodeTrail") , module);
                 } catch (IOException e) {
                     throw new IOException(e.getMessage());
                 }
             }
 
             public void renderSubContent() throws IOException {
-
-                //TemplateHashModel dataRoot = env.getDataModel();
-                Timestamp fromDate = UtilDateTime.nowTimestamp();
-                List passedGlobalNodeTrail = (List)templateRoot.get("globalNodeTrail");
+                // TemplateHashModel dataRoot = env.getDataModel();
+                // Timestamp fromDate = UtilDateTime.nowTimestamp();
+                List<Map<String, ? extends Object>> passedGlobalNodeTrail = UtilGenerics.checkList(templateRoot.get("globalNodeTrail"));
                 String editRequestName = (String)templateRoot.get("editRequestName");
                 //if (Debug.infoOn()) Debug.logInfo("in Render(3), editRequestName ." + editRequestName , module);
                 GenericValue thisView = null;
                 if (view != null) {
                     thisView = view;
                 } else if (passedGlobalNodeTrail.size() > 0) {
-                    Map map = (Map)passedGlobalNodeTrail.get(passedGlobalNodeTrail.size() - 1);
-                    if (Debug.infoOn()) Debug.logInfo("in Render(3), map ." + map , module);
-                    if (map != null)
+                    Map<String, ? extends Object> map = UtilGenerics.checkMap(passedGlobalNodeTrail.get(passedGlobalNodeTrail.size() - 1));
+                    if (Debug.infoOn()) {
+                        Debug.logInfo("in Render(3), map ." + map , module);
+                    }
+                    if (map != null) {
                         thisView = (GenericValue)map.get("value");
+                    }
                 }
                 //if (Debug.infoOn()) Debug.logInfo("in RenderSubContent, subContentId:" + templateRoot.get("subContentId"), module);
                 //if (Debug.infoOn()) Debug.logInfo("in RenderSubContent, contentId:" + templateRoot.get("contentId"), module);
@@ -201,9 +202,9 @@ public class RenderSubContentCacheTransf
             }
 
             public void closeEditWrap(Writer out, String editRequestName) throws IOException {
-                //if (Debug.infoOn()) Debug.logInfo("in RenderSubContent, contentId(1):" + templateRoot.get("contentId"), module);
-                //if (Debug.infoOn()) Debug.logInfo("in Render(0), templateRoot ." + templateRoot , module);
-                StringBuilder sb = new StringBuilder();
+                // if (Debug.infoOn()) Debug.logInfo("in RenderSubContent, contentId(1):" + templateRoot.get("contentId"), module);
+                // if (Debug.infoOn()) Debug.logInfo("in Render(0), templateRoot ." + templateRoot , module);
+                // StringBuilder sb = new StringBuilder();
                 String fullRequest = editRequestName;
                 String contentId = null;
                 String contentIdTo = null;

Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/RenderSubContentTransform.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/RenderSubContentTransform.java?rev=1065124&r1=1065123&r2=1065124&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/RenderSubContentTransform.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/RenderSubContentTransform.java Sat Jan 29 22:08:50 2011
@@ -60,7 +60,7 @@ public class RenderSubContentTransform i
      * object.
      */
     @Deprecated
-    public static String getArg(Map args, String key, Environment env) {
+    public static String getArg(Map<String, Object> args, String key, Environment env) {
         return FreeMarkerWorker.getArg(args, key, env);
     }
 
@@ -68,20 +68,20 @@ public class RenderSubContentTransform i
      * @deprecated use FreeMarkerWorker.getArg()
      */
     @Deprecated
-    public static String getArg(Map args, String key, Map ctx) {
+    public static String getArg(Map<String, Object> args, String key, Map<String, Object> ctx) {
         return FreeMarkerWorker.getArg(args, key, ctx);
     }
 
     public Writer getWriter(final Writer out, Map args) {
-        //final StringBuilder buf = new StringBuilder();
+        // final StringBuilder buf = new StringBuilder();
         final Environment env = Environment.getCurrentEnvironment();
-        Map ctx = FreeMarkerWorker.getWrappedObject("context", env);
+        Map<String, Object> ctx = FreeMarkerWorker.getWrappedObject("context", env);
         if (ctx == null) {
             ctx = FastMap.newInstance();
         }
         final String mapKey = FreeMarkerWorker.getArg(args, "mapKey", ctx);
         final String subContentId = FreeMarkerWorker.getArg(args, "subContentId", ctx);
-        final String subDataResourceTypeId = FreeMarkerWorker.getArg(args, "subDataResourceTypeId", ctx);
+        // final String subDataResourceTypeId = FreeMarkerWorker.getArg(args, "subDataResourceTypeId", ctx);
         final String contentId = FreeMarkerWorker.getArg(args, "contentId", ctx);
         final String mimeTypeId = FreeMarkerWorker.getArg(args, "mimeTypeId", ctx);
         final String throwExceptionOnError = FreeMarkerWorker.getArg(args, "throwExceptionOnError", ctx);
@@ -92,7 +92,7 @@ public class RenderSubContentTransform i
         final GenericValue userLogin = FreeMarkerWorker.getWrappedObject("userLogin", env);
         GenericValue subContentDataResourceViewTemp = FreeMarkerWorker.getWrappedObject("subContentDataResourceView", env);
         if (subContentDataResourceViewTemp == null) {
-            List assocTypes = UtilMisc.toList("SUB_CONTENT");
+            List<String> assocTypes = UtilMisc.toList("SUB_CONTENT");
             Timestamp fromDate = UtilDateTime.nowTimestamp();
             try {
                 subContentDataResourceViewTemp = ContentWorker.getSubContent(delegator, contentId, mapKey, subContentId, userLogin, assocTypes, fromDate);
@@ -104,7 +104,7 @@ public class RenderSubContentTransform i
         final GenericValue subContentDataResourceView = subContentDataResourceViewTemp;
 
 
-        final Map templateContext = ctx;
+        final Map<String, Object> templateContext = ctx;
 
         return new Writer(out) {
 
@@ -129,8 +129,8 @@ public class RenderSubContentTransform i
             }
 
             public void renderSubContent() throws IOException {
-                //TemplateHashModel dataRoot = env.getDataModel();
-                Timestamp fromDate = UtilDateTime.nowTimestamp();
+                // TemplateHashModel dataRoot = env.getDataModel();
+                // Timestamp fromDate = UtilDateTime.nowTimestamp();
                 ServletContext servletContext = request.getSession().getServletContext();
                 String rootDir = servletContext.getRealPath("/");
                 String webSiteId = (String) servletContext.getAttribute("webSiteId");
@@ -139,7 +139,7 @@ public class RenderSubContentTransform i
                 templateContext.put("https", https);
                 templateContext.put("rootDir", rootDir);
 
-                Map templateRoot = FreeMarkerWorker.createEnvironmentMap(env);
+                Map<String, Object> templateRoot = FreeMarkerWorker.createEnvironmentMap(env);
 
                 templateRoot.put("context", templateContext);
                 if (subContentDataResourceView != null) {
@@ -155,7 +155,6 @@ public class RenderSubContentTransform i
                     Debug.logError(e, "Error rendering content", module);
                     throw new IOException("Error rendering content" + e.toString());
                 }
-
                 //Map resultCtx = FreeMarkerWorker.getWrappedObject("context", env);
                 templateContext.put("mapKey", null);
                 templateContext.put("subContentId", null);
@@ -163,9 +162,7 @@ public class RenderSubContentTransform i
                 templateContext.put("contentId", contentId);
                 templateContext.put("mimeTypeId", null);
                 templateContext.put("locale", locale);
-
             }
         };
     }
-
 }