ccrz.cc_hk_Category.fetch

Defines legacy behavior for calling the ccrz.ccApiPublicCache.fetch method for returning the cached category tree data.

Compatibility

This class is deprecated. For existing extensions of this class, the managed package provides an example class, ccrz.ccLogicCategoryGetTreeHk, that extends the default ccrz.ccLogicCategoryGetTree logic service provider to reference methods of this class.

  • Use the ccrz.ccLogicCategoryGetTreeHk example for short-term compatibility with existing extensions of ccrz.cc_hk_Category. Migrate your extensions to ccrz.ccLogicCategoryGetTree.
  • For new solutions, extend ccrz.ccLogicCategoryGetTree.

Important

Signature

global virtual Map<String, Object> fetch(Map<String, Object>)

Inputs (Optional)

Map<String, Object> that can include the following keys:

ccrz.cc_hk_Category.PARAM_CATEGORY_ID
String that specifies the 18-digit Salesforce ID of a category to fetch subcategories for.

Outputs

Map<String, Object> that can include the following keys:

ccrz.cc_hk_Category.PARAM_CATEGORIES
List<Object> of the cached category tree data, deserialized from the ccrz.ccApiPublicCache.CONTENT output of ccrz.ccApiPublicCache.fetch.

This output is returned only when the input data doesn't include ccrz.cc_hk_Category.PARAM_CATEGORY_ID.

Note

ccrz.cc_hk_Category.PRAM_SUB_CAT
List<ccrz__E_Category__c> of one level of subcategories for the specified ccrz.cc_hk_Payment.PARAM_CATEGORY_ID.
  • This output is returned only when the input data includes ccrz.cc_hk_Category.PARAM_CATEGORY_ID.
  • In versions of CloudCraze earlier than 4.5, this output is a List<cc_bean_Category>.

Note

Example

Override the default ccrz.cc_hk_Category.fetch method to rename the top-level categories.

global virtual override Map<String, Object> fetch(Map<String, Object> inputData {
    Map<String, Object> defaultFetchResults = super.fetch(inputData);

    List<Object> categories = (List<Object>)defaultFetchResults.get(PARAM_CATEGORIES);

    for(Object category:categoryTree) {
        Map<String, Object> categoryMap = (Map<String,Object>)category;
        categoryMap.put('name', 'stringToRename' + categoryMap.get('name'));
    }

    return getTreeResults;
}