Auto Associate Example
Create and compile <WT_HOME>src\com\ptcts\autoassociate\CustomizedAutoAssociatePartFinderCreator.java with the following source.
// package com.ptc.windchill.uwgm.cadx.autoassociate;
package com.ptcts;

import java.lang.String;
import wt.epm.EPMDocument;
import wt.epm.workspaces.EPMWorkspace;
import wt.part.WTPart;
import wt.pom.UniquenessException;
import wt.util.WTException;
import wt.util.WTPropertyVetoException;
import wt.vc.VersionControlException;
// import com.ptc.windchill.uwgm.task.autoassociate.
efaultAutoAssociatePartFinderCreator;
import com.ptc.windchill.uwgm.common.autoassociate.
efaultAutoAssociatePartFinderCreator;
// import com.ptc.windchill.cadx.autoassociate.
utoAssociatePartFinderCreator;
import com.ptc.windchill.uwgm.common.autoassociate.
utoAssociatePartFinderCreator;
import wt.type.TypedUtilityServiceHelper;
import com.ptc.windchill.uwgm.common.associate.
ssociatePartDescriptor;
import wt.inf.container.WTContainer;
import java.rmi.RemoteException;

public class CustomizedAutoAssociatePartFinderCreator extends
DefaultAutoAssociatePartFinderCreator implements AutoAssociatePartFinderCreator
{

public boolean isIsNewPart()
{
System.out.println("Invoked CustomizedAutoAssociatePartFinderCreator
:: isIsNewPart()");
return super.isIsNewPart();
}

public void setIsNewPart( boolean a_IsNewPart ) throws WTPropertyVetoException
{
System.out.println("Invoked CustomizedAutoAssociatePartFinderCreator
:: setIsNewPart()");
super.setIsNewPart(a_IsNewPart);
}

public WTPart findOrCreateWTPart(EPMDocument epmDoc, EPMWorkspace workspace)
throws WTException, WTPropertyVetoException,
VersionControlException, UniquenessException
{
System.out.println("Invoked CustomizedAutoAssociatePartFinderCreator
:: findOrCreateWTPart()");
return super.findOrCreateWTPart(epmDoc, workspace);
}

public WTPart findWTPart(EPMDocument epmDoc) throws WTException
{
System.out.println("Invoked CustomizedAutoAssociatePartFinderCreator
:: findWTPart()");
return super.findWTPart(epmDoc);
}

public WTPart createNewWTPart(AssociatePartDescriptor newPartDescriptor)
throws WTException, WTPropertyVetoException {

System.out.println("Invoked CustomizedAutoAssociatePartFinderCreator
:: createNewWTPart()");

// get epmdoc
EPMDocument epmDoc = newPartDescriptor.getSourceDoc();

// get workspace
EPMWorkspace ws = newPartDescriptor.getEPMWorkspace();

// get workspace container
WTContainer container = ws.getContainer();

// create wtpart with super class
WTPart newpart = super.createNewWTPart(newPartDescriptor);

// manipulate new part, e.g. set attributes

// return modified new part
return newpart;
}

}
도움이 되셨나요?