Author: jacopoc
Date: Thu Aug 6 16:08:03 2009 New Revision: 801691 URL: http://svn.apache.org/viewvc?rev=801691&view=rev Log: Added ability to define 'alternate content' for different party roles, in a similar way that alternate contents can be defined for different locales. Modified: ofbiz/trunk/applications/content/data/ContentTypeData.xml ofbiz/trunk/applications/content/src/org/ofbiz/content/cms/CmsEvents.java 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/webapp/ftl/EditRenderSubContentCacheTransform.java ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/EditRenderSubContentTransform.java ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/LoopSubContentTransform.java ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/RenderContentAndSubContent.java ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/RenderSubContentCacheTransform.java ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/RenderSubContentTransform.java ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/TraverseSubContentTransform.java ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/WrapSubContentCacheTransform.java ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderContentWrapper.java ofbiz/trunk/applications/party/src/org/ofbiz/party/content/PartyContentWrapper.java ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryContentWrapper.java ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigItemContentWrapper.java ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductContentWrapper.java ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java Modified: ofbiz/trunk/applications/content/data/ContentTypeData.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/data/ContentTypeData.xml?rev=801691&r1=801690&r2=801691&view=diff ============================================================================== --- ofbiz/trunk/applications/content/data/ContentTypeData.xml (original) +++ ofbiz/trunk/applications/content/data/ContentTypeData.xml Thu Aug 6 16:08:03 2009 @@ -34,6 +34,7 @@ <ContentAssocType contentAssocTypeId="TREE_CHILD" description="Tree Child"/> <ContentAssocType contentAssocTypeId="GRAPH_LINK" description="Graph Link"/> <ContentAssocType contentAssocTypeId="ALTERNATE_LOCALE" description="Alternate Locale"/> + <ContentAssocType contentAssocTypeId="ALTERNATE_ROLE" description="Alternate Role"/> <ContentAssocType contentAssocTypeId="RESPONSE" description="Response"/> <ContentAssocType contentAssocTypeId="SUB_CONTENT" description="Sub-Content"/> <ContentAssocType contentAssocTypeId="TOPIC" description="Topic"/> Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/cms/CmsEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/cms/CmsEvents.java?rev=801691&r1=801690&r2=801691&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/cms/CmsEvents.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/cms/CmsEvents.java Thu Aug 6 16:08:03 2009 @@ -222,7 +222,7 @@ // render if (UtilValidate.isEmpty(mapKey)) { - ContentWorker.renderContentAsText(dispatcher, delegator, contentId, writer, templateMap, locale, "text/html", true); + ContentWorker.renderContentAsText(dispatcher, delegator, contentId, writer, templateMap, locale, "text/html", null, null, true); } else { ContentWorker.renderSubContentAsText(dispatcher, delegator, contentId, writer, mapKey, templateMap, locale, "text/html", true); } 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?rev=801691&r1=801690&r2=801691&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServices.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServices.java Thu Aug 6 16:08:03 2009 @@ -946,7 +946,7 @@ } try { - ContentWorker.renderContentAsText(dispatcher, delegator, contentId, outWriter, templateContext, locale, mimeTypeId, true); + ContentWorker.renderContentAsText(dispatcher, delegator, contentId, outWriter, templateContext, locale, mimeTypeId, null, null, true); if (out != null) out.write(outWriter.toString()); results.put("textData", outWriter.toString()); } catch (GeneralException e) { 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?rev=801691&r1=801690&r2=801691&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java Thu Aug 6 16:08:03 2009 @@ -91,7 +91,7 @@ // new rendering methods public void renderContentAsTextExt(LocalDispatcher dispatcher, GenericDelegator delegator, String contentId, Appendable out, Map templateContext, Locale locale, String mimeTypeId, boolean cache) throws GeneralException, IOException { - renderContentAsText(dispatcher, delegator, contentId, out, templateContext, locale, mimeTypeId, cache); + renderContentAsText(dispatcher, delegator, contentId, out, templateContext, locale, mimeTypeId, null, null, cache); } public void renderSubContentAsTextExt(LocalDispatcher dispatcher, GenericDelegator delegator, String contentId, Appendable out, String mapKey, Map templateContext, Locale locale, String mimeTypeId, boolean cache) throws GeneralException, IOException { @@ -109,20 +109,11 @@ // ------------------------------------- // Content rendering methods // ------------------------------------- - - public static String renderContentAsText(LocalDispatcher dispatcher, GenericDelegator delegator, String contentId, Map templateContext, - Locale locale, String mimeTypeId, boolean cache) throws GeneralException, IOException { - Writer writer = new StringWriter(); - renderContentAsText(dispatcher, delegator, contentId, writer, templateContext, locale, mimeTypeId, cache); - return writer.toString(); - } - - public static void renderContentAsText(LocalDispatcher dispatcher, GenericDelegator delegator, String contentId, Appendable out, - Map templateContext, Locale locale, String mimeTypeId, boolean cache) throws GeneralException, IOException { + public static GenericValue findContentForRendering(GenericDelegator delegator, String contentId, Locale locale, String partyId, String roleTypeId, boolean cache) throws GeneralException, IOException { GenericValue content; if (UtilValidate.isEmpty(contentId)) { Debug.logError("No content ID found.", module); - return; + return null; } if (cache) { content = delegator.findByPrimaryKeyCache("Content", UtilMisc.toMap("contentId", contentId)); @@ -163,6 +154,35 @@ } } + // check for alternate content per party + if (partyId != null && roleTypeId != null) { + List alternateViews = null; + try { + alternateViews = content.getRelated("ContentAssocDataResourceViewTo", UtilMisc.toMap("caContentAssocTypeId", "ALTERNATE_ROLE"), UtilMisc.toList("-caFromDate")); + } catch (GenericEntityException e) { + Debug.logError(e, "Error finding alternate content: " + e.toString(), module); + } + + alternateViews = EntityUtil.filterByDate(alternateViews, UtilDateTime.nowTimestamp(), "caFromDate", "caThruDate", true); + Iterator alternateViewIter = alternateViews.iterator(); + while (alternateViewIter.hasNext()) { + GenericValue thisView = (GenericValue) alternateViewIter.next(); + GenericValue altContentRole = EntityUtil.getFirst(EntityUtil.filterByDate(thisView.getRelatedByAnd("ContentRole", UtilMisc.toMap("partyId", partyId, "roleTypeId", roleTypeId)))); + GenericValue altContent = null; + if (UtilValidate.isNotEmpty(altContentRole)) { + altContent = altContentRole.getRelatedOne("Content"); + if (altContent != null) { + content = altContent; + } + } + } + } + return content; + } + + public static void renderContentAsText(LocalDispatcher dispatcher, GenericDelegator delegator, GenericValue content, Appendable out, + Map templateContext, Locale locale, String mimeTypeId, boolean cache) throws GeneralException, IOException { + // if the content has a service attached run the service String serviceName = content.getString("serviceName"); if (dispatcher != null && UtilValidate.isNotEmpty(serviceName)) { @@ -188,7 +208,7 @@ // get the data resource info String templateDataResourceId = content.getString("templateDataResourceId"); String dataResourceId = content.getString("dataResourceId"); - contentId = content.getString("contentId"); + String contentId = content.getString("contentId"); if (UtilValidate.isEmpty(dataResourceId)) { Debug.logError("No dataResourceId found.", module); return; @@ -223,7 +243,7 @@ facade.setIsDecorated(true); templateContext.put("decoratedContent", facade); // decorated content templateContext.put("thisContent", decFacade); // decorator content - ContentWorker.renderContentAsText(dispatcher, delegator, contentDecoratorId, out, templateContext, locale, mimeTypeId, cache); + ContentWorker.renderContentAsText(dispatcher, delegator, contentDecoratorId, out, templateContext, locale, mimeTypeId, null, null, cache); } else { // set this content facade in the context templateContext.put("thisContent", facade); @@ -281,6 +301,19 @@ } } + public static String renderContentAsText(LocalDispatcher dispatcher, GenericDelegator delegator, String contentId, Map templateContext, + Locale locale, String mimeTypeId, boolean cache) throws GeneralException, IOException { + Writer writer = new StringWriter(); + renderContentAsText(dispatcher, delegator, contentId, writer, templateContext, locale, mimeTypeId, null, null, cache); + return writer.toString(); + } + + public static void renderContentAsText(LocalDispatcher dispatcher, GenericDelegator delegator, String contentId, Appendable out, + Map templateContext, Locale locale, String mimeTypeId, String partyId, String roleTypeId, boolean cache) throws GeneralException, IOException { + GenericValue content = ContentWorker.findContentForRendering(delegator, contentId, locale, partyId, roleTypeId, cache); + ContentWorker.renderContentAsText(dispatcher, delegator, content, out, templateContext, locale, mimeTypeId, cache); + } + public static String renderSubContentAsText(LocalDispatcher dispatcher, GenericDelegator delegator, String contentId, String mapKey, Map templateContext, Locale locale, String mimeTypeId, boolean cache) throws GeneralException, IOException { Writer writer = new StringWriter(); @@ -309,7 +342,7 @@ } else { String subContentId = subContent.getString("contentIdTo"); templateContext.put("mapKey", mapKey); - renderContentAsText(dispatcher, delegator, subContentId, out, templateContext, locale, mimeTypeId, cache); + renderContentAsText(dispatcher, delegator, subContentId, out, templateContext, locale, mimeTypeId, null, null, cache); } } 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=801691&r1=801690&r2=801691&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 Thu Aug 6 16:08:03 2009 @@ -167,7 +167,7 @@ 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, true); + 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); Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/EditRenderSubContentTransform.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/EditRenderSubContentTransform.java?rev=801691&r1=801690&r2=801691&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/EditRenderSubContentTransform.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/EditRenderSubContentTransform.java Thu Aug 6 16:08:03 2009 @@ -194,7 +194,7 @@ templateRoot.put("context", templateContext); try { - ContentWorker.renderContentAsText(dispatcher, delegator, wrapTemplateId, out, templateRoot, locale, mimeTypeId, false); + ContentWorker.renderContentAsText(dispatcher, delegator, wrapTemplateId, out, templateRoot, locale, mimeTypeId, null, null, false); } catch (IOException e) { Debug.logError(e, "Error rendering content" + e.getMessage(), module); throw new IOException("Error rendering content" + e.toString()); Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/LoopSubContentTransform.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/LoopSubContentTransform.java?rev=801691&r1=801690&r2=801691&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/LoopSubContentTransform.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/LoopSubContentTransform.java Thu Aug 6 16:08:03 2009 @@ -233,7 +233,7 @@ if (locale == null) locale = Locale.getDefault(); String mimeTypeId = (String) templateCtx.get("mimeTypeId"); try { - ContentWorker.renderContentAsText(dispatcher, delegator, wrapTemplateId, out, templateRoot, locale, mimeTypeId, true); + ContentWorker.renderContentAsText(dispatcher, delegator, wrapTemplateId, out, templateRoot, locale, mimeTypeId, null, null, true); } catch (GeneralException e) { Debug.logError(e, "Error rendering content", module); throw new IOException("Error rendering content" + e.toString()); Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/RenderContentAndSubContent.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/RenderContentAndSubContent.java?rev=801691&r1=801690&r2=801691&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/RenderContentAndSubContent.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/RenderContentAndSubContent.java Thu Aug 6 16:08:03 2009 @@ -129,7 +129,7 @@ // contentId = null; // } } else if (contentId != null) { - ContentWorker.renderContentAsText(dispatcher, delegator, contentId, out, templateRoot, locale, mimeTypeId, true); + ContentWorker.renderContentAsText(dispatcher, delegator, contentId, out, templateRoot, locale, mimeTypeId, null, null, true); // ((MapStack)templateRoot).pop(); } //FreeMarkerWorker.reloadValues(templateRoot, savedValues, env); 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=801691&r1=801690&r2=801691&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 Thu Aug 6 16:08:03 2009 @@ -181,7 +181,7 @@ String contentId = thisView.getString("contentId"); if (contentId != null) { try { - ContentWorker.renderContentAsText(dispatcher, delegator, contentId, out, templateRoot, locale, mimeTypeId, true); + ContentWorker.renderContentAsText(dispatcher, delegator, contentId, out, templateRoot, locale, mimeTypeId, null, null, true); //if (Debug.infoOn()) Debug.logInfo("in RenderSubContent, after renderContentAsTextCache:", module); } catch (GeneralException e) { Debug.logError(e, "Error rendering content", module); 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=801691&r1=801690&r2=801691&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 Thu Aug 6 16:08:03 2009 @@ -140,7 +140,7 @@ } try { if (subContentId != null) { - ContentWorker.renderContentAsText(dispatcher, delegator, subContentId, out, templateRoot, locale, mimeTypeId, false); + ContentWorker.renderContentAsText(dispatcher, delegator, subContentId, out, templateRoot, locale, mimeTypeId, null, null, false); } else { ContentWorker.renderSubContentAsText(dispatcher, delegator, contentId, out, mapKey, templateRoot, locale, mimeTypeId, false); } Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/TraverseSubContentTransform.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/TraverseSubContentTransform.java?rev=801691&r1=801690&r2=801691&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/TraverseSubContentTransform.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/TraverseSubContentTransform.java Thu Aug 6 16:08:03 2009 @@ -256,7 +256,7 @@ if (locale == null) locale = Locale.getDefault(); try { - ContentWorker.renderContentAsText(dispatcher, delegator, wrapTemplateId, out, templateRoot, locale, mimeTypeId, true); + ContentWorker.renderContentAsText(dispatcher, delegator, wrapTemplateId, out, templateRoot, locale, mimeTypeId, null, null, true); } catch (GeneralException e) { Debug.logError(e, "Error rendering content", module); throw new IOException("Error rendering content" + e.toString()); Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/WrapSubContentCacheTransform.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/WrapSubContentCacheTransform.java?rev=801691&r1=801690&r2=801691&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/WrapSubContentCacheTransform.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/WrapSubContentCacheTransform.java Thu Aug 6 16:08:03 2009 @@ -176,7 +176,7 @@ Locale locale = null; try { //if (Debug.infoOn()) Debug.logInfo("in Edit(0), before calling renderContentAsText ." , module); - ContentWorker.renderContentAsText(dispatcher, delegator, wrapTemplateId, out, templateRoot, locale, mimeTypeId, true); + ContentWorker.renderContentAsText(dispatcher, delegator, wrapTemplateId, out, templateRoot, locale, mimeTypeId, null, null, true); //if (Debug.infoOn()) Debug.logInfo("in Edit(0), after calling renderContentAsText ." , module); } catch (IOException e) { Debug.logError(e, "Error rendering content" + e.getMessage(), module); Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderContentWrapper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderContentWrapper.java?rev=801691&r1=801690&r2=801691&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderContentWrapper.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderContentWrapper.java Thu Aug 6 16:08:03 2009 @@ -148,7 +148,7 @@ Map inContext = new HashMap(); inContext.put("order", order); inContext.put("orderContent", orderContent); - ContentWorker.renderContentAsText(dispatcher, delegator, orderContent.getString("contentId"), outWriter, inContext, locale, mimeTypeId, false); + ContentWorker.renderContentAsText(dispatcher, delegator, orderContent.getString("contentId"), outWriter, inContext, locale, mimeTypeId, null, null, false); } } } Modified: ofbiz/trunk/applications/party/src/org/ofbiz/party/content/PartyContentWrapper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/src/org/ofbiz/party/content/PartyContentWrapper.java?rev=801691&r1=801690&r2=801691&view=diff ============================================================================== --- ofbiz/trunk/applications/party/src/org/ofbiz/party/content/PartyContentWrapper.java (original) +++ ofbiz/trunk/applications/party/src/org/ofbiz/party/content/PartyContentWrapper.java Thu Aug 6 16:08:03 2009 @@ -226,7 +226,7 @@ Map<String, Object> inContext = FastMap.newInstance(); inContext.put("party", party); inContext.put("partyContent", partyContent); - ContentWorker.renderContentAsText(dispatcher, delegator, partyContent.getString("contentId"), outWriter, inContext, locale, mimeTypeId, false); + ContentWorker.renderContentAsText(dispatcher, delegator, partyContent.getString("contentId"), outWriter, inContext, locale, mimeTypeId, null, null, false); } } @@ -241,7 +241,7 @@ Map<String, Object> inContext = FastMap.newInstance(); inContext.put("party", party); inContext.put("partyContent", partyContent); - ContentWorker.renderContentAsText(dispatcher, delegator, partyContent.getString("contentId"), outWriter, inContext, locale, mimeTypeId, false); + ContentWorker.renderContentAsText(dispatcher, delegator, partyContent.getString("contentId"), outWriter, inContext, locale, mimeTypeId, null, null, false); contentList.add(outWriter.toString()); } } Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryContentWrapper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryContentWrapper.java?rev=801691&r1=801690&r2=801691&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryContentWrapper.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryContentWrapper.java Thu Aug 6 16:08:03 2009 @@ -148,7 +148,7 @@ Map<String, Object> inContext = FastMap.newInstance(); inContext.put("productCategory", productCategory); inContext.put("categoryContent", categoryContent); - ContentWorker.renderContentAsText(dispatcher, delegator, categoryContent.getString("contentId"), outWriter, inContext, locale, mimeTypeId, false); + ContentWorker.renderContentAsText(dispatcher, delegator, categoryContent.getString("contentId"), outWriter, inContext, locale, mimeTypeId, null, null, false); } } } Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigItemContentWrapper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigItemContentWrapper.java?rev=801691&r1=801690&r2=801691&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigItemContentWrapper.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigItemContentWrapper.java Thu Aug 6 16:08:03 2009 @@ -143,7 +143,7 @@ Map<String, Object> inContext = FastMap.newInstance(); inContext.put("productConfigItem", productConfigItem); inContext.put("productConfigItemContent", productConfigItemContent); - ContentWorker.renderContentAsText(dispatcher, delegator, productConfigItemContent.getString("contentId"), outWriter, inContext, locale, mimeTypeId, false); + ContentWorker.renderContentAsText(dispatcher, delegator, productConfigItemContent.getString("contentId"), outWriter, inContext, locale, mimeTypeId, null, null, false); } } } Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductContentWrapper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductContentWrapper.java?rev=801691&r1=801690&r2=801691&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductContentWrapper.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductContentWrapper.java Thu Aug 6 16:08:03 2009 @@ -84,19 +84,19 @@ Debug.logWarning("Tried to get ProductContent for type [" + productContentTypeId + "] but the product field in the ProductContentWrapper is null", module); return null; } - return StringUtil.makeStringWrapper(getProductContentAsText(this.product, productContentTypeId, locale, mimeTypeId, this.product.getDelegator(), dispatcher)); + return StringUtil.makeStringWrapper(getProductContentAsText(this.product, productContentTypeId, locale, mimeTypeId, null, null, this.product.getDelegator(), dispatcher)); } public static String getProductContentAsText(GenericValue product, String productContentTypeId, HttpServletRequest request) { LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); - return getProductContentAsText(product, productContentTypeId, UtilHttp.getLocale(request), "text/html", product.getDelegator(), dispatcher); + return getProductContentAsText(product, productContentTypeId, UtilHttp.getLocale(request), "text/html", null, null, product.getDelegator(), dispatcher); } public static String getProductContentAsText(GenericValue product, String productContentTypeId, Locale locale, LocalDispatcher dispatcher) { - return getProductContentAsText(product, productContentTypeId, locale, null, null, dispatcher); + return getProductContentAsText(product, productContentTypeId, locale, null, null, null, null, dispatcher); } - public static String getProductContentAsText(GenericValue product, String productContentTypeId, Locale locale, String mimeTypeId, GenericDelegator delegator, LocalDispatcher dispatcher) { + public static String getProductContentAsText(GenericValue product, String productContentTypeId, Locale locale, String mimeTypeId, String partyId, String roleTypeId, GenericDelegator delegator, LocalDispatcher dispatcher) { if (product == null) { return null; } @@ -112,7 +112,7 @@ } Writer outWriter = new StringWriter(); - getProductContentAsText(null, product, productContentTypeId, locale, mimeTypeId, delegator, dispatcher, outWriter); + getProductContentAsText(null, product, productContentTypeId, locale, mimeTypeId, partyId, roleTypeId, delegator, dispatcher, outWriter); String outString = outWriter.toString(); if (outString.length() > 0) { if (productContentCache != null) { @@ -134,7 +134,7 @@ } } - public static void getProductContentAsText(String productId, GenericValue product, String productContentTypeId, Locale locale, String mimeTypeId, GenericDelegator delegator, LocalDispatcher dispatcher, Writer outWriter) throws GeneralException, IOException { + public static void getProductContentAsText(String productId, GenericValue product, String productContentTypeId, Locale locale, String mimeTypeId, String partyId, String roleTypeId, GenericDelegator delegator, LocalDispatcher dispatcher, Writer outWriter) throws GeneralException, IOException { if (productId == null && product != null) { productId = product.getString("productId"); } @@ -184,7 +184,7 @@ Map<String, Object> inContext = FastMap.newInstance(); inContext.put("product", product); inContext.put("productContent", productContent); - ContentWorker.renderContentAsText(dispatcher, delegator, productContent.getString("contentId"), outWriter, inContext, locale, mimeTypeId, false); + ContentWorker.renderContentAsText(dispatcher, delegator, productContent.getString("contentId"), outWriter, inContext, locale, mimeTypeId, partyId, roleTypeId, false); } } } Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java?rev=801691&r1=801690&r2=801691&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java Thu Aug 6 16:08:03 2009 @@ -252,7 +252,7 @@ inContext.put("postalCode", shipToAddress.getString("postalCode")); } try { - ContentWorker.renderContentAsText(dispatcher, delegator, templateName, outWriter, inContext, locale, "text/plain", false); + ContentWorker.renderContentAsText(dispatcher, delegator, templateName, outWriter, inContext, locale, "text/plain", null, null, false); } catch (Exception e) { Debug.logError(e, "Cannot get DHL Estimate: Failed to render DHL XML Request.", module); return ServiceUtil.returnError("Cannot get DHL Estimate: Failed to render DHL XML Request."); @@ -735,7 +735,7 @@ inContext.put("notifyEmailAddress", recipientEmail); try { - ContentWorker.renderContentAsText(dispatcher, delegator, templateName, outWriter, inContext, locale, "text/plain", false); + ContentWorker.renderContentAsText(dispatcher, delegator, templateName, outWriter, inContext, locale, "text/plain", null, null, false); } catch (Exception e) { Debug.logError(e, "Cannot confirm DHL shipment: Failed to render DHL XML Request.", module); return ServiceUtil.returnError("Cannot confirm DHL shipment: Failed to render DHL XML Request."); Modified: ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java?rev=801691&r1=801690&r2=801691&view=diff ============================================================================== --- ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java (original) +++ ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java Thu Aug 6 16:08:03 2009 @@ -308,7 +308,7 @@ Map<String, Object> inContext = FastMap.newInstance(); inContext.put("workEffort", workEffort); inContext.put("workEffortContent", workEffortContent); - ContentWorker.renderContentAsText(dispatcher, delegator, workEffortContent.getString("contentId"), outWriter, inContext, locale, mimeTypeId, false); + ContentWorker.renderContentAsText(dispatcher, delegator, workEffortContent.getString("contentId"), outWriter, inContext, locale, mimeTypeId, null, null, false); } } @@ -323,7 +323,7 @@ Map<String, Object> inContext = FastMap.newInstance(); inContext.put("workEffort", workEffort); inContext.put("workEffortContent", workEffortContent); - ContentWorker.renderContentAsText(dispatcher, delegator, workEffortContent.getString("contentId"), outWriter, inContext, locale, mimeTypeId, false); + ContentWorker.renderContentAsText(dispatcher, delegator, workEffortContent.getString("contentId"), outWriter, inContext, locale, mimeTypeId, null, null, false); contentList.add(outWriter.toString()); } } |
Free forum by Nabble | Edit this page |