Integration mit anderen Anwendungen > CAD- und Teilebeziehungen in Windchill verwalten > Automatische Zuordnung anpassen > Beispiel für Änderung der AutoAssociatePartFinderCreator-Schnittstelle
Beispiel für Änderung der AutoAssociatePartFinderCreator-Schnittstelle
Erstellen und kompilieren Sie <WT_HOME>src\com\ptcts\autoassociate\CustomizedAutoAssociatePartFinderCreator.java mit der folgenden Quelle.
Im folgenden Beispiel wird die Aktion "Automatisch zuordnen" so angepasst, dass beim Erstellen eines neuen Teils nur das Verhalten von PTC übergangen wird.
Erstellen und kompilieren Sie die Klasse in einem unternehmensspezifischen Pfad. Beispielsweise <WT_HOME>src\com\acme\autoassociate\CustomizedAutoAssociatePartFinderCreator.java mit der folgenden Quelle.
Weitere Informationen zur Bereitstellung des benutzerdefinierten Delegate finden Sie unter AutoAssociatePartFinderCreator-Schnittstelle verwenden und ändern.
package com.ptc.windchill.uwgm.common.autoassociate;
import java.lang.String;
import wt.epm.EPMAuthoringAppType;
import wt.epm.EPMDocument;
import wt.epm.modelitems.ModelItem;
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 wt.epm.EPMDocumentType;

import wt.org.WTOrganization;
import wt.part.PartType;
import wt.part.QuantityUnit;
import wt.part.Source;

import com.ptc.windchill.uwgm.common.associate.AssociatePartDescriptor;
import com.ptc.windchill.uwgm.common.autoassociate.AutoAssociatePartFinderCreator;
import com.ptc.windchill.uwgm.common.autoassociate.WTPartUtilities;
import com.ptc.windchill.uwgm.common.autoassociate.DefaultAutoAssociatePartFinderCreator;
import com.ptc.windchill.uwgm.common.util.PrintHelper;
/*
This class is provided for testing the case where customer could customize the implementation of AutoAssociatePartFinderCreator to not create Parts for CATIA V5 authored CAD DOcuments.
*/
public class CustomizedAutoAssociatePartFinderCreator extends DefaultAutoAssociatePartFinderCreator {
EPMAuthoringAppType catiaV5AuthApp = EPMAuthoringAppType.toEPMAuthoringAppType("CATIAV5");
@Override
public WTPart createNewWTPart(AssociatePartDescriptor partDescriptor)
throws WTException, WTPropertyVetoException, VersionControlException, UniquenessException {
System.out.println(
"Invoked CustomizedAutoAssociatePartFinderCreator extends DefaultAutoAssociatePartFinderCreator :: createNewWTPart() ");
EPMDocument epmDoc = partDescriptor.getSourceDoc();
// if epmdoc is authored by CATIAV5 do not create any new WTPart
if (epmDoc.getAuthoringApplication().equals(catiaV5AuthApp))
return null;
WTPart part = super.createNewWTPart(partDescriptor);
System.out.println("epmDoc is " + epmDoc);
System.out.println("New WTPart created is " + part);
return part;
}
@Override
public WTPart findOrCreateWTPart(EPMDocument doc, ModelItem modelItem, EPMWorkspace workspace)
throws WTException, WTPropertyVetoException, VersionControlException, UniquenessException {
System.out.println("Invoked CustomizedAutoAssociatePartFinderCreator :: findOrCreateWTPart(EPMDocument doc, ModelItem modelItem, EPMWorkspace workspace)");
return super.findOrCreateWTPart(doc, modelItem, workspace);
}
@Override
public WTPart findOrCreateWTPart(EPMDocument epmDoc, EPMWorkspace workspace)
throws WTException, WTPropertyVetoException, VersionControlException, UniquenessException {
System.out.println("Invoked CustomizedAutoAssociatePartFinderCreator :: findOrCreateWTPart(EPMDocument doc, EPMWorkspace workspace)");
return super.findOrCreateWTPart(epmDoc, workspace);
}
}
War dies hilfreich?