Author: mrisaliti
Date: Sun Jan 23 20:53:29 2011
New Revision: 1062528
URL: http://svn.apache.org/viewvc?rev=1062528&view=rev
Log:
Remove some java compilation warnings of EditRenderSubContentCacheTransform
(OFBIZ-4102)
Modified:
ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/EditRenderSubContentCacheTransform.java
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=1062528&r1=1062527&r2=1062528&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
Sun Jan 23 20:53:29 2011
@@ -32,6 +32,7 @@ import javolution.util.FastMap;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.GeneralException;
+import org.ofbiz.base.util.UtilGenerics;
import org.ofbiz.base.util.UtilMisc;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.base.util.template.FreeMarkerWorker;
@@ -67,7 +68,7 @@ public class EditRenderSubContentCacheTr
* @deprecated use FreeMarkerWorker.getArg()
*/
@Deprecated
- public static String getArg(Map args, String key, Environment env) {
+ public static String getArg(Map<String, ? extends Object> args, String
key, Environment env) {
return FreeMarkerWorker.getArg(args, key, env);
}
@@ -75,21 +76,21 @@ public class EditRenderSubContentCacheTr
* @deprecated use FreeMarkerWorker.getArg()
*/
@Deprecated
- public static String getArg(Map args, String key, Map ctx) {
+ public static String getArg(Map<String, ? extends Object> args, String
key, Map<String, ? extends Object> ctx) {
return FreeMarkerWorker.getArg(args, key, ctx);
}
public Writer getWriter(final Writer out, Map args) {
final StringBuilder buf = new StringBuilder();
final Environment env = Environment.getCurrentEnvironment();
- final Map templateCtx = FreeMarkerWorker.getWrappedObject("context",
env);
+ final Map<String, Object> templateCtx =
FreeMarkerWorker.getWrappedObject("context", env);
final LocalDispatcher dispatcher =
FreeMarkerWorker.getWrappedObject("dispatcher", env);
final Delegator delegator =
FreeMarkerWorker.getWrappedObject("delegator", env);
final HttpServletRequest request =
FreeMarkerWorker.getWrappedObject("request", env);
FreeMarkerWorker.getSiteParameters(request, templateCtx);
FreeMarkerWorker.overrideWithArgs(templateCtx, args);
final GenericValue userLogin =
FreeMarkerWorker.getWrappedObject("userLogin", env);
- List trail = (List)templateCtx.get("globalNodeTrail");
+ List<Map<String, ? extends Object>> trail =
UtilGenerics.checkList(templateCtx.get("globalNodeTrail"));
String contentAssocPredicateId =
(String)templateCtx.get("contentAssocPredicateId");
String strNullThruDatesOnly =
(String)templateCtx.get("nullThruDatesOnly");
Boolean nullThruDatesOnly = (strNullThruDatesOnly != null &&
strNullThruDatesOnly.equalsIgnoreCase("true")) ? Boolean.TRUE :Boolean.FALSE;
@@ -127,7 +128,7 @@ public class EditRenderSubContentCacheTr
templateCtx.put("dataResourceId", dataResourceId);
templateCtx.put("subContentIdSub", subContentIdSub);
templateCtx.put("subDataResourceTypeId", subDataResourceTypeId);
- final Map savedValues = FastMap.newInstance();
+ final Map<String, Object> savedValues = FastMap.newInstance();
FreeMarkerWorker.saveContextValues(templateCtx, saveKeyNames,
savedValues);
return new Writer(out) {
@@ -146,47 +147,47 @@ public class EditRenderSubContentCacheTr
public void close() throws IOException {
FreeMarkerWorker.reloadValues(templateCtx, savedValues, env);
String wrappedContent = buf.toString();
- String editTemplate = (String)templateCtx.get("editTemplate");
-// if (editTemplate != null &&
editTemplate.equalsIgnoreCase("true")) {
- String wrapTemplateId =
(String)templateCtx.get("wrapTemplateId");
- if (UtilValidate.isNotEmpty(wrapTemplateId)) {
- templateCtx.put("wrappedContent", wrappedContent);
+ // String editTemplate =
(String)templateCtx.get("editTemplate");
+ // if (editTemplate != null &&
editTemplate.equalsIgnoreCase("true")) {
+ 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");
+ Map<String, Object> templateRoot = null;
+ Map<String, Object> templateRootTemplate =
UtilGenerics.checkMap(templateCtx.get("templateRootTemplate"));
if (templateRootTemplate == null) {
- Map templateRootTmp =
FreeMarkerWorker.createEnvironmentMap(env);
+ Map<String, Object> templateRootTmp =
FreeMarkerWorker.createEnvironmentMap(env);
templateRoot =
UtilMisc.makeMapWritable(templateRootTmp);
templateCtx.put("templateRootTemplate",
templateRootTmp);
} else {
templateRoot =
UtilMisc.makeMapWritable(templateRootTemplate);
}
- templateRoot.put("context", templateCtx);
- if (Debug.verboseOn()) {
- Set kySet = templateCtx.keySet();
- Iterator it = kySet.iterator();
- while (it.hasNext()) {
- Object ky = it.next();
- Object val = templateCtx.get(ky);
- }
- }
-
- String mimeTypeId =
(String)templateCtx.get("mimeTypeId");
- Locale locale = null;
- try {
- //if (Debug.infoOn()) Debug.logInfo("in Edit(0),
before calling renderContentAsTextCache, wrapTemplateId: ." + wrapTemplateId ,
module);
- ContentWorker.renderContentAsText(dispatcher,
delegator, wrapTemplateId, out, templateRoot, locale, mimeTypeId, null, null,
true);
- //if (Debug.infoOn()) Debug.logInfo("in Edit(0),
after calling renderContentAsTextCache, wrapTemplateId: ." + wrapTemplateId ,
module);
- } catch (IOException e) {
- Debug.logError(e, "Error rendering content" +
e.getMessage(), module);
- throw new IOException("Error rendering content" +
e.toString());
- } catch (GeneralException e2) {
- Debug.logError(e2, "Error rendering content" +
e2.getMessage(), module);
- throw new IOException("Error rendering content" +
e2.toString());
+ templateRoot.put("context", templateCtx);
+ if (Debug.verboseOn()) {
+ Set<String> kySet = templateCtx.keySet();
+ Iterator<String> it = kySet.iterator();
+ while (it.hasNext()) {
+ Object ky = (Object)it.next();
+ Object val = templateCtx.get(ky);
+ Debug.logVerbose("context key: " + ky + " val: " +
val, module);
}
+ }
+ String mimeTypeId = (String)templateCtx.get("mimeTypeId");
+ Locale locale = null;
+ try {
+ //if (Debug.infoOn()) Debug.logInfo("in Edit(0),
before calling renderContentAsTextCache, wrapTemplateId: ." + wrapTemplateId ,
module);
+ ContentWorker.renderContentAsText(dispatcher,
delegator, wrapTemplateId, out, templateRoot, locale, mimeTypeId, null, null,
true);
+ //if (Debug.infoOn()) Debug.logInfo("in Edit(0), after
calling renderContentAsTextCache, wrapTemplateId: ." + wrapTemplateId , module);
+ } catch (IOException e) {
+ Debug.logError(e, "Error rendering content" +
e.getMessage(), module);
+ throw new IOException("Error rendering content" +
e.toString());
+ } catch (GeneralException e2) {
+ Debug.logError(e2, "Error rendering content" +
e2.getMessage(), module);
+ throw new IOException("Error rendering content" +
e2.toString());
+ }
} else {
out.write(wrappedContent);
}