進階自訂 > Business Logic Customization > Customizing MPMLink > Customizing MPMLink Browsers > Implement Custom Logic when BOM Transformer Session is Launched
Implement Custom Logic when BOM Transformer Session is Launched
Best Practice Name and Classification
Implement custom logic when BOM Transformer session is launched
Objective
Provide customization guidelines for implementing custom logic when BOM Transformer session is launched
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 implement custom logic when a BOM Transformer session is launched:
1. Write a new custom delegate that extends the com.ptc.windchill.baseclient.server.delegate.StructureBroswerDelegate interface. For example, if the new delegate is CustomStructureBroswerDelegate, the sample code is as follows:
public class CustomStructureBroswerDelegate implements StructureBroswerDelegate{
@Override
public void processBrowserLoad(NmCommandBean commandBean, HttpServletRequest request) throws WTException {
// customization code
}
@Override
public void processBrowserUnload(NmCommandBean commandBean, HttpServletRequest request) throws WTException {
// customization code
}
@Override
public void processBrowserPing(NmCommandBean commandBean, HttpServletRequest request) throws WTException {
// customization code
}
}
* 
The public void processBrowserPing(NmCommandBean commandBean, HttpServletRequest request) throws WTException method is called only when you specify true value in the com.ptc.windchill.enterprise.associativity.part.mpml.mapsb_ping property. This property can be found inMAPSB.wt.properties.xconf located at com/ptc/windchill/enterprise/associativity/part/mpml/mapsb. The default value of the property is false.
2. Update the com/ptc/windchill/enterprise/associativity/part/mpml/mapsb/MAPSB-service.properties.xconf file for the entry of a StructureBroswerDelegate and update the serviceClass with newly added custom implementation. For example, using the custom delegate CustomStructureBroswerDelegate, the sample code is as follows:
<Service context="default" name="com.ptc.windchill.baseclient.server.delegate.StructureBroswerDelegate">
<Option serviceClass="com.custom.delegate.CustomStructureBroswerDelegate" requestor="null" selector="mapsb" cardinality="singleton"/>
</Service>
這是否有幫助?