Add Custom Parameters in the BOM Transformer URL Address
Best Practice Name and Classification
Add custom parameters in the BOM Transformer URL address
Objective
Provide customization guidelines for adding custom parameters in the URL address of BOM Transformer.
Prerequisite Knowledge
To apply this best practice, you need to have an understanding of the following:
• Basic knowledge of MPMLink and BOM structure
• Basic development involving Java
• The management of *-actions.xml, *-actionmodels.xml, and *.xconf files customizations
Solution Elements
Perform the following steps to add custom parameters in the URL of BOM Transformer:
1. Write a new custom delegate that extends com.ptc.windchill.enterprise.associativity.asb.server.delegate.DefaultAddBrowserParametersDelegate delegate and overrides Map<String, String> getAdditionlParamenters(NmCommandBean commandBean, HttpServletRequest request) method from delegate. For example, if the new delegate is CustomAddBrowserParametersDelegate, the sample code is as follows:
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import com.ptc.netmarkets.util.beans.NmCommandBean;
import com.ptc.windchill.enterprise.associativity.asb.server.delegate.DefaultAddBrowserParametersDelegate;
public class CustomAddBrowserParametersDelegate extends DefaultAddBrowserParametersDelegate{
@Override
protected Map<String, String> getAdditionlParamenters(NmCommandBean commandBean, HttpServletRequest request) {
// Customization code
Map<String, String> additionlParamenters = super.getAdditionlParamenters(commandBean, request);
additionlParamenters.put("param1", "value1");
return additionlParamenters;
}
}
2. Update the com/ptc/windchill/enterprise/associativity/asb/xconf/asb.service.properties.xconf file for the entry of AddBrowserParametersDelegate and change serviceClass to newly added class. For example, using custom delegate CustomAddBrowserParametersDelegate, the sample code is as follows:
<Service context="default" name="com.ptc.windchill.enterprise.associativity.asb.server.delegate.AddBrowserParametersDelegate">
<Option cardinality="singleton" requestor="null" selector="mapsb" serviceClass="com.custom.delegate.CustomAddBrowserParametersDelegate "/>
</Service>