Offer and Price Engine Java Extension

Offer and Price Engine (OPE) can be customized to support the functionalities that can be integrated by using the Java extension.

All OPE web services can be extended using custom configurations in the specified hooks while requests execution. All the web service requests are executed sequentially in the phases and the custom hooks are provided for each phase. Following are the phases and the hooks provided for every phase:
GetOffer
Phase Hook in ope_config file
Custom Validation customOfferValidationRule
Custom Filter Processing customOfferFilterRules
Custom Eligibility customEvaluateEligibilityRule
Custom Publishing customOfferResponseRule
Validate Offer
Phase Hook in ope_config file
Custom Validation customOfferValidationRule
Custom Publishing customOfferResponseRule
GetProductInformation
Phase Hook in ope_config file
Custom Filter Processing customOfferFilterRules (If the request contains query elements)
Custom Publishing customProdInfoResponseRule
GetPrices
Phase Hook in ope_config file
Custom Processing customPriceProcessingRule
Custom Publishing customPriceResponseRule
GetPriceInformation
Phase Hook in ope_config file
Custom Processing priceCustomInfoProcessingRule
Custom Publishing customPriceResponseRule

Prerequisites

For all the files used for the implementation of this Java extension, you need to refer the Java API References .

To extend the execution of OPE web service requests during different phases, add the java-based custom classes as described in the following steps:

Procedure

  1. To implement the custom logic by extending the interfaces, create a java project such as opeExtensions.zip, and complete the following steps:
    1. Copy the opeClient.jar file from the $AF_HOME/lib/opeClient.jar , add as dependency for the java project. The opeClient.jar file contains all the interfaces required to extend the engine execution rules.
    2. To add the rule actions, extend abstract class "com.tibco.aff.ope.extension.AbstractExtensionRuleAction".
    3. To add the rule conditions, extend abstract class "com.tibco.aff.ope.extension.AbstractExtensionRuleCondition".
  2. Create a JAR file of the project and copy it in the {TIBCO_HOME}/af/4.0/roles/ope/standalone/lib directory.
  3. Navigate to {TIBCO_HOME}/af/4.0/roles/configurator/standalone/config directory, and in the OPE extension Class Configuration section, open the ConfigValues_OPE.xml file.
  4. In the ConfigValues_OPE.xml file, configure the classID and qualified class name of the custom classes by using double colons (::) as separator.
    For example,
    <Category description="OPE extension Class Configuration" name="Custom class names for the ope extension" visibility="Advanced">
    			<ConfValue description="Fully qualified class names for OPE extension classes" name="OPE Extension Class names" propname="com.tibco.af.ope.ope.ext.classes" sinceVersion="3.0" visibility="Basic">
    				<ConfList>
    					<ConfListString value="customCharEligibility::ope.extension.rule.action.CustomCharEligibilityAction"/>
    					<ConfListString value="getOfferOnlyCondition::ope.extension.rule.action.GetOfferOnlyCondition"/>
    					<ConfListString value="getOfferOnly::ope.extension.rule.action.GetOfferOnlyAction"/>
    					<ConfListString value="validateOfferOnlyCondition::ope.extension.rule.action.ValidateOfferOnlyCondition"/>
    					<ConfListString value="validateOfferOnly::ope.extension.rule.action.ValidateOfferOnlyAction"/>
    				</ConfList>
    			</ConfValue>
    		</Category>
  5. Navigate to the {TIBCO_HOME}/af/4.0/roles/configurator/standalone/config directory, and configure the custom class in the ope_config.xml rule sequence configuration file.
    For example, to configure custom classes for validation, add them under following events:
    1. Add the action class under "action" element.
    2. Add the condition class under "condition" element.
    Ensure that the beanName is the classID configured in ConfigValues_OPE.xml and all the other details remain the same.
    Note: The <sequencedRule> indicates an element where all the actions are executed sequentially. One condition can have multiple actions inside a <sequencedRule> element. Multiple <sequenceRule> elements are used to separate conditions and their corresponding actions.
    Example for "customOfferValidation":
    <!-- Custom Validation Class goes here -->
    		<sequencedECARuleSet ruleSetName="customOfferValidationRule" runOnFailure="false" runOnError="false">
            	<event eventName="customOfferValidation" type="event">
                	<eventSource>
                    	<endpointType>
                        	<uri>sape://localhost</uri>
                    	</endpointType>
                    	<inMessageType>
                        	<javabean/>
                    	</inMessageType>
                	</eventSource>
                	<lifetime/>
        		</event>
        		<sequencedRule>
        			<action actionType="bean">
            			<actionBean beanId="customActionClassId" methodName="execute" interface="com.tibco.aff.eca.base.Action"/>
    				</action>
    				<condition conditionType="bean">
    					<conditionBean beanId="customConditionClassId" methodName="evaluate" interface="com.tibco.aff.eca.base.Condition"/>
        			</condition>
        		</sequencedRule>
        	</sequencedECARuleSet>
    
        	
    Example for "customEvaluateEligibility":
    <!-- Custom Validation Class goes here -->
        	<sequencedECARuleSet ruleSetName="customEvaluateEligibilityRule" runOnFailure="false" runOnError="false">
            	<event eventName="customEvaluateEligibility" type="event">
                	<eventSource>
                    	<endpointType>
                        	<uri>sape://localhost</uri>
                    	</endpointType>
                    	<inMessageType>
                        	<javabean/>
                    	</inMessageType>
                	</eventSource>
                	<lifetime/>
            	</event>
            	<sequencedRule>
                	<condition conditionType="bean">
                    	<conditionBean beanId="getOfferOnlyCondition" methodName="evaluate" interface="com.tibco.aff.eca.base.Condition"/>
                	</condition>
                	<action actionType="bean">
                    	<actionBean beanId="getOfferOnly" methodName="execute" interface="com.tibco.aff.eca.base.Action"/>
                	</action>
            	</sequencedRule>
        	</sequencedECARuleSet>
    Note: All the web services are supported for the Java customization.