Skip to content

Commit

Permalink
Implemented: Use the rendered cache in content wrappers (OFBIZ-10194)
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Brohl authored and mbrohl committed Feb 2, 2024
1 parent e7502ac commit 625b80d
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,10 @@ public static String getProductCategoryContentAsText(GenericValue productCategor
String outString = null;
try {
Writer outWriter = new StringWriter();
// Use cache == true to have entity-cache managed content from cache while (not managed) rendered cache above
// may be configured with short expire time
getProductCategoryContentAsText(null, productCategory, prodCatContentTypeId, locale, mimeTypeId, delegator,
dispatcher, outWriter, false);
dispatcher, outWriter, true);
outString = outWriter.toString();
} catch (GeneralException | IOException e) {
Debug.logError(e, "Error rendering CategoryContent", MODULE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,10 @@ public static String getProductConfigItemContentAsText(GenericValue productConfi

try {
Writer outWriter = new StringWriter();
// Use cache == true to have entity-cache managed content from cache while (not managed) rendered cache above
// may be configured with short expire time
getProductConfigItemContentAsText(null, productConfigItem, confItemContentTypeId, locale, mimeTypeId, delegator, dispatcher,
outWriter, false);
outWriter, true);
outString = outWriter.toString();
} catch (GeneralException | IOException e) {
Debug.logError(e, "Error rendering ProdConfItemContent", MODULE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,10 @@ public static String getProductContentAsText(GenericValue product, String produc
String outString = null;
try {
Writer outWriter = new StringWriter();
// Use cache == true to have entity-cache managed content from cache while (not managed) rendered cache above
// may be configured with short expire time
getProductContentAsText(null, product, productContentTypeId, locale, mimeTypeId, partyId, roleTypeId,
delegator, dispatcher,
outWriter, false);
delegator, dispatcher, outWriter, true);
outString = outWriter.toString();
} catch (GeneralException | IOException e) {
Debug.logError(e, "Error rendering ProductContent", MODULE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,10 @@ public static String getProductPromoContentAsText(GenericValue productPromo, Str
String outString = null;
try {
Writer outWriter = new StringWriter();
// Use cache == true to have entity-cache managed content from cache while (not managed) rendered cache above
// may be configured with short expire time
getProductPromoContentAsText(null, productPromo, productPromoContentTypeId, locale, mimeTypeId, partyId, roleTypeId,
delegator, dispatcher, outWriter, false);
delegator, dispatcher, outWriter, true);
outString = outWriter.toString();
} catch (GeneralException | IOException e) {
Debug.logError(e, "Error rendering ProductPromoContent", MODULE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,10 @@ public static String getWorkEffortContentAsText(GenericValue workEffort, String
}

Writer outWriter = new StringWriter();
getWorkEffortContentAsText(contentId, null, workEffort, workEffortContentTypeId, locale, mimeTypeId, delegator, dispatcher,
outWriter, false);
// Use cache == true to have entity-cache managed content from cache while (not managed) rendered cache above
// may be configured with short expire time
getWorkEffortContentAsText(contentId, null, workEffort, workEffortContentTypeId, locale, mimeTypeId,
delegator, dispatcher, outWriter, true);
String outString = outWriter.toString();
if (UtilValidate.isEmpty(outString)) {
outString = workEffort.getModelEntity().isField(candidateFieldName) ? workEffort.getString(candidateFieldName) : "";
Expand Down

0 comments on commit 625b80d

Please sign in to comment.