HCL Commerce Version 9.1.8.0 or later

Query classes in the query-api.jar file

Classes that are useful for customizing queries are described.

For more information about how to use these classes, see Extending the Query Service.

ZkConfigService.java
This class included in the query-api.jar acts as a stub. You can make use of common default functions for adding, removing, updating configuration data from the ZooKeeper configuration server. You can use the functions provided in the stub to compile custom java code. When the custom package is deployed on the query container, the call from the custom code will execute the functions available in the default helper class to fetch the data according to the implementation of the function. Below is the class from the query-api.jar.
package com.hcl.commerce.search.internal.config;

import java.util.List;
import java.util.Map;
/*
 * Licensed Materials - Property of HCL Technologies Limited. (C) Copyright HCL Technologies Limited 1996, 2020.
 */
/*
 * This class is a stub generated to enable users to use OOB class methods at runtime
*/
public class ZkConfigService {
	
	/**
	 * This method is use call zk connector to add configuration data.
	 * 
	 * @param test
	 */
	public Map<String, String> addConfigurationData(String nodeName, String jsonString, String locale, String envType) {
		//Empty stub method
		return null;
	}
	/**
	 * This method is use call zk connector to update configuration data.
	 * 
	 * @param test
	 */
	public Map<String, String> updateConfigurationData(String nodeName, String jsonString, String locale, String envType) {
		return null;
	}
	/**
	 * This method is use to get the data from ZooKeeper node.
	 * 
	 * @param nodePath
	 * @return
	 */
	public Object getNodeData(String nodeName, String locale, String envType) {
		return null;
	}
	/**
	 * This method is use to get the data from ZooKeeper node.
	 * 
	 * @param nodePath
	 * @return
	 */
	public List getNodeChilds(String nodePath) {
		
		return null;
	}

}
StoreHelper.java
This class acts as a stub. You can use common functions for fetching information about the store to be used in custom code. You can use functions provided in the stub to compile the custom java code. When the custom package is deployed on the query container, the call from the custom code will execute the functions available in the default helper class to fetch the data.
package com.hcl.commerce.search.internal.util;

/*
 * Licensed Materials - Property of HCL Technologies Limited. (C) Copyright HCL Technologies Limited 1996, 2020.
 */
/*
 * This class is a stub generated to enable users to use OOB class methods at runtime
*/
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.hcl.commerce.search.expression.SearchCriteria;

/**
 * <P>
 * This utility class will host utility methods used for stores and extended
 * sites.
 * </P>
 */
public class StoreHelper {

	/**
	 * This method is used to get the store type for a given store id.
	 * 
	 * @param storeId The store id.
	 * @return Array of StoreObject
	 */
	/*
	 * public static StoreObject[] getStorePath(String storeId, String langId)
	 * throws Exception { return null; }
	 */

	/**
	 * Need be cached finds the store's default contract
	 * 
	 * @param storeId the facing store identifier based on the STORE table
	 * @return The default contract for the store
	 */
	public static String getDefaultContract(String storeId, String langId) throws Exception {
		return "";
	}

	/**
	 * Returns checkEntitlement flag for the profile.
	 * 
	 * @param iSearchCriteria Java representation of XPath expression
	 * @param profileName     The name of the profile.
	 * @param storeId         The store id which to determine entitlement flag.
	 * @return checkEntitlement
	 */
	public static String getCheckEntitlementFlag(SearchCriteria searchCriteria, String profileName, String storeId,
			String langId) {
		return "";
	}

	/**
	 * @param storeId the store id
	 * @return the default catalog id.
	 * @throws Exception Exception is thrown when there is problem to get the
	 *                   default catalog id.
	 */
	public static String getDefaultCatalogId(String storeId, String langId) throws Exception {
		return "";
	}

	/**
	 * finds the Online Store Default Fulfillment Center Identifier based on the
	 * STORE index
	 * 
	 * @param storeId the facing store identifier based on the STORE table
	 * @return The default fulfillment center Id of the specified online store id
	 * @throws SearchApplicationException
	 */
	public static Integer getStoreDefaultFulfillmentCenterId(String storeId, String langId) throws Exception {
		return null;
	}

	/**
	 * This method checks if a feature is enabled.
	 * 
	 * @param storeent_id
	 * @param relType
	 * @param name
	 * @return
	 */
	public static String getStoreConfigurationByRelTypeAndConfigName(String storeent_id, String relType, String name,
			String langId) throws Exception {
		return "";
	}

	/**
	 * The method is used to get validated contract as Long List, if contractId were
	 * passed in the url, then validate those contract with db, and only when the
	 * specified contract list are belongs to the contracts which retrieved from db,
	 * the validation is passed, otherwise if contractId were not specified, use
	 * default contract
	 * 
	 * @param strUserId
	 * @param strStoreId
	 * @param specifiedContractIdsAsList
	 * @return contractIds validatedContractIds as ArrayList<Long>
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	public static ArrayList<String> getUsableContractAsList(String strUserId, String strStoreId,
			List<String> specifiedContractIdsAsList, SearchCriteria searchCriteria) throws Exception {
		return new ArrayList<String>();
	}

	/**
	 * Returns priceMode flag for the search profile then from store
	 * 
	 * @param profileName The name of the profile.
	 * @param storeId     The store id which to determine price mode
	 * @return priceMode
	 */
	public static String getPriceMode(String profileName, String storeId, String langId) {
		return "";
	}

	/**
	 * Returns compatiblePrice mode in storeconf table
	 * wc.search.priceMode.compatiblePriceIndex=1.0 means contracted price index
	 * wc.search.priceMode.compatiblePriceIndex=1.1 means old standard offer price
	 * index
	 * 
	 * @param storeId The store id which to determine compatiblePrice flag.
	 * @return compatiblePriceIndexMode
	 */
	public static String getCompatiblePriceIndexMode(String storeId) {
		return "";
	}

	/**
	 * Returns the qualified image path with store prefix of the given store. If the
	 * input image path is relative path, attach the store prefix to it and return.
	 * If the input image path is fully qualified URL (started with 'http'), do
	 * nothing, just return the input image path back.
	 * 
	 * @param imagePath     the input image path
	 * @param storeId       the Store id
	 * @param isPreviewMode true if in preview mode
	 * @return the qualified image path with store prefix if the image path is not a
	 *         fully qualified URL.
	 */
	public static String getQualifiedImagePath(String imagePath, String storeId, boolean isPreviewMode, String langId)
			throws Exception {
		return "";
	}

	/**
	 * Returns the qualified image path with store prefix of the given store. If the
	 * input image path is relative path, attach the store prefix to it and return.
	 * If the input image path is either a fully qualified URL (started with 'http')
	 * or matches any one of the business defined uri prefixes, just return the
	 * input image path back.
	 * 
	 * @param imagePath          the input image path
	 * @param storeId            the Store id
	 * @param isPreviewMode      true if in preview mode
	 * @param aSelectionCriteria selectionCriteria
	 * @return the qualified image path with store prefix if the image path is not a
	 *         fully qualified URL or match predefined uri prefix.
	 */
	public static String getQualifiedImagePath(String imagePath, String storeId, boolean isPreviewMode,
			SearchCriteria aSearchCriteria) throws Exception {
		return "";
	}

	/**
	 * Returns the store preview URL prefix of the given store. For example,
	 * '/webapp/wcs/preview/Aurora/' or '/webapp/remote/preview/Aurora/' or
	 * 
	 * @param storeId Store identifier
	 * @return the store preview URL prefix
	 */
	public static String getStorePreviewURLPrefix(String storeId, String langId) {
		return "";
	}

	/**
	 * Returns the store URL prefix of the given store. For example,
	 * '/wcsstore/Aurora/'.
	 * 
	 * @param storeId Store identifier
	 * @return the store URL prefix
	 */
	public static String getStoreURLPrefix(String storeId, String langId) {
		return "";
	}

	public static String getStoreConfigurationPropertyValueByName(String storeId, String propertyName, String langId)
			throws Exception {
		return "";
	}

	/**
	 * retrieves the uri list specified in the wc-component.xml file
	 * 
	 * @param aSelectionCriteria
	 * @return the business defined uri prefix, e.g. http, //
	 */
	private static String getUriPrefix(SearchCriteria aSearchCriteria) {
		return "";
	}

	private static String convertImagePathToLowerCase(String imagePath) {
		return "";
	}

	/**
	 * Decides if the path passed in starts with any one of the uri prefixes
	 * (commaSeparatedString) defined in the wc-component.xml
	 * 
	 * @param commaSeparatedString : this is the comma separated string, containing
	 *                             a list of defined uri prefixes
	 * @param valToBeSearched      : the value you want to be searched for a match
	 *                             using the elements inside commaSeparatedString
	 * @return a boolean
	 */
	private static boolean pathStartWithUriPreFix(String commaSeparatedString, String valToBeSearched) {
		return false;
	}

	/**
	 * This method is use to get the store master catalog.
	 * 
	 * @param storeId
	 * @return
	 * @throws Exception
	 */
	public static String getMasterCatalogIdByStoreId(String storeId, String langId) throws Exception {
		return "";
	}

	/**
	 * This method is use to get the catalog inventory system.
	 * 
	 * @param masterCatalogId
	 * @return
	 */
	public static Integer getMasterCatalogInventorySystem(String masterCatalogId) {
		return null;
	}

	/**
	 * Gets the store's default language id
	 * 
	 * @param storeId the facing store identifier based on the store index
	 * @return The default language for the store
	 */
	public static String getDefaultLanguageId(String storeId, String langId) throws Exception {
		return "";
	}

	/**
	 * Return the list of supported currencies for store.
	 * 
	 * @param storeId the facing store identifier based on the store index
	 * @return The supported currencies for store
	 */
	public static List<Object> getStoreSupportedCurrnecies(String storeId, String langId) throws Exception {
		return new ArrayList<Object>();
	}

	/**
	 * Return the languageId based on locale for store.
	 * 
	 * @param storeId the facing store identifier based on the store index.
	 * @param locale  the locale name
	 * @return the languageId.
	 */
	public static List<Object> getStoreSupportedCatalog(String storeId, String langId) throws Exception {
		return new ArrayList<Object>();
	}

	/**
	 * Return the locale name based on language id for store.
	 * 
	 * @param storeId    the facing store identifier based on the store index.
	 * @param languageId the languageId
	 * @return the locale name.
	 */
	public static String getLocaleNameByLanguageId(String storeId, String languageId) throws Exception {
		return "";
	}

	/**
	 * Return the languageId based on locale for store.
	 * 
	 * @param storeId the facing store identifier based on the store index.
	 * @param locale  the locale name
	 * @return the languageId.
	 */
	public static String getLanguageIdByLocaleName(String storeId, String locale, String langId) throws Exception {
		return "";
	}

	/**
	 * Return the languageId based on locale for store.
	 * 
	 * @param storeId the facing store identifier based on the store index.
	 * @param locale  the locale name
	 * @return the languageId.
	 */
	public static Map<String, String> getLanguages(String storeId, String langId) throws Exception {
		return new HashMap<String, String>();
	}

	/**
	 * After buyer contract were retrieved from db, filter out by starttime and
	 * endtime.
	 * 
	 * @param strUserId
	 * @param strStoreId
	 * @return ArrayList
	 */
	public static ArrayList<Long> getEligibleBuyerContractFromDB(String strUserId, String strStoreId) {
		return new ArrayList<Long>();
	}

	/**
	 * Return string value of the given field name in the current in-memory result
	 * set
	 * 
	 * @param fieldName
	 * @return
	 */
	private static String getColumnAsString(Object[] record, int fieldLocation) {
		return "";
	}

	/**
	 * Need be cached finds the store's default contract
	 * 
	 * @param storeId the facing store identifier based on the STORE table
	 * @return The default contract for the store
	 */
	public static String getStoreType(String storeId, String langId) throws Exception {
		return "";
	}

	public static List<Object> getBaseContract(String storeId, String langId) throws Exception {
		return new ArrayList<Object>();
	}

	public static List<Long> getActiveOrganizationId(Long userId) {
		return null;
	}

	public static boolean isMemberOf(Long userId, Long mbrgrpId, Long orgId) {
		return false;
	}

	/**
	 * Returns the qualified attachment path with store directory of the given store
	 * as prefix. If the input path is relative path, attach the store directory as
	 * prefix to it and return. If the input path is fully qualified URL (started
	 * with 'http'), do nothing, just return the input path back.
	 * 
	 * @param attachmentPath the input attachment Asset path
	 * @param storeId
	 * @param langId
	 * @return qualified attachment path with store directory prefix
	 */
	public static String getQualifiedAttachmentPath(String attachmentPath, String storeId, String langId) {
		return "";
	}

	/**
	 * This method returns store directory using store id. For example: For store id
	 * 1, method returns ExtendedSitesCatalogAssetStore
	 * 
	 * @param storeId Store Identifier
	 * @param langId
	 * @return store Directroy
	 */
	public static String getStoreDirectory(String storeId, String langId) {
		return "";
	}

	public static HashMap<String, Object> getStoreFeatures(String storeId, String langId) throws Exception {
		return new HashMap<String, Object>();
	}

	public static boolean isDeepSearchEnabled(String storeId, String langId) throws Exception {
		return false;
	}

	/**
	 * This method checks if the store image path already have prefix added in url
	 * 
	 * @param imagePath the input imagePath
	 * @param storeId   Store Identifier
	 * @param langId
	 * @return true/false
	 */
	public static boolean isImagePathWithPrefix(String imagePath, String storeId, String langId) {
		return false;
	}
}