Class PagePersonalizationUtil
- java.lang.Object
-
- lumis.service.pagepersonalization.PagePersonalizationUtil
-
public class PagePersonalizationUtil extends Object
Provides utility methods for the Page Personalization service.- Since:
- 10.2.0
- Version:
- $Revision: 22800 $ $Date: 2019-06-03 18:36:25 -0300 (Mon, 03 Jun 2019) $
-
-
Field Summary
Fields Modifier and Type Field Description static String
PROPERTY_HOLDER_PERSONALIZED_BY_CONTENT
Name of holder's service interface instance custom property that contains a boolean value indicating if that holder is personalized by content.
-
Constructor Summary
Constructors Constructor Description PagePersonalizationUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addNewWidgets(Collection<String> oldWidgetInstancesIds, Collection<String> updateWidgetInstancesIds, ISourceField field, SourcePreUpdateDataEvent event)
Compare two list of widgets instances and process the widgets whom exists on the updated list and does not exist on the other list.static String
encodeHtmlEditorControl(String html)
Method that receives a html string, search for widget instance pattern and encode it with data.static String
getHolderContentId(String holderServiceInterfaceInstanceId, String contentId)
Returns the identifier of the content the holder is personalized for.static String
getWidgetInstanceHolderInterfaceInstanceId(String interfaceInstanceId)
Returns the widget holder's interface instance id for a widget instance that corresponds to the specified interface instance only if it's a holder widget instance.static boolean
isHolderPersonalizedByContent(String holderInterfaceInstanceId)
Returns whether a widget holder is configured to be personalized by content.static void
processWidgetInstaceInHtmlAdded(String html, ISourceField field, SourcePostAddDataEvent event)
Process the html field widget instance after it be added.static void
processWidgetInstaceInHtmlDelete(Collection<String> itemIds)
Process the html field widget instance to be deleted.static void
processWidgetInstaceInHtmlUpdate(String newHtml, String originalHtml, ISourceField field, SourcePreUpdateDataEvent event)
Process the html field widget instance to be updated.static void
removeDeletedWidgets(Collection<String> oldWidgetInstancesIds, Collection<String> updateWidgetInstancesIds)
Compare a list of old widgets and a updated list of widget instances and remove de widgets instances that does not exists in the updated list.static String
renderWidgetInHtml(String html, HttpServletRequest httpServletRequest, IServiceInterfaceRenderRequest originalRenderRequest, HttpServletResponse httpServletResponse)
Method that create a request to get html from a widget instance in a html content field and substitute the dummy widget instance for his html content.
-
-
-
Field Detail
-
PROPERTY_HOLDER_PERSONALIZED_BY_CONTENT
public static final String PROPERTY_HOLDER_PERSONALIZED_BY_CONTENT
Name of holder's service interface instance custom property that contains a boolean value indicating if that holder is personalized by content.- Since:
- 10.2.0
- See Also:
- Constant Field Values
-
-
Method Detail
-
getWidgetInstanceHolderInterfaceInstanceId
public static String getWidgetInstanceHolderInterfaceInstanceId(String interfaceInstanceId)
Returns the widget holder's interface instance id for a widget instance that corresponds to the specified interface instance only if it's a holder widget instance.- Parameters:
interfaceInstanceId
- the widget instance's interface instance identifier.- Returns:
- the widget holder's interface instance identifier.
- Since:
- 10.2.0
-
isHolderPersonalizedByContent
public static boolean isHolderPersonalizedByContent(String holderInterfaceInstanceId) throws PortalException
Returns whether a widget holder is configured to be personalized by content.- Parameters:
holderInterfaceInstanceId
- the holder's service interface instance identifier.- Returns:
true
if the holder is configured to be personalized by content,false
otherwise.- Throws:
PortalException
- Since:
- 10.2.0
-
getHolderContentId
public static String getHolderContentId(String holderServiceInterfaceInstanceId, String contentId) throws PortalException
Returns the identifier of the content the holder is personalized for.- Parameters:
holderServiceInterfaceInstanceId
- the holder's service interface instance identifier.contentId
- the content identifier provided in the request being processed.- Returns:
- the content identifier, or
null
if the holder is not configured to be personalized for content or if the request does not specify a valid content to base the holder on. - Throws:
PortalException
- Since:
- 10.2.0
-
encodeHtmlEditorControl
public static String encodeHtmlEditorControl(String html) throws PortalException
Method that receives a html string, search for widget instance pattern and encode it with data.- Parameters:
html
-- Returns:
- the encoded Html
- Throws:
PortalException
- Since:
- 10.4.0
-
renderWidgetInHtml
public static String renderWidgetInHtml(String html, HttpServletRequest httpServletRequest, IServiceInterfaceRenderRequest originalRenderRequest, HttpServletResponse httpServletResponse) throws PortalException
Method that create a request to get html from a widget instance in a html content field and substitute the dummy widget instance for his html content.- Parameters:
html
- the orignal content htmlhttpServletRequest
- the http servlet requestoriginalRenderRequest
- the original render requesthttpServletResponse
- the http servlet Response- Returns:
- return the content html with widget html
- Throws:
PortalException
- Since:
- 10.4.0
-
processWidgetInstaceInHtmlDelete
public static void processWidgetInstaceInHtmlDelete(Collection<String> itemIds) throws PortalException
Process the html field widget instance to be deleted.- Parameters:
itemId
- the content version item identifier- Throws:
PortalException
- Since:
- 10.4.0
-
processWidgetInstaceInHtmlUpdate
public static void processWidgetInstaceInHtmlUpdate(String newHtml, String originalHtml, ISourceField field, SourcePreUpdateDataEvent event) throws PortalException
Process the html field widget instance to be updated.- Parameters:
newHtml
- the new html fieldoriginalHtml
- the original html fieldevent
- the pre update event- Throws:
PortalException
- Since:
- 10.4.0
-
removeDeletedWidgets
public static void removeDeletedWidgets(Collection<String> oldWidgetInstancesIds, Collection<String> updateWidgetInstancesIds) throws PortalException
Compare a list of old widgets and a updated list of widget instances and remove de widgets instances that does not exists in the updated list.- Parameters:
oldWidgetInstancesIds
- list of old widgets instancesupdateWidgetInstancesIds
- list of widgets instances updated- Throws:
PortalException
- Since:
- 10.4.0
-
addNewWidgets
public static void addNewWidgets(Collection<String> oldWidgetInstancesIds, Collection<String> updateWidgetInstancesIds, ISourceField field, SourcePreUpdateDataEvent event) throws PortalException
Compare two list of widgets instances and process the widgets whom exists on the updated list and does not exist on the other list.- Parameters:
oldWidgetInstancesIds
- the list of old widgets instancesupdateWidgetInstancesIds
- the updated list of widgets instancesevent
- the pre update event- Throws:
PortalException
- Since:
- 10.4.0
-
processWidgetInstaceInHtmlAdded
public static void processWidgetInstaceInHtmlAdded(String html, ISourceField field, SourcePostAddDataEvent event) throws PortalException
Process the html field widget instance after it be added.- Parameters:
html
- the html fieldevent
- the post add event- Throws:
PortalException
- Since:
- 10.4.0
-
-