進階自訂 > Business Logic Customization > Customizing MPMLink > Customizing MPMLink Browsers > Merging Filter Criteria with Smart Collection in BOM Transformer
Merging Filter Criteria with Smart Collection in BOM Transformer
Best Practice Name and Classification
Merge filter criteria and smart collection in BOM Transformer
Objective
Provide customization guidelines for merging a filter with a smart collection in MASPB
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
Open a smart collection on which an existing filter, for example, saved NavigationCriteria is applied. Now apply a new or custom filter, for example, client NavigationCriteria on the smart collection. To merge the new and the existing filter criteria, that is, merge saved NavigationCriteria and client NavigationCriteria, perform the following procedure:
1. Write a new custom delegate that extends the existing com.ptc.windchill.associativity.delegate.OpenAMInStructureBrowserDelegate delegate.
For example, CustomOpenAMInStructureBrowserDelegate.
2. Override the following method and add the customization code:
public NavigationCriteria mergeNC(NavigationCriteria savedNc, NavigationCriteria clientNc)throws WTException;
The sample code is as follows:
import com.ptc.windchill.associativity.delegate.OpenAMInStructureBrowserDelegate;
import wt.filter.NavigationCriteria;
import wt.util.WTException;
public class CustomOpenAMInStructureBrowserDelegate
extends OpenAMInStructureBrowserDelegate{

@Override
public NavigationCriteria mergeNC(NavigationCriteria savedNc, NavigationCriteria clientNc) throws WTException {
// customization code to put filters or configuration specification from savedNc to clienNC
return clientNc;
}
}
3. Update the xconf entry for a new class. For example, CustomOpenAMInStructureBrowserDelegate.
4. Remove an entry for OpenAMInStructureBrowserDelegate delegate in com/ptc/windchill/associativity/xconfs/associativity.service.properties.xconf file.
The sample code is as follows:
<Service context="default" name="com.ptc.windchill.associativity.delegate.OpenInStructureBrowserDelegate">
<Option cardinality="singleton" requestor="wt.facade.persistedcollection.PersistedCollectionHolder" serviceClass="com.ptc.windchill.associativity.delegate.OpenMCInStructureBrowserDelegate"/>
<Option cardinality="singleton" requestor="wt.fc.util.PersistedProperty" serviceClass="com.ptc.windchill.baseclient.server.delegate.OpenSearchResultInStructureBrowserDelegate"/>
<Option cardinality="singleton" requestor="wt.associativity.accountability.AccountabilityMap" serviceClass="com.custom.delegate.CustomOpenAMInStructureBrowserDelegate"/>
</Service>
這是否有幫助?