You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jo...@apache.org on 2007/03/09 23:44:26 UTC
svn commit: r516593 -
/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentMapFacade.java
Author: jonesde
Date: Fri Mar 9 14:44:25 2007
New Revision: 516593
URL: http://svn.apache.org/viewvc?view=rev&rev=516593
Log:
Added toString method that renders the content, ie default behavior when printed or treated as a String
Modified:
ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentMapFacade.java
Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentMapFacade.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentMapFacade.java?view=diff&rev=516593&r1=516592&r2=516593
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentMapFacade.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentMapFacade.java Fri Mar 9 14:44:25 2007
@@ -212,29 +212,36 @@
// render this content
if ("render".equalsIgnoreCase(name)) {
- Map renderCtx = FastMap.newInstance();
- renderCtx.putAll(context);
- if (!render) {
- String errorMsg = "WARNING: Cannot render content being rendered! (Infinite Recursion NOT allowed!)";
- Debug.logWarning(errorMsg, module);
- return "=========> " + errorMsg + " <=========";
- }
- try {
- return ContentWorker.renderContentAsText(dispatcher, delegator, contentId, renderCtx, locale, mimeType, cache);
- } catch (GeneralException e) {
- Debug.logError(e, module);
- return e.toString();
- } catch (IOException e) {
- Debug.logError(e, module);
- return e.toString();
- }
+ return this.renderThis();
}
return null;
}
+
+ protected String renderThis() {
+ Map renderCtx = FastMap.newInstance();
+ renderCtx.putAll(context);
+ if (!render) {
+ String errorMsg = "WARNING: Cannot render content being rendered! (Infinite Recursion NOT allowed!)";
+ Debug.logWarning(errorMsg, module);
+ return "=========> " + errorMsg + " <=========";
+ }
+ try {
+ return ContentWorker.renderContentAsText(dispatcher, delegator, contentId, renderCtx, locale, mimeType, cache);
+ } catch (GeneralException e) {
+ Debug.logError(e, module);
+ return e.toString();
+ } catch (IOException e) {
+ Debug.logError(e, module);
+ return e.toString();
+ }
+ }
- abstract class AbstractInfo implements Map {
+ public String toString() {
+ return this.renderThis();
+ }
+ abstract class AbstractInfo implements Map {
public int size() {
return 0;
}
@@ -286,7 +293,6 @@
Debug.logWarning("This method [entrySet()] is not implemented in ContentMapFacade.AbstractInfo", module);
return null;
}
-
}
class Content extends AbstractInfo {