com.ibm.commerce.contract.catalogfilter.util

Class CatalogFilterHelper

  • java.lang.Object
    • com.ibm.commerce.contract.catalogfilter.util.CatalogFilterHelper


  • public class CatalogFilterHelper
    extends java.lang.Object
    The helper class for catalog filter runtime use.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static java.lang.String assignToCatalogGroupIdField(java.lang.String expressionValue)
      Assign the expression value to catalog group id field.
      static java.lang.String assignToProductSetIdField(java.lang.String expressionValue)
      Assign the expression value to product set id field.
      static java.lang.String assignToStoreIdField(java.lang.String expressionValue)
      Assign the expression value to store id field.
      static java.lang.Long[] checkCatalogGroupEntitlementByContract(java.lang.Long[] catalogGroupIds, java.lang.Boolean isAdminMode, java.lang.String contractIdsString)
      This method whether the passed in array of catalog group internal identifiers is explicity included or excluded in regards to entitlement.
      static java.lang.String escapeSolrCharacters(java.lang.String oldString)
      Escape characters for solr query expression.
      static com.ibm.commerce.contract.catalogfilter.CatalogFilter getCatalogFilterById(java.lang.Long catalogFilterId)
      Get a CatalogFilter instance by catalog filter ID.
      static com.ibm.commerce.contract.catalogfilter.CatalogFilter getCatalogFilterByIdWithAdminMode(java.lang.Long catalogFilterId)
      Get a CatalogFilter instance by catalog filter ID.
      static java.lang.Long getEligibleCatalogFilterId(java.lang.Long contractId)
      Get eligible catalog filter ID for contract
      static java.lang.Long getEligibleCatalogFilterId(java.lang.Long contractId, java.lang.Long memberId)
      Get eligible catalog filter ID for contract
      static java.util.Map<java.lang.Long,java.util.Map<java.lang.Long,java.util.List<java.lang.Long>>> getEntitledCatalogEntryRelationMapByContract(CatalogNavigationViewType catalogNavigationView, java.lang.String contractIdsString)
      Get entitled catalog entry ralations for CatalogNavigationViewType object.
      static java.lang.String getExpressionWithFieldNameAndValue(java.lang.String fieldName, java.lang.String value)
      Get expression with field name and value identified.
      static java.lang.Long getParentCatgroupIdById(java.lang.Long catalogId, java.lang.Long catgroupId)
      Get parent catalog group ID by ID
      static java.lang.String getSelectAllExpression()
      Get "select all" expression, i.e, in Solr, it's "*:*"
      static java.lang.String getSolrIndexColumnName(java.lang.Integer storeId, java.lang.String identifier)
      Return the Solr index name for the given identifier for the store.
      static java.lang.Integer[] getStorePath(java.lang.Integer storeId)
      Get Store Path IDs
      static java.lang.String wrapInAndClause(java.util.List<? extends java.lang.Object> snippetList)
      Wrap the expression snippet list in "AND" clause.
      static java.lang.String wrapInClause(java.lang.String expressionSnippet)
      Wrap the expression snippet in clause.
      static java.lang.String wrapInNotClause(java.lang.String expressionSnippet)
      Wrap the expression snippet in "NOT" clause.
      static java.lang.String wrapInOrClause(java.util.List<? extends java.lang.Object> snippetList)
      Wrap the expression snippet list in "OR" clause.
      • Methods inherited from class java.lang.Object

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

      • getCatalogFilterById

        public static com.ibm.commerce.contract.catalogfilter.CatalogFilter getCatalogFilterById(java.lang.Long catalogFilterId)
                                                                                          throws ECException
        Get a CatalogFilter instance by catalog filter ID.
        Parameters:
        catalogFilterId - A catalog filter ID.
        Returns:
        A CatalogFilter Instance.
        Throws:
        ECException - ECException could be thrown if any error occurred.
      • getCatalogFilterByIdWithAdminMode

        public static com.ibm.commerce.contract.catalogfilter.CatalogFilter getCatalogFilterByIdWithAdminMode(java.lang.Long catalogFilterId)
                                                                                                       throws ECException
        Get a CatalogFilter instance by catalog filter ID.
        Parameters:
        catalogFilterId - A catalog filter ID.
        Returns:
        A CatalogFilter Instance.
        Throws:
        ECException - ECException could be thrown if any error occurred.
      • getParentCatgroupIdById

        public static java.lang.Long getParentCatgroupIdById(java.lang.Long catalogId,
                                                             java.lang.Long catgroupId)
                                                      throws ECException
        Get parent catalog group ID by ID
        Parameters:
        catalogId - The catalog ID
        catgroupId - The catalog group ID
        Returns:
        The parent catalog group ID
        Throws:
        ECException - Exception could be thrown if parsing error occurred.
      • wrapInAndClause

        public static java.lang.String wrapInAndClause(java.util.List<? extends java.lang.Object> snippetList)
        Wrap the expression snippet list in "AND" clause. We want to simply the composed clause: ClauseA AND *:* = ClauseA, ClauseB OR *:* = *:*
        Parameters:
        snippetList - The snippet list.
        Returns:
        A expression string
      • wrapInOrClause

        public static java.lang.String wrapInOrClause(java.util.List<? extends java.lang.Object> snippetList)
        Wrap the expression snippet list in "OR" clause. We want to simply the composed clause: ClauseA AND *:* = ClauseA, ClauseB OR *:* = *:*
        Parameters:
        snippetList - The snippet list.
        Returns:
        A expression string.
      • wrapInNotClause

        public static java.lang.String wrapInNotClause(java.lang.String expressionSnippet)
        Wrap the expression snippet in "NOT" clause.
        Parameters:
        expressionSnippet - The expression snippet.
        Returns:
        The wrapped expression.
      • wrapInClause

        public static java.lang.String wrapInClause(java.lang.String expressionSnippet)
        Wrap the expression snippet in clause.
        Parameters:
        expressionSnippet - The expression snippet.
        Returns:
        The wrapped expression.
      • assignToStoreIdField

        public static java.lang.String assignToStoreIdField(java.lang.String expressionValue)
        Assign the expression value to store id field.
        Parameters:
        expressionValue - The expression value.
        Returns:
        The store id field expression.
      • assignToCatalogGroupIdField

        public static java.lang.String assignToCatalogGroupIdField(java.lang.String expressionValue)
        Assign the expression value to catalog group id field.
        Parameters:
        expressionValue - The expression value.
        Returns:
        The catalog group id field expression.
      • assignToProductSetIdField

        public static java.lang.String assignToProductSetIdField(java.lang.String expressionValue)
        Assign the expression value to product set id field.
        Parameters:
        expressionValue - The expression value
        Returns:
        The product set id field expression.
      • getSelectAllExpression

        public static java.lang.String getSelectAllExpression()
        Get "select all" expression, i.e, in Solr, it's "*:*"
        Returns:
        The "select all" expression.
      • getStorePath

        public static java.lang.Integer[] getStorePath(java.lang.Integer storeId)
        Get Store Path IDs
        Parameters:
        storeId - A store ID
        Returns:
        Array of store path ID
      • getEligibleCatalogFilterId

        public static java.lang.Long getEligibleCatalogFilterId(java.lang.Long contractId)
                                                         throws ECException
        Get eligible catalog filter ID for contract
        Parameters:
        contractId - A contract ID
        Returns:
        The catalog filter ID
        Throws:
        ECException - ECException could be thrown if any errors occurred.
      • getEligibleCatalogFilterId

        public static java.lang.Long getEligibleCatalogFilterId(java.lang.Long contractId,
                                                                java.lang.Long memberId)
                                                         throws ECException
        Get eligible catalog filter ID for contract
        Parameters:
        contractId - A contract ID
        memberId - the member ID
        Returns:
        The catalog filter ID
        Throws:
        ECException - ECException could be thrown if any errors occurred.
      • getExpressionWithFieldNameAndValue

        public static java.lang.String getExpressionWithFieldNameAndValue(java.lang.String fieldName,
                                                                          java.lang.String value)
        Get expression with field name and value identified.
        Parameters:
        fieldName - A field name.
        value - The field value.
        Returns:
        The expression.
      • escapeSolrCharacters

        public static java.lang.String escapeSolrCharacters(java.lang.String oldString)
        Escape characters for solr query expression.
        Parameters:
        oldString - The old solr query expression.
        Returns:
        The escaped solr query expression.
      • getSolrIndexColumnName

        public static java.lang.String getSolrIndexColumnName(java.lang.Integer storeId,
                                                              java.lang.String identifier)
                                                       throws com.ibm.commerce.foundation.internal.common.exception.FoundationApplicationException
        Return the Solr index name for the given identifier for the store.
        Parameters:
        storeId - storeId The store Id for the request.
        identifier - The logical name of the search attribute.
        Returns:
        The Solr index name.
        Throws:
        com.ibm.commerce.foundation.internal.common.exception.FoundationApplicationException - if there is a problem initializing the registry due to datasource configuration or executing the SQL statement.
      • checkCatalogGroupEntitlementByContract

        public static java.lang.Long[] checkCatalogGroupEntitlementByContract(java.lang.Long[] catalogGroupIds,
                                                                              java.lang.Boolean isAdminMode,
                                                                              java.lang.String contractIdsString)

        This method whether the passed in array of catalog group internal identifiers is explicity included or excluded in regards to entitlement.

        The command CheckCatalogGroupEntitlementCmd will be used to determine the catalog group entitlement in a batch.
        Parameters:
        catalogGroupIds - The list of catalog groups to be checked for entitlement.
        isAdminMode - A flag indicating if this is in admin mode. If not provided, a default value of false will be used.
        contractIdsString - if it is not empty, then just use it to do entitlment, otherwise, use the ones in cmd context
        Returns:
        Long[] An array of the entitled catalog group IDs. If there are no entitled catalog groups, an empty array will be returned. If the user is entitled to all catalog groups, NULL will be returned.
        See Also:
        CheckCatalogGroupEntitlementCmd, CatalogDataBean#isAdminMode()
      • getEntitledCatalogEntryRelationMapByContract

        public static java.util.Map<java.lang.Long,java.util.Map<java.lang.Long,java.util.List<java.lang.Long>>> getEntitledCatalogEntryRelationMapByContract(CatalogNavigationViewType catalogNavigationView,
                                                                                                                                                              java.lang.String contractIdsString)
                                                                                                                                                       throws DataMediatorException,
                                                                                                                                                              ECException
        Get entitled catalog entry ralations for CatalogNavigationViewType object.

        The structure of the relations map should be one of the followings.

        1. For Product, key => Product ID, value => Map<SKU ID, List(empty)>
        2. For Bundle, key => Bundle ID, value => Map<key => Component ID, value => List(SKU IDs)>
        Parameters:
        catalogNavigationView -
        contractIdsString - if it is not empty, then just use it to do entitlment, otherwise, use the ones in cmd context
        Returns:
        entitled catalog entry ralations map.
        Throws:
        DataMediatorException - DataMediatorException could be thrown if any DB operation failed.
        ECException - ECException could be thrown if get trading agreements failed.