com.ibm.commerce.catalog.dataload.helper

Class CatalogDataLoadHelper

  • java.lang.Object
    • com.ibm.commerce.catalog.dataload.helper.CatalogDataLoadHelper


  • public class CatalogDataLoadHelper
    extends java.lang.Object
    This class contains static helper methods for catalog data load.
    • 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 fixURLKeyword(java.lang.String originalURLKeyword)
      This method help to fix the special characters from the original URL keyword.
      static java.lang.String generateSEODefaultKeyword(java.lang.String name)
      Generates the default keyword for a catalog group.
      static java.lang.String generateSEODefaultKeyword(java.lang.String name, java.lang.String partNumber)
      Generates the default keyword for a catalog entry.
      static java.lang.String generateSEODefaultKeywordWithLanguageId(java.lang.String urlKeyword, java.lang.String languageId)
      Generates URL keyword with language id as suffix.
      static java.lang.String getParameterizedString(java.lang.String string, java.lang.String[] parameter)
      Answers a string with each "{n}" substituted with actual text from the parameter array.
      static java.util.ArrayList<java.lang.Integer> getRelatedCatalogStoreId(java.lang.Integer storeId)
      Gets the list of related catalog store IDs of the specified store
      static java.util.ArrayList<java.lang.Integer> getRelatedShippingCalculationStoreId(java.lang.Integer storeId)
      Gets the list of related shipping calculation store IDs of the specified store
      static java.lang.Long getStoreOwnerId(java.lang.Integer storeId)
      Gets the owner ID of the specified store
      static com.ibm.commerce.foundation.internal.server.services.registry.StoreObject[] getStorePath(java.lang.Integer storeId, java.lang.String storeRelationshipType)
      Returns the related stores of a given type of a given store.
      static boolean isSearchEnabled(java.lang.Integer storeId)
      Checks whether Search is enabled for a store.
      static boolean isSEOURLPatternFeatureEnabled(java.lang.Integer storeId)
      Checks whether SEO is enabled for the store.
      static void parseSEOLoadingParameters()
      This method parse the component configuration file to get SEO loading parameters.
      static TableDataObject populateTI_CATENTRY_WS(java.lang.String masterCatalogId, java.lang.String catentryId, java.lang.String action, java.lang.String taskGroup)
      Populates the table TI_DELTA_CATENTRY for the search index rebuild.
      static TableDataObject populateTI_CATGROUP_WS(java.lang.String masterCatalogId, java.lang.String catgroupId, java.lang.String action, java.lang.String taskGroup)
      Populates the table TI_DELTA_CATGROUP for the search index rebuild.
      static TableDataObject populateTI_DELTA_CATENTRY(java.lang.String masterCatalogId, java.lang.String catentryId, java.lang.String action)
      Populates the table TI_DELTA_CATENTRY for the search index rebuild.
      static TableDataObject populateTI_DELTA_CATGROUP(java.lang.String masterCatalogId, java.lang.String catgroupId, java.lang.String action)
      Populates the table TI_DELTA_CATGROUP for the search index rebuild.
      static java.lang.String prunedString(java.lang.String string, int maxUtf8Length)
      Gets a string pruned to length bytes.
      static java.lang.String resolveIdentifierByStoreID(java.lang.String storeId)
      Resolves the identifier (IDENTIFIER column of STOREENT table) according to store id (STOREENT_ID column of STOREENT table).
      static java.lang.String resolveOwnerIDByStoreID(java.lang.String storeId)
      Resolves the owner id (MEMBER_ID column of STOREENT table) according to store id (STOREENT_ID column of STOREENT table).
      static java.lang.String resolveOwnerIDByStoreIdentifier(java.lang.String storeIdentifier)
      Resolves the owner id (MEMBER_ID column of STOREENT table) according to store identifier (IDENTIFIER column of STOREENT table).
      static java.lang.String resolveOwnerIDByStoreIdentifierType(StoreIdentifierType storeIdentifierType)
      Resolves the owner id (MEMBER_ID column of STOREENT table) according to store identifier noun part (StoreIdentifierType).
      static java.lang.Object resolveParametersFromMap(java.util.Map map, java.lang.Object key, java.lang.Object defaultValue)
      This method retrieves value from map.
      static java.lang.Integer resolveStoreIDByStoreIdentifier(java.lang.String storeIdentifier)
      Resolves the store id (STOREENT_ID column of STOREENT table) according to store identifier (IDENTIFIER column of STOREENT table).
      static java.lang.Integer resolveStoreIDByStoreIdentifierType(StoreIdentifierType storeIdentifierType)
      Resolves the store id (STOREENT_ID column of STOREENT table) according to store identifier noun part (StoreIdentifierType).
      static void validateURLKeyword(java.lang.String inputURL)
      Validate that the URL keyword does not contain illegal characters.
      • 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
    • Method Detail

      • resolveStoreIDByStoreIdentifier

        public static java.lang.Integer resolveStoreIDByStoreIdentifier(java.lang.String storeIdentifier)
        Resolves the store id (STOREENT_ID column of STOREENT table) according to store identifier (IDENTIFIER column of STOREENT table). If store identifier is null, empty string or can not be resolved, null will be returned.
        Parameters:
        storeIdentifier - the store identifier
        Returns:
        the store id
      • resolveStoreIDByStoreIdentifierType

        public static java.lang.Integer resolveStoreIDByStoreIdentifierType(StoreIdentifierType storeIdentifierType)
                                                                     throws DataLoadApplicationException
        Resolves the store id (STOREENT_ID column of STOREENT table) according to store identifier noun part (StoreIdentifierType). If StoreIdentifierType is null or can not be resolved, null will be returned.
        Parameters:
        storeIdentifierType - the store identifier type
        Returns:
        the store id
        Throws:
        DataLoadApplicationException - An application exception will be thrown if there was a problem resolving the store id.
      • resolveOwnerIDByStoreIdentifier

        public static java.lang.String resolveOwnerIDByStoreIdentifier(java.lang.String storeIdentifier)
                                                                throws DataLoadApplicationException
        Resolves the owner id (MEMBER_ID column of STOREENT table) according to store identifier (IDENTIFIER column of STOREENT table). If store identifier is null, empty string or can not be resolved, null will be returned.
        Parameters:
        storeIdentifier - the store identifier
        Returns:
        the owner id of the store
        Throws:
        DataLoadApplicationException - an application exception will be thrown if the store identifier can not be found.
      • resolveOwnerIDByStoreID

        public static java.lang.String resolveOwnerIDByStoreID(java.lang.String storeId)
        Resolves the owner id (MEMBER_ID column of STOREENT table) according to store id (STOREENT_ID column of STOREENT table). If store id is null, empty string or can not be resolved, null will be returned.
        Parameters:
        storeId - the store id
        Returns:
        the owner id of the store
      • resolveOwnerIDByStoreIdentifierType

        public static java.lang.String resolveOwnerIDByStoreIdentifierType(StoreIdentifierType storeIdentifierType)
                                                                    throws DataLoadApplicationException
        Resolves the owner id (MEMBER_ID column of STOREENT table) according to store identifier noun part (StoreIdentifierType). If StoreIdentifierType is null or can not be resolved, null will be returned.
        Parameters:
        storeIdentifierType - the store identifier type
        Returns:
        the owner id of the store
        Throws:
        DataLoadApplicationException - an application exception will be thrown if the store identifier can not be found.
      • resolveIdentifierByStoreID

        public static java.lang.String resolveIdentifierByStoreID(java.lang.String storeId)
        Resolves the identifier (IDENTIFIER column of STOREENT table) according to store id (STOREENT_ID column of STOREENT table). If store id is null, empty string or cannot be resolved, null will be returned.
        Parameters:
        storeId - the store id
        Returns:
        the identifier of the store
      • getStorePath

        public static com.ibm.commerce.foundation.internal.server.services.registry.StoreObject[] getStorePath(java.lang.Integer storeId,
                                                                                                               java.lang.String storeRelationshipType)
        Returns the related stores of a given type of a given store.
        Parameters:
        storeId - the store ID.
        storeRelationshipType - the store relationship type.
        Returns:
        The related stores of the given type of the given store.
      • getParameterizedString

        public static java.lang.String getParameterizedString(java.lang.String string,
                                                              java.lang.String[] parameter)
        Answers a string with each "{n}" substituted with actual text from the parameter array.
        Parameters:
        string - the string containing "{n}" to be text substituted
        parameter - the array of parameter text string
        Returns:
        the string with "{n}" substituted
      • prunedString

        public static java.lang.String prunedString(java.lang.String string,
                                                    int maxUtf8Length)
        Gets a string pruned to length bytes. This method is usually used to truncate a string so that it can be fit into a database column. The string is converted to byte array using UTF-8 encoding, then use the specified length to truncate. To avoid cut half of a multiple bytes character, the pruned string may be slightly shorter than the specified length.
        Parameters:
        string - The string to be pruned.
        maxUtf8Length - The byte length to prune to. It is usually the size of database column.
        Returns:
        the string pruned to length bytes or slightly less.
      • resolveParametersFromMap

        public static java.lang.Object resolveParametersFromMap(java.util.Map map,
                                                                java.lang.Object key,
                                                                java.lang.Object defaultValue)
        This method retrieves value from map.
        Parameters:
        map -
        key -
        defaultValue -
        Returns:
        result
      • isSearchEnabled

        public static boolean isSearchEnabled(java.lang.Integer storeId)
                                       throws java.lang.Exception
        Checks whether Search is enabled for a store.
        Parameters:
        storeId - the store id
        Returns:
        true: Search is enabled.
        false: Search is disabled or not enabled.
        Throws:
        java.lang.Exception
      • populateTI_DELTA_CATGROUP

        public static TableDataObject populateTI_DELTA_CATGROUP(java.lang.String masterCatalogId,
                                                                java.lang.String catgroupId,
                                                                java.lang.String action)
                                                         throws java.lang.Exception
        Populates the table TI_DELTA_CATGROUP for the search index rebuild.
        Parameters:
        masterCatalogId - a master catalog ID.
        catgroupId - a catalog group ID.
        action - an indexing action.
        Returns:
        the populated table data object.
        Throws:
        java.lang.Exception
      • populateTI_CATGROUP_WS

        public static TableDataObject populateTI_CATGROUP_WS(java.lang.String masterCatalogId,
                                                             java.lang.String catgroupId,
                                                             java.lang.String action,
                                                             java.lang.String taskGroup)
                                                      throws java.lang.Exception
        Populates the table TI_DELTA_CATGROUP for the search index rebuild. It only populates action for a full build.
        Parameters:
        masterCatalogId - a master catalog ID.
        catgroupId - a catalog group ID.
        action - an indexing action.
        taskGroup - a task group identifier.
        Returns:
        the populated table data object.
        Throws:
        java.lang.Exception
      • populateTI_DELTA_CATENTRY

        public static TableDataObject populateTI_DELTA_CATENTRY(java.lang.String masterCatalogId,
                                                                java.lang.String catentryId,
                                                                java.lang.String action)
                                                         throws java.lang.Exception
        Populates the table TI_DELTA_CATENTRY for the search index rebuild.
        Parameters:
        masterCatalogId - a master catalog ID.
        catentryId - a catalog entry ID.
        action - an indexing action.
        Returns:
        the populated table data object.
        Throws:
        java.lang.Exception
      • populateTI_CATENTRY_WS

        public static TableDataObject populateTI_CATENTRY_WS(java.lang.String masterCatalogId,
                                                             java.lang.String catentryId,
                                                             java.lang.String action,
                                                             java.lang.String taskGroup)
                                                      throws java.lang.Exception
        Populates the table TI_DELTA_CATENTRY for the search index rebuild. It only populates action for a full build.
        Parameters:
        masterCatalogId - a master catalog ID.
        catentryId - a catalog entry ID.
        action - an indexing action.
        taskGroup - a task group identifier.
        Returns:
        the populated table data object.
        Throws:
        java.lang.Exception
      • parseSEOLoadingParameters

        public static void parseSEOLoadingParameters()
                                              throws java.lang.Exception
        This method parse the component configuration file to get SEO loading parameters.
        Throws:
        java.lang.Exception
      • isSEOURLPatternFeatureEnabled

        public static boolean isSEOURLPatternFeatureEnabled(java.lang.Integer storeId)
                                                     throws java.lang.Exception
        Checks whether SEO is enabled for the store.
        Parameters:
        storeId - the store id
        Returns:
        true: SEO is enabled.
        false: SEO is disabled or not enabled.
        Throws:
        java.lang.Exception
      • validateURLKeyword

        public static void validateURLKeyword(java.lang.String inputURL)
                                       throws java.lang.Exception
        Validate that the URL keyword does not contain illegal characters.
        Parameters:
        inputURL - The URL to validate.
        Throws:
        java.lang.Exception
      • fixURLKeyword

        public static java.lang.String fixURLKeyword(java.lang.String originalURLKeyword)
                                              throws java.lang.Exception
        This method help to fix the special characters from the original URL keyword. The special character replace mappings are defined in configuration group named "SEORuntime" inside "WC/xml/config/com.ibm.commerce.infrastructure-fep/wc-admin-component.xml".
        Parameters:
        originalURLKeyword - The string input the original URL keyword.
        Returns:
        The fixed URL keyword.
        Throws:
        java.lang.Exception - exception
      • generateSEODefaultKeyword

        public static java.lang.String generateSEODefaultKeyword(java.lang.String name)
                                                          throws java.lang.Exception
        Generates the default keyword for a catalog group.
        Parameters:
        name - The catalog group name
        Returns:
        The default keyword
        Throws:
        java.lang.Exception
      • generateSEODefaultKeyword

        public static java.lang.String generateSEODefaultKeyword(java.lang.String name,
                                                                 java.lang.String partNumber)
                                                          throws java.lang.Exception
        Generates the default keyword for a catalog entry.
        Parameters:
        name - The catalog entry name
        partNumber - The catalog entry part number
        Returns:
        The default keyword
        Throws:
        java.lang.Exception
      • generateSEODefaultKeywordWithLanguageId

        public static java.lang.String generateSEODefaultKeywordWithLanguageId(java.lang.String urlKeyword,
                                                                               java.lang.String languageId)
                                                                        throws java.lang.Exception
        Generates URL keyword with language id as suffix. For example, if input URL keyword is "MyPartNumber" and language id is "-1", then the returned new URL keyword is "MyPartNumber--1".
        Parameters:
        urlKeyword - The existing URL keyword
        languageId - The language id
        Returns:
        The new URL keyword with language id as suffix
        Throws:
        java.lang.Exception - Exception is thrown when there is problem invoke the generateSEODefaultKeywordWithLanguageId method
      • getStoreOwnerId

        public static java.lang.Long getStoreOwnerId(java.lang.Integer storeId)
                                              throws DataLoadException
        Gets the owner ID of the specified store
        Parameters:
        storeId - The store ID
        Returns:
        The owner ID of the store
        Throws:
        DataLoadException - DataLoad exception captured
      • getRelatedCatalogStoreId

        public static java.util.ArrayList<java.lang.Integer> getRelatedCatalogStoreId(java.lang.Integer storeId)
                                                                               throws DataLoadException
        Gets the list of related catalog store IDs of the specified store
        Parameters:
        storeId - The store ID
        Returns:
        The list of related catalog store IDs
        Throws:
        DataLoadException - DataLoad exception captured
      • getRelatedShippingCalculationStoreId

        public static java.util.ArrayList<java.lang.Integer> getRelatedShippingCalculationStoreId(java.lang.Integer storeId)
                                                                                           throws DataLoadException
        Gets the list of related shipping calculation store IDs of the specified store
        Parameters:
        storeId - The store ID
        Returns:
        The list of related shipping calculation store IDs
        Throws:
        DataLoadException - DataLoad exception captured