You are here:
PricingElementServiceImplementationH
PricingElementServiceImplementationH is an event hook interface that enables pre- and post-invoke interception of PricingElementServiceImplementation methods.
After the PricingElementServiceImplementationH is defined in the Interface Implementations, an open implementation can be associated with it. An example of this is the SamplePricingElementServiceHookImpl class included in the telco unmanaged package.
PricingElementServiceImplementationH can intercept the priceLineItems method in the PricingElementServiceImplementation. Therefore, the hook implementation method names include the suffixes .PreInvoke and .PostInvoke, such as priceLineItems.PreInvoke and priceLineItems.PostInvoke as seen in the sample implementation.
There is a limitation of 36 characters for hook interface names which is why the hook name for PricingElementServiceImplementation ends with just the "H," instead of "HookInterface."
Triggered When
The PricingElementServiceImplementationH interface is triggered before and after the PricingElementServiceImplementation invoke method is called.
Called In
The PricingElementServiceImplementation invoke method calls the PricingElementServiceImplementationH interface.
Signature
Access | Signature |
|---|---|
public |
|
Default Implementation
There are no default implementations for hook interfaces. You must create hook interface implementations. A sample implementation for PricingElementServiceImplementationH is included below.
Other Implementations
None
Sample Implementation
/**
* This class is used as a sample hook implementation to the PricingElementServiceImplementation.
* To use this class, create a PricingElementServiceImplementationH interface under All Tabs > Interface Implementations
* and set SamplePricingElementServiceHookImpl as the default and active implementation class. The invokeMethod of this
* hook class will be called both before and after the invokeMethod of the PricingElementServiceImplementation.
* The methods will be suffixed with PreInvoke and PostInvoke respectively to indicate whether it is being called before
* or after the PricingElementServiceImplementation method.
*/
global with sharing class SamplePricingElementServiceHookImpl implements vlocity_cmt.VlocityOpenInterface{
global Boolean invokeMethod(String methodName, Map<String, Object> input, Map<String, Object> output, Map<String, Object> options) {
try
{
System.debug('--- SamplePricingElementServiceHookImpl methodName: ' + methodName);
if (methodName.equalsIgnoreCase('priceLineItems.PreInvoke'))
{
priceLineItemsPreInvoke(input, output,options);
}
else if (methodName.equalsIgnoreCase('priceLineItems.PostInvoke'))
{
priceLineItemsPostInvoke(input, output,options);
}
return true;
}
catch (Exception ex)
{
System.debug('--- Exception: ' + ex.getMessage());
System.debug('--- Stack Trace: ' + ex.getStackTraceString());
throw ex;
}
}
private void priceLineItemsPreInvoke(Map<String, Object> input, Map<String, Object> output, Map<String, Object> options) {
// do pre invoke logic here
}
private void priceLineItemsPostInvoke(Map<String, Object> input, Map<String, Object> output, Map<String, Object> options) {
// do post invoke logic here
}
}
