Skip to content

Commit

Permalink
#19385 #18990 refactoring a simpler way to do the key value for the p…
Browse files Browse the repository at this point in the history
…age re…

* #18990 refactoring a simplier way to do the key value for the page render

* #18990 adding a fix
  • Loading branch information
jdotcms authored Oct 7, 2020
1 parent a60bbee commit 9aa8891
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class DotContentletTransformerImpl implements DotContentletTransformer {

static final Set<TransformOptions> defaultOptions = EnumSet.of(

COMMON_PROPS, CONSTANTS, VERSION_INFO, BINARIES, CATEGORIES_NAME, TAGS , KEY_VALUE_VIEW
COMMON_PROPS, CONSTANTS, VERSION_INFO, BINARIES, CATEGORIES_NAME, TAGS

);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,17 @@ public DotTransformerBuilder keyValueToMapTransformer(){
return this;
}

/**
* Url Content Map to Map Transformer
* @return
*/
public DotTransformerBuilder urlContentMapTransformer(){
optionsHolder.clear();
optionsHolder.addAll(DotContentletTransformerImpl.defaultOptions);
optionsHolder.add(KEY_VALUE_VIEW);
return this;
}

/**
* Fine tuned to be used for FileAssets on BrowserAPI
* @return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ protected Map<String, Object> getObjectMap(final PageView pageView) {

protected void createObjectMapUrlContent(final Contentlet urlContent, final Map<String, Object> pageViewMap) {

final DotContentletTransformer transformer = new DotTransformerBuilder().defaultOptions().content(urlContent).build();
final DotContentletTransformer transformer = new DotTransformerBuilder().urlContentMapTransformer().content(urlContent).build();
final Map<String, Object> urlContentletMap = transformer.toMaps().stream().findFirst().orElse(Collections.EMPTY_MAP);

pageViewMap.put("urlContentMap", urlContentletMap);
Expand Down

0 comments on commit 9aa8891

Please sign in to comment.