Extending the Atom feed Java class to support the new parameter
Create a Java class that extends from the MarketingSpotData
Java
class. To add the business logic required to support your custom parameter,
you must override the buildMarketingTriggerParameters
method
in the class. The new class must detect the custom parameter in the
URL. If the parameter is present, the new class must add the parameter
and value to the list of trigger parameters passed to the marketing
services.
Before you begin
Procedure
Example
package com.mycompany.commerce.marketing.rest.resources;
import java.util.Map;
import javax.ws.rs.core.MultivaluedMap;
import com.ibm.commerce.marketing.rest.resources.MarketingSpotData;
public class MarketingSpotDataExt extends MarketingSpotData {
private static final String PARAM_LOYALTY_ID = "loyaltyId";
protected String buildMarketingTriggerParameters(Map<String, String> parameters) {
// Get all parameters from the URI.
MultivaluedMap<String, String> map = uri.getQueryParameters();
// Prepare all the additional parameters for the expression.
String loyaltyIdValue = map.getFirst(PARAM_LOYALTY_ID);
if (loyaltyIdValue != null && loyaltyIdValue.length() > 0) {
parameters.put(PARAM_LOYALTY_ID, loyaltyIdValue);
}
return super.buildMarketingTriggerParameters(parameters);
}
}