Skip to content

Commit

Permalink
LPS-101131 Uses new interface
Browse files Browse the repository at this point in the history
  • Loading branch information
ealonso committed Sep 6, 2019
1 parent 2939db3 commit 0f1a0d5
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 24 deletions.
Expand Up @@ -15,7 +15,7 @@
package com.liferay.fragment.entry.processor.background.image;

import com.liferay.fragment.constants.FragmentEntryLinkConstants;
import com.liferay.fragment.entry.processor.util.FragmentEntryProcessorUtil;
import com.liferay.fragment.entry.processor.util.FragmentEntryProcessorHelper;
import com.liferay.fragment.exception.FragmentEntryContentException;
import com.liferay.fragment.model.FragmentEntryLink;
import com.liferay.fragment.processor.FragmentEntryProcessor;
Expand Down Expand Up @@ -111,7 +111,7 @@ public String processFragmentEntryLinkHTML(

String value = StringPool.BLANK;

if (_fragmentEntryProcessorUtil.isAssetDisplayPage(
if (_fragmentEntryProcessorHelper.isAssetDisplayPage(
fragmentEntryProcessorContext.getMode())) {

String mappedField = editableValueJSONObject.getString(
Expand All @@ -132,10 +132,13 @@ public String processFragmentEntryLinkHTML(
}
}

if (_fragmentEntryProcessorUtil.isMapped(editableValueJSONObject)) {
Object fieldValue = _fragmentEntryProcessorUtil.getMappedValue(
editableValueJSONObject, infoDisplaysFieldValues,
fragmentEntryProcessorContext);
if (_fragmentEntryProcessorHelper.isMapped(
editableValueJSONObject)) {

Object fieldValue =
_fragmentEntryProcessorHelper.getMappedValue(
editableValueJSONObject, infoDisplaysFieldValues,
fragmentEntryProcessorContext);

if (fieldValue != null) {
if (fieldValue instanceof JSONObject) {
Expand All @@ -151,7 +154,7 @@ public String processFragmentEntryLinkHTML(
}

if (Validator.isNull(value)) {
value = _fragmentEntryProcessorUtil.getEditableValue(
value = _fragmentEntryProcessorHelper.getEditableValue(
editableValueJSONObject,
fragmentEntryProcessorContext.getLocale(),
fragmentEntryProcessorContext.getSegmentsExperienceIds());
Expand Down Expand Up @@ -237,6 +240,6 @@ private Document _getDocument(String html) {
}

@Reference
private FragmentEntryProcessorUtil _fragmentEntryProcessorUtil;
private FragmentEntryProcessorHelper _fragmentEntryProcessorHelper;

}
Expand Up @@ -17,7 +17,7 @@
import com.liferay.fragment.constants.FragmentEntryLinkConstants;
import com.liferay.fragment.entry.processor.editable.mapper.EditableElementMapper;
import com.liferay.fragment.entry.processor.editable.parser.EditableElementParser;
import com.liferay.fragment.entry.processor.util.FragmentEntryProcessorUtil;
import com.liferay.fragment.entry.processor.util.FragmentEntryProcessorHelper;
import com.liferay.fragment.exception.FragmentEntryContentException;
import com.liferay.fragment.model.FragmentEntryLink;
import com.liferay.fragment.processor.FragmentEntryProcessor;
Expand Down Expand Up @@ -167,7 +167,7 @@ public String processFragmentEntryLinkHTML(
JSONObject mappedValueConfigJSONObject =
JSONFactoryUtil.createJSONObject();

if (_fragmentEntryProcessorUtil.isAssetDisplayPage(
if (_fragmentEntryProcessorHelper.isAssetDisplayPage(
fragmentEntryProcessorContext.getMode())) {

value = editableValueJSONObject.getString("mappedField");
Expand All @@ -182,15 +182,18 @@ public String processFragmentEntryLinkHTML(
editableElementParser.getFieldTemplate(), "field_name",
value);

value = _fragmentEntryProcessorUtil.processTemplate(
value = _fragmentEntryProcessorHelper.processTemplate(
value, fragmentEntryProcessorContext);
}
}

if (_fragmentEntryProcessorUtil.isMapped(editableValueJSONObject)) {
Object fieldValue = _fragmentEntryProcessorUtil.getMappedValue(
editableValueJSONObject, infoDisplaysFieldValues,
fragmentEntryProcessorContext);
if (_fragmentEntryProcessorHelper.isMapped(
editableValueJSONObject)) {

Object fieldValue =
_fragmentEntryProcessorHelper.getMappedValue(
editableValueJSONObject, infoDisplaysFieldValues,
fragmentEntryProcessorContext);

if (fieldValue != null) {
String fieldId = editableValueJSONObject.getString(
Expand All @@ -203,13 +206,13 @@ public String processFragmentEntryLinkHTML(

value = editableElementParser.parseFieldValue(fieldValue);

value = _fragmentEntryProcessorUtil.processTemplate(
value = _fragmentEntryProcessorHelper.processTemplate(
value, fragmentEntryProcessorContext);
}
}

if (Validator.isNull(value)) {
value = _fragmentEntryProcessorUtil.getEditableValue(
value = _fragmentEntryProcessorHelper.getEditableValue(
editableValueJSONObject,
fragmentEntryProcessorContext.getLocale(),
fragmentEntryProcessorContext.getSegmentsExperienceIds());
Expand Down Expand Up @@ -471,6 +474,6 @@ private void _validateType(Element element)
new HashMap<>();

@Reference
private FragmentEntryProcessorUtil _fragmentEntryProcessorUtil;
private FragmentEntryProcessorHelper _fragmentEntryProcessorHelper;

}
Expand Up @@ -15,7 +15,7 @@
package com.liferay.fragment.entry.processor.editable.internal.mapper;

import com.liferay.fragment.entry.processor.editable.mapper.EditableElementMapper;
import com.liferay.fragment.entry.processor.util.FragmentEntryProcessorUtil;
import com.liferay.fragment.entry.processor.util.FragmentEntryProcessorHelper;
import com.liferay.fragment.processor.FragmentEntryProcessorContext;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.json.JSONObject;
Expand Down Expand Up @@ -48,10 +48,11 @@ public void map(
String href = configJSONObject.getString("href");

boolean assetDisplayPage =
_fragmentEntryProcessorUtil.isAssetDisplayPage(
_fragmentEntryProcessorHelper.isAssetDisplayPage(
fragmentEntryProcessorContext.getMode());

boolean mapped = _fragmentEntryProcessorUtil.isMapped(configJSONObject);
boolean mapped = _fragmentEntryProcessorHelper.isMapped(
configJSONObject);

if (Validator.isNull(href) && !assetDisplayPage && !mapped) {
return;
Expand Down Expand Up @@ -79,7 +80,7 @@ public void map(
String mappedField = configJSONObject.getString("mappedField");

if (mapped) {
Object fieldValue = _fragmentEntryProcessorUtil.getMappedValue(
Object fieldValue = _fragmentEntryProcessorHelper.getMappedValue(
configJSONObject, new HashMap<>(),
fragmentEntryProcessorContext);

Expand All @@ -106,12 +107,12 @@ else if (assetDisplayPage && Validator.isNotNull(mappedField)) {
linkElement.html(replaceLink ? firstChild.html() : element.html());

element.html(
_fragmentEntryProcessorUtil.processTemplate(
_fragmentEntryProcessorHelper.processTemplate(
linkElement.outerHtml(), fragmentEntryProcessorContext));
}
}

@Reference
private FragmentEntryProcessorUtil _fragmentEntryProcessorUtil;
private FragmentEntryProcessorHelper _fragmentEntryProcessorHelper;

}

0 comments on commit 0f1a0d5

Please sign in to comment.