IMPORTANT: This section describes how to filter REST calls made from within a view model. Please note that dependencies exist between view models such that data retrieved by one view model may be used by another. Care must be taken when filtering view model REST calls so that you do not filter out data needed by another view model.

REST calls may also be made from within view models as the view models interact with the server while doing do their work. Filtering the responses for view model REST calls uses the context object and filter map combination described in Programmatically determine the correct response filter key. The context objects are defined within the view models themselves, however, so all you have to do to filter REST calls made from view models is create the filter map and upload it in an application-level JavaScript module (see Include Application-level JavaScript Modules for more information on creating this type of module).

The following filter map example shows the top-level objects that define which response filters are used for REST calls made from view models. It is not necessary to include all of these top-level objects in your filter map, only those for REST calls you want to filter. However, keep in mind that the top-level objects you include in your filter map will overwrite any existing top-level objects.

define(

  //-------------------------------------------------------------------
  // DEPENDENCIES
  //-------------------------------------------------------------------
  ['ccStoreConfiguration'],

  //-------------------------------------------------------------------
  // Module definition
  //-------------------------------------------------------------------
  function(CCStoreConfiguration) {

    'use strict';

    return {
      onLoad : function() {

        console.log("Loading Application Level JS");

           var priorityList = ["endpoint","page","identifier"];

           var filterMap = {
           "getCollection":{
              "megaMenuNavigation": {"ccFilterConfigKey": "categoryNavData"},
              "categoryNavigation": {"ccFilterConfigKey": "categoryNavData"}
            },
            "listProducts":{
              "productListingData": {"ccFilterConfigKey": "PLPData"},
              "collectionWidget": {"ccFilterConfigKey": "collectionData"},
              "getProductData": {"ccFilterConfigKey": "productData"},
              "getProductDataAndRedirect": {"ccFilterConfigKey": "productData"}
            }
            "listMembers": {
              "ccFilterConfigKey": "key-name"
            },
            "getGiftWithPurchaseChoices": {
              "ccFilterConfigKey": "key-name"
            },
            "getAllOrdersForProfile": {
              "ccFilterConfigKey": "key-name"
            },
            "listScheduledOrdersByProfile": {
              "ccFilterConfigKey": "key-name"
            },
            "getItemType": {
              "ccFilterConfigKey": "key-name"
            },
            "getCurrentProfile": {
              "userData": {"ccFilterConfigKey": "key-name"}
            },
            "getAllPrices": {
              "ccFilterConfigKey": "key-name"
            },
            "getStockStatus": {
              "productStockStatus": {"ccFilterConfigKey": "key-name"},
              "stockStatusForProdValidation": {"ccFilterConfigKey": "key-name"}
            },
            "getPaymentGroup": {
              "ccFilterConfigKey": "key-name"
            },
            "getOrder": {
              "orderForSubmit": {"ccFilterConfigKey": "key-name"},
              "templateOrder": {"ccFilterConfigKey": "key-name"},
            },
            "getScheduledOrder": {
              "loadOrder": {"ccFilterConfigKey": "key-name"}
            },
            "getPage": {
              "home": {
                "layoutOnly":{"ccFilterConfigKey": "key-name"},
                "cachableData":{"ccFilterConfigKey": "key-name"},
                "currentData":{"ccFilterConfigKey": "key-name"}
              }
            },
            "getIncompleteOrder": {
              "loadCartForProfile": {"ccFilterConfigKey": "key-name"},
              "refreshCart": {"ccFilterConfigKey": "key-name"}
            },
            "getStockStatuses": {
              "stockStatusesForCart": {"ccFilterConfigKey": "key-name"},
              "stockStatsToValidateCart":{"ccFilterConfigKey": "key-name"},
              "stockStatsForItem":{"ccFilterConfigKey": "key-name"}
            },
            "getMetadata": {
              "dynamicProperties": {"ccFilterConfigKey": "key-name"}
            },
            "listSkus": {
              "skuListing": {"ccFilterConfigKey": "key-name"}
            }
          };
          CCStoreConfiguration.getInstance().updateFiltersToUse(newFilterMap);
      },
    }
  }
);

The following tables describe the data that is returned for the view model REST calls to assist you as you decide what calls you want to filter.


Copyright © 1997, 2017 Oracle and/or its affiliates. All rights reserved. Legal Notices