com.ibm.commerce.pagelayout.facade.server.helpers

Class PageLayoutComponentHelper

  • java.lang.Object
    • com.ibm.commerce.pagelayout.facade.server.helpers.PageLayoutComponentHelper


  • public class PageLayoutComponentHelper
    extends java.lang.Object
    This class has some common methods that are used by the page layout component.
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String COPYRIGHT
      The IBM copyright field.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static java.lang.String appendStringWithTimeStamp(java.lang.String astrString, int anMaxLengthOfString)
      Append a timestamp to a string and return the new string.
      static com.ibm.commerce.pagelayout.facade.datatypes.WidgetPropertyType buildWidgetPropertyType(com.ibm.commerce.pagelayout.facade.server.entity.datatypes.PageLayoutWidgetNameValuePair widgetNVPPhysicalSDO)
      This method builds WidgetPropertyType with the physical SDO object PageLayoutWidgetNameValuePair.
      static java.lang.String formatXMLDateTime(java.util.Date date)
      Formats a Date object into an XML dateTime in the business context time zone with SDODataTypeHelper.formatXMLDateTime(Date).
      static java.util.Set<java.lang.String> getCatentryPageGroups()
      Returns all the catalog entry page groups as a set.
      static ChangeControlBusinessObjectMediator getChangeControlMediator(java.lang.Object noun)
      Returns the ChangeControlMediator after initializing it with the noun being passed.
      static java.lang.String getEMarketingSpotName(com.ibm.commerce.pagelayout.facade.server.entity.datatypes.PageLayoutWidget aWidgetSDO)
      Returns the name of E-Marketing Spot for the widget.
      static java.lang.String getEMarketingSpotUniqueId(com.ibm.commerce.pagelayout.facade.server.entity.datatypes.PageLayoutWidget aWidgetSDO)
      Returns the unique id of E-Marketing Spot for the widget.
      static java.lang.String getESpotStoreId(java.lang.String pageLocationStoreId, java.lang.String objectStoreId)
      This method returns the storeId where page location eSpot of type 'LAYOUTMARKETINGESPOT' should be created.
      static java.lang.Object getExternalManagingToolValue(java.lang.Short internalManagingToolValue)
      This method maps the internal value of managing tool to its external value.
      static java.lang.Short getInternalLayoutStateValue(java.lang.String externalValue)
      This method gets the internal value of the layout state.
      static java.lang.Short getInternalManagingToolValue(java.lang.String managingTool)
      This method converts the external managing tool value to its corresponding internal value.
      static java.lang.Short getInternalSortByValue(java.lang.String externalValue)
      This method gets the internal value of the sort by criteria.
      static java.lang.Short getInternalSortOrderValue(java.lang.String externalValue)
      This method returns the internal value for the sorting order
      static java.lang.Integer getLanguageId()
      This method gets the language ID from the service context.
      static java.lang.Integer getLanguageId(com.ibm.commerce.pagelayout.facade.datatypes.AttributesType attrs)
      Returns the language id of the attributes of extended data.
      static java.lang.Integer[] getLanguageIds(SelectionCriteria searchCriteria)
      Returns language ids in the search criteria.
      static java.lang.Long getOwnerIdForStore(java.lang.Integer storeId)
      Gets the owner Id for the given store.
      static com.ibm.commerce.pagelayout.facade.datatypes.PageLayoutFactory getPageLayoutFactory()
      This method returns the default instance of the PageLayout Factory.
      static java.lang.Integer[] getPageLayoutStorePath()
      This method returns the store path ids which the current store has the 'com.ibm.commerce.view' store relationship type with.
      static java.util.List<com.ibm.commerce.pagelayout.facade.server.entity.datatypes.PageLayoutWidget> getPhysicalWidgetsById(java.util.List<java.lang.String> widgetIdList)
      This method gets the physical widgets by the Unique ID of widgets.
      static java.lang.Integer getStoreId()
      This method gets the store ID from the service context.
      static java.lang.Integer getStoreIdForLayout(java.lang.String layoutId)
      Returns the store id of the given page layout Id.
      static java.util.List<java.lang.String> getSynonyms(java.lang.String keyword)
      The method gets all the synonyms for the given keyword, only if the UseSynonyms flex flow is enabled for current store.
      static java.lang.Long getUserID()
      This method returns the user ID of the user invoking the service.
      static java.lang.String getWidgetIdentifier(java.lang.String widgetDefinitionUniqueID)
      This method returns the widget identifier for the given widget definition unique id.
      static java.util.Date getXMLDateTime(java.lang.Object dateObj)
      Parses an XML dateTime into a Date object with SDODataTypeHelper.getXMLDateTime(Object).
      static boolean isCategoryOrCatentryPageGroup(java.lang.String pageGroupID)
      Returns whether the given page group is a category or catalog entry page group.
      static boolean isCatentryPageGroup(java.lang.String pageGroupID)
      Returns whether the given page group is a catalog entry page group.
      static boolean isCatentryPageGroupWithoutSubLevels(java.lang.String pageGroupID)
      Returns whether the given page group is a catalog entry page group that does not have sub level page groups.
      static java.lang.Boolean isPageComposerFeatureEnabled()
      This method indicates if the page composer feature is enabled for the current store.
      static java.lang.Boolean isUseSynonymsEnabled()
      This method gets whether the UseSynonyms flex flow is enabled for current store, which delegates to MarketingFacadeClient.
      static boolean isWidgetTypeAllowed(java.lang.String managingTool, java.lang.String widgetType)
      This method checks if the widget type is allowed for the managing tool specified.
      static boolean requireEMarketingSpot(java.lang.String widgetDefinitionUniqueID)
      This method return whether or not a widget definition needs a E-Marketing Spot in the specified store.
      static com.ibm.commerce.pagelayout.facade.server.entity.datatypes.PageLayout resolveLayoutIdentifier(com.ibm.commerce.foundation.common.datatypes.LayoutIdentifierType layoutIdentifier)
      This method resolves the layout identifier provided.
      static java.util.List<ApplicationError> validateLayoutDesign(java.lang.String pageLayoutId)
      This method validates if the existing design of the layout does not contain any inactive widgets.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        The IBM copyright field.
        See Also:
        Constant Field Values
    • Constructor Detail

      • PageLayoutComponentHelper

        public PageLayoutComponentHelper()
    • Method Detail

      • getStoreId

        public static java.lang.Integer getStoreId()
        This method gets the store ID from the service context.
        Returns:
        The Integer storeId.
      • requireEMarketingSpot

        public static boolean requireEMarketingSpot(java.lang.String widgetDefinitionUniqueID)
                                             throws PageLayoutApplicationException
        This method return whether or not a widget definition needs a E-Marketing Spot in the specified store.
        Parameters:
        widgetDefinitionUniqueID - The unique id of the widget definition.
        Returns:
        true if the widget definition needs E-marketing Spot; false otherwise.
        Throws:
        PageLayoutApplicationException - Exception is thrown when there is problem retrieving the widget defintion.
      • getWidgetIdentifier

        public static java.lang.String getWidgetIdentifier(java.lang.String widgetDefinitionUniqueID)
                                                    throws PageLayoutApplicationException
        This method returns the widget identifier for the given widget definition unique id.
        Parameters:
        widgetDefinitionUniqueID - The unique id of the widget definition.
        Returns:
        the widget identifier. Null is returned if the widget definition is not found.
        Throws:
        PageLayoutApplicationException - Exception is thrown when there is problem retrieving the widget defintion.
      • getStoreIdForLayout

        public static java.lang.Integer getStoreIdForLayout(java.lang.String layoutId)
                                                     throws DataMediatorException
        Returns the store id of the given page layout Id.
        Parameters:
        layoutId - The unique id of the page layout.
        Returns:
        The storeId where the page layout belongs to.
        Throws:
        DataMediatorException - Exception is thrown when there is problem retrieving the page layout from database.
      • getOwnerIdForStore

        public static java.lang.Long getOwnerIdForStore(java.lang.Integer storeId)
        Gets the owner Id for the given store.
        Parameters:
        storeId - The store Id for which the owner needs to be returned.
        Returns:
        Owner Id for the given store.
      • formatXMLDateTime

        public static java.lang.String formatXMLDateTime(java.util.Date date)
        Formats a Date object into an XML dateTime in the business context time zone with SDODataTypeHelper.formatXMLDateTime(Date). If there are exceptions while formating, null is returned.
        Parameters:
        date - the Date object.
        Returns:
        the XML dateTime.
      • getXMLDateTime

        public static java.util.Date getXMLDateTime(java.lang.Object dateObj)
        Parses an XML dateTime into a Date object with SDODataTypeHelper.getXMLDateTime(Object). If there are exceptions while parsing, null is returned.
        Parameters:
        dateObj - SDO representation of the XML dateTime.
        Returns:
        the Date object.
      • isPageComposerFeatureEnabled

        public static java.lang.Boolean isPageComposerFeatureEnabled()
        This method indicates if the page composer feature is enabled for the current store.
        Returns:
        True, if the page composer feature is enabled for the store. Null if the status is unknown and False, if the page composer feature is disabled.
      • isUseSynonymsEnabled

        public static java.lang.Boolean isUseSynonymsEnabled()
                                                      throws PageLayoutApplicationException
        This method gets whether the UseSynonyms flex flow is enabled for current store, which delegates to MarketingFacadeClient.
        Returns:
        A flag indicate whether the UseSynonyms flex flow is enabled for current store.
        Throws:
        PageLayoutApplicationException
      • getSynonyms

        public static java.util.List<java.lang.String> getSynonyms(java.lang.String keyword)
                                                            throws PageLayoutApplicationException
        The method gets all the synonyms for the given keyword, only if the UseSynonyms flex flow is enabled for current store. Else null will be returned
        Parameters:
        keyword - The given keyword.
        Returns:
        A list that contains all the synonyms for the given keyword.
        Throws:
        PageLayoutApplicationException
      • appendStringWithTimeStamp

        public static java.lang.String appendStringWithTimeStamp(java.lang.String astrString,
                                                                 int anMaxLengthOfString)
        Append a timestamp to a string and return the new string. If the result string is longer than the length specified, a substring of the first number of characters of the original string plus a "-" and the timestamp will be returned.
        Parameters:
        astrString - The string that will be appended by a timestamp.
        anMaxLengthOfString - The max length of the string.
        Returns:
        java.lang.String
      • getEMarketingSpotUniqueId

        public static java.lang.String getEMarketingSpotUniqueId(com.ibm.commerce.pagelayout.facade.server.entity.datatypes.PageLayoutWidget aWidgetSDO)
        Returns the unique id of E-Marketing Spot for the widget.
        Parameters:
        aWidgetSDO - The physical data object of the widget.
        Returns:
        The unique id of E-Marketing Spot.
      • buildWidgetPropertyType

        public static com.ibm.commerce.pagelayout.facade.datatypes.WidgetPropertyType buildWidgetPropertyType(com.ibm.commerce.pagelayout.facade.server.entity.datatypes.PageLayoutWidgetNameValuePair widgetNVPPhysicalSDO)
        This method builds WidgetPropertyType with the physical SDO object PageLayoutWidgetNameValuePair.
        Parameters:
        widgetNVPPhysicalSDO - The physical SDO object PageLayoutWidgetNameValuePair
        Returns:
        WidgetPropertyType
      • getPageLayoutFactory

        public static com.ibm.commerce.pagelayout.facade.datatypes.PageLayoutFactory getPageLayoutFactory()
        This method returns the default instance of the PageLayout Factory. This factory can be used to create objects defined by the PageLayout component.
        Returns:
        This method returns the default PageLayout Factory.
      • getEMarketingSpotName

        public static java.lang.String getEMarketingSpotName(com.ibm.commerce.pagelayout.facade.server.entity.datatypes.PageLayoutWidget aWidgetSDO)
        Returns the name of E-Marketing Spot for the widget.
        Parameters:
        aWidgetSDO - The physical data object of the widget.
        Returns:
        The name of E-Marketing Spot.
      • getLanguageIds

        public static java.lang.Integer[] getLanguageIds(SelectionCriteria searchCriteria)
        Returns language ids in the search criteria.
        Parameters:
        searchCriteria - The search criteria.
        Returns:
        The array of language ids.
      • getLanguageId

        public static java.lang.Integer getLanguageId()
                                               throws PageLayoutSystemException
        This method gets the language ID from the service context.
        Returns:
        The language ID.
        Throws:
        PageLayoutSystemException - Exception is thrown if the language ID could not be retrieved or returned null.
      • getPageLayoutStorePath

        public static java.lang.Integer[] getPageLayoutStorePath()
                                                          throws PageLayoutApplicationException
        This method returns the store path ids which the current store has the 'com.ibm.commerce.view' store relationship type with.
        Returns:
        an Integer array which contains the store path ids.
        Throws:
        PageLayoutApplicationException - If an error occurs while retrieving storepath.
      • getLanguageId

        public static java.lang.Integer getLanguageId(com.ibm.commerce.pagelayout.facade.datatypes.AttributesType attrs)
        Returns the language id of the attributes of extended data. If there is no language specified, the store default language will be returned.
        Parameters:
        attrs - The attributes of the extended data.
        Returns:
        The language id.
      • getPhysicalWidgetsById

        public static java.util.List<com.ibm.commerce.pagelayout.facade.server.entity.datatypes.PageLayoutWidget> getPhysicalWidgetsById(java.util.List<java.lang.String> widgetIdList)
                                                                                                                                  throws DataMediatorException
        This method gets the physical widgets by the Unique ID of widgets.
        Parameters:
        widgetIdList - The list of Unique ID for widgets.
        Returns:
        The list of physical Page Layout Widgets.
        Throws:
        DataMediatorException
      • getESpotStoreId

        public static java.lang.String getESpotStoreId(java.lang.String pageLocationStoreId,
                                                       java.lang.String objectStoreId)
        This method returns the storeId where page location eSpot of type 'LAYOUTMARKETINGESPOT' should be created. It takes the current storeId of the request ( The storeId where layout association will be created ) and the objectStoreId (the storeId which owns the association object - Catalog Group / Catalog Entry / Content
        Parameters:
        pageLocationStoreId - - storeId in which page layout association is being created
        objectStoreId - - storeId of the object for which layout association is being created (storeId of catalogEntry / catGroup / content page )
        Returns:
        - storeId which should own the layout association eSpot
      • getChangeControlMediator

        public static ChangeControlBusinessObjectMediator getChangeControlMediator(java.lang.Object noun)
                                                                            throws java.lang.Exception
        Returns the ChangeControlMediator after initializing it with the noun being passed.
        Parameters:
        noun - The noun for which to retrieve the change control mediator.
        Returns:
        The ChangeControlMediator for the given noun..
        Throws:
        java.lang.Exception
      • isCategoryOrCatentryPageGroup

        public static boolean isCategoryOrCatentryPageGroup(java.lang.String pageGroupID)
        Returns whether the given page group is a category or catalog entry page group.
        Parameters:
        pageGroupID - The page group to check. If null or empty, false will be returned.
        Returns:
        True if the given value is the category page group or a catalog entry page group, false otherwise.
      • isCatentryPageGroup

        public static boolean isCatentryPageGroup(java.lang.String pageGroupID)
        Returns whether the given page group is a catalog entry page group.
        Parameters:
        pageGroupID - The page group to check. If null or empty, false will be returned.
        Returns:
        True if the given value is a catalog entry page group, false otherwise.
      • isCatentryPageGroupWithoutSubLevels

        public static boolean isCatentryPageGroupWithoutSubLevels(java.lang.String pageGroupID)
        Returns whether the given page group is a catalog entry page group that does not have sub level page groups. This means it is a catalog entry page group but not a PageLayoutServerConstants.PAGE_GROUP_PRODUCT.
        Parameters:
        pageGroupID - The page group to check. If null or empty, false will be returned.
        Returns:
        True if the given value is a catalog entry page group that is not the product page group, false otherwise.
      • validateLayoutDesign

        public static java.util.List<ApplicationError> validateLayoutDesign(java.lang.String pageLayoutId)
                                                                     throws AbstractApplicationException
        This method validates if the existing design of the layout does not contain any inactive widgets.
        Parameters:
        pageLayoutId - The unique ID of the pagelayout to be validated.
        Returns:
        List of ApplicationErrors to indicate the errors in the layout's design. Null, if there are no errors.
        Throws:
        AbstractApplicationException
      • getUserID

        public static java.lang.Long getUserID()
        This method returns the user ID of the user invoking the service.
        Returns:
        The user ID value.
      • resolveLayoutIdentifier

        public static com.ibm.commerce.pagelayout.facade.server.entity.datatypes.PageLayout resolveLayoutIdentifier(com.ibm.commerce.foundation.common.datatypes.LayoutIdentifierType layoutIdentifier)
                                                                                                             throws AbstractApplicationException
        This method resolves the layout identifier provided. If the layout identifier contains the layout name (and optionally the store ID), the method resolves to the corresponding layout and updates the identifier with the unique ID. The method returns the corresponding PAGELAYOUT physical SDO if resolved.
        Parameters:
        layoutIdentifier - The identifier to be resolved.
        Returns:
        The page layout physical SDO corresponding to the identifier.
        Throws:
        AbstractApplicationException - When the resolution fails.
      • getExternalManagingToolValue

        public static java.lang.Object getExternalManagingToolValue(java.lang.Short internalManagingToolValue)
        This method maps the internal value of managing tool to its external value. It uses the ValueMappingService to archive this. The group name is ManagingToolNames
        Parameters:
        internalManagingToolValue - The internal value of the managing tool
        Returns:
        The corresponding external value of the managing tool.
      • isWidgetTypeAllowed

        public static boolean isWidgetTypeAllowed(java.lang.String managingTool,
                                                  java.lang.String widgetType)
        This method checks if the widget type is allowed for the managing tool specified.
        Parameters:
        managingTool - The tool managing the layout.
        widgetType - The type of widget.
        Returns:
        True, if the widget type is allowed for the layout. False, otherwise.
      • getInternalManagingToolValue

        public static java.lang.Short getInternalManagingToolValue(java.lang.String managingTool)
        This method converts the external managing tool value to its corresponding internal value.
        Parameters:
        managingTool - The external managing tool value.
        Returns:
        The internal managing tool value if the external value is valid. Null, otherwise.
      • getInternalLayoutStateValue

        public static java.lang.Short getInternalLayoutStateValue(java.lang.String externalValue)
        This method gets the internal value of the layout state.
        Parameters:
        externalValue - The external value of the state.
        Returns:
        The internal value if resolved. Null, otherwise.
      • getInternalSortByValue

        public static java.lang.Short getInternalSortByValue(java.lang.String externalValue)
        This method gets the internal value of the sort by criteria.
        Parameters:
        externalValue - The external value of the sort by criteria
        Returns:
        The internal value if resolved. Null, otherwise.
      • getInternalSortOrderValue

        public static java.lang.Short getInternalSortOrderValue(java.lang.String externalValue)
        This method returns the internal value for the sorting order
        Parameters:
        externalValue - The external value specified in the query.
        Returns:
        The internal value if resolved. False, otherwise.