You are here:
ProdCatalogInfoOpenInterface
Get the catalog information for a product, in JSON format.
Type
Loosely typed
Triggered When
Any API that gets a list of products triggers the ProdCatalogInfoOpenInterface.
Called In
The following classes call the ProdCatalogInfoOpenInterface:
-
DefaultProductHierarchyImplementation.cls
-
HierarchicalProductListGenerator.cls
-
ProductHierarchyService.cls
Signature
Access |
Signature |
|---|---|
global |
|
Default Implementation
DefaultProdCatalogInfoOpenImplementationDefaultProdCatalogInfoOpenImplementation
Other Implementations
None
Input Parameters
methodName
Required
Type: String
The name of the method to execute, for example, getCatalogInfoForProduct returns the catalog information for a given product ID.
inputMap
Required
Type: Map<String, Object>
The input map contains a price book entry (pbe) of type Map<String,Object>.
Output Parameters
None
Sample Implementation
global with sharing class DefaultProdCatalogInfoOpenImplementation implements VlocityOpenInterface{
global Boolean invokeMethod(String methodName, Map<String,Object> inputMap, Map<String,Object> outputMap, Map<String,Object> options) {
Boolean success = true;
try
{
if (outputMap == null)
{
outputMap = new Map<String, Object>();
}
if (methodName == 'getCatalogInfoForProduct')
{
getCatalogInfoForProduct(inputMap, outputMap);
}
}catch(Exception e){
success = false;
outputMap.put('error', e.getMessage());
outputMap.put('childCatalogsList', new List<Id>());
}
return success;
}
/*
* Default: Get Catalog info that is stored in Product2.CategoryData__c field
* User may want to modify this to get Catalog info from a different cache
*/
private void getCatalogInfoForProduct(Map<String,Object> inputMap, Map<String,Object> outputMap) {
Map<String,Object> pbe = (Map<String,Object>)inputMap.get('pbe');
List<JSONCategory> catJSON = new List<JSONCategory>() ;
Product2 prod = (Product2)pbe.get('Product2');
String serializedCatJSON;
if (prod != null)
{
serializedCatJSON = prod.CategoryData__c;
}
if (serializedCatJSON != null) {
catJSON = (List<JSONCategory>) JSON.deserialize(serializedCatJSON, List<JSONCategory>.class);
}
outputMap.put('productCatInfo',catJSON);
}
}

