進階自訂 > Business Logic Customization > Customizations for PDM > Customizing Auto Associate > Using and Modifying the AutoAssociatePartFinderCreator Interface
  
Using and Modifying the AutoAssociatePartFinderCreator Interface
AutoAssociate uses the implementation of the AutoAssociatePartFinderCreator interface to perform the following actions:
To search a for matching part
To create a new part
By default, the AutoAssociate action uses the default implementation of this interface to perform the above-mentioned tasks; however, you can customize the how they are performed using a customized implementation of AutoAssociatePartFinderCreator interface.
The interface is located in com.ptc.windchill.cadx.autoassociate.AutoAssociatePartFinderCreator.
The AutoAssociatePartFinderCreator interface supports the following methods:
findOrCreateWTPart method used to search for matching part for a selected EPMDocument or ModelItem
CreateNewWTPart method used to create new part
findWTPart method (no longer used)
isNewPart method (no longer used)
setIsNewPart method (no longer used
)
* 
Even though some methods of the interface are deprecated and no longer used, the implementation class should have dummy implementations of these methods in order to compile the class.
Use the following procedure to implement a customized AutoAssociatePartFinderCreator:
1. Derive your customized class as follows:
public class CustomFinderCreator implements
AutoAssociatePartFinderCreator
2. Override the following methods:
public WTPart findOrCreateWTPart(EPMDocument epmDoc, EPMWorkspace workspace)
This method is invoked for each document selected for auto-associate to search for any matching part. You can customize the criteria used to search the part, and the returned part is used by the action to associate to the document.
public WTPart findOrCreateWTPart(EPMDocument doc, ModelItem modelItem, EPMWorkspace workspace)
This method is invoked for each document selected for auto-associate to search for any matching part. You can customize the criteria used to search the part, and the returned part is used by the action to associate to the document.
public WTPart createNewWTPart(AssociatePartDescriptor newPartDescriptor)
This method is invoked for each document selected for auto-associate to create a new part. You can customize the properties of the newly created part. The newly created part is associated to the document by the auto-associate action.
* 
The following methods are deprecated and not currently used by the action; however, you need to provide a dummy implementation of these methods to compile the class properly.
public boolean isIsNewPart()
public void setIsNewPart(boolean a_IsNewPart)
public WTPart findWTPart(EPMDocument epmDoc)
public WTPart findWTPart(EPMDocument epmDoc, ModelItem modelItem)
Compile the file and place the class in any appropriate location
3. Set the preference Operation > Auto Associate > Custom Class for Auto Associate Part to specify the name of the class that implements AutoAssociatePartFinderCreator interface.
4. Restart the method server