Author: lektran
Date: Mon Jun 27 23:13:20 2011 New Revision: 1140362 URL: http://svn.apache.org/viewvc?rev=1140362&view=rev Log: Realized my previous commit (r1140358) was incomplete. Adding additional code to support serialization of ProductConfigItemContentWrapper objects. Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigItemContentWrapper.java 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=1140362&r1=1140361&r2=1140362&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 Mon Jun 27 23:13:20 2011 @@ -36,10 +36,12 @@ import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.content.content.ContentWorker; import org.ofbiz.entity.Delegator; +import org.ofbiz.entity.DelegatorFactory; import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.model.ModelEntity; import org.ofbiz.entity.model.ModelUtil; import org.ofbiz.entity.util.EntityUtil; +import org.ofbiz.service.GenericDispatcher; import org.ofbiz.service.LocalDispatcher; /** @@ -52,16 +54,22 @@ public class ProductConfigItemContentWra protected transient LocalDispatcher dispatcher; protected String dispatcherName; + protected transient Delegator delegator; + protected String delegatorName; protected GenericValue productConfigItem; protected Locale locale; protected String mimeTypeId; + public static ProductConfigItemContentWrapper makeProductConfigItemContentWrapper(GenericValue productConfigItem, HttpServletRequest request) { return new ProductConfigItemContentWrapper(productConfigItem, request); } public ProductConfigItemContentWrapper(LocalDispatcher dispatcher, GenericValue productConfigItem, Locale locale, String mimeTypeId) { this.dispatcher = dispatcher; + this.dispatcherName = dispatcher.getName(); + this.delegator = productConfigItem.getDelegator(); + this.delegatorName = delegator.getDelegatorName(); this.productConfigItem = productConfigItem; this.locale = locale; this.mimeTypeId = mimeTypeId; @@ -69,13 +77,30 @@ public class ProductConfigItemContentWra public ProductConfigItemContentWrapper(GenericValue productConfigItem, HttpServletRequest request) { this.dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); + this.dispatcherName = dispatcher.getName(); + this.delegator = (Delegator) request.getAttribute("delegator"); + this.delegatorName = delegator.getDelegatorName(); this.productConfigItem = productConfigItem; this.locale = UtilHttp.getLocale(request); this.mimeTypeId = "text/html"; } public String get(String confItemContentTypeId) { - return getProductConfigItemContentAsText(productConfigItem, confItemContentTypeId, locale, mimeTypeId, productConfigItem.getDelegator(), dispatcher); + return getProductConfigItemContentAsText(productConfigItem, confItemContentTypeId, locale, mimeTypeId, getDelegator(), getDispatcher()); + } + + public Delegator getDelegator() { + if (delegator == null) { + delegator = DelegatorFactory.getDelegator(delegatorName); + } + return delegator; + } + + public LocalDispatcher getDispatcher() { + if (dispatcher == null) { + dispatcher = GenericDispatcher.getLocalDispatcher(dispatcherName, this.getDelegator()); + } + return dispatcher; } public static String getProductConfigItemContentAsText(GenericValue productConfigItem, String confItemContentTypeId, HttpServletRequest request) { |
Free forum by Nabble | Edit this page |