進階自訂 > Business Logic Customization > Customizing Windchill Visualization Services > Interference Detection > Solution
  
Solution
Customize Interference Detection by implementing public WVS API’s in custom code and making WVS aware of this custom code via appropriate WVS property changes.
Prerequisite Knowledge
To apply this best practice, you need to have an understanding of the following:
Java Development
WVS Interference Detection concepts such as Interference Definition and Interference Report.
The Additional Resources section below includes references to many or all of these subjects.
Solution Elements
Element
Type
Description
InterferenceDetectionHooks.java
Java file
Contains example code for implementing the customizations that this document describes.
Runtime Location: Windchill/prog_examples/wvs/com/ptc/wvs/InterferenceDetectionHooks.java
InterferenceInfo.class
Class file
Represents all information regarding a single Interference contained in an Interference Report generated by the Creo View Client Adapter. Used by the WVS Inteference processor for creating new Interference objects or updating existing ones.
Runtime Location: <Windchill>/codebase/com/ptc/wvs/server/publish/InterferenceInfo.class
WTDocument.class
Class file
An Interference Definition is a Subtype of WTDocument.
Runtime Location: <Windchill>/codebase/wt/doc/WTDocument.class
wvs.properties.xconf
XConf file
Contains specific properties to configure the Windchill Visualization Service to utilize specific customization code.
Runtime Location: <Windchill>/codebase/WEB-INF/conf/wvs.properties.xconf
LifeCycleManagedWtMarkUp
Class file
All Interference and Interference Report objects in Windchill are LifeCycleManagedWtMarkUps.
Runtime Location: <Windchill>/codebase/ wt/viewmarkup/LifeCycleManagedWtMarkUp.class
Procedure : Invoke Customization for Determining Interference Attributes
Complete the following steps to create a custom hook for setting Interference attributes such as Assignee, Description, State, User Severity, and Name.
1. Create a Java class with a static method in which the arguments and return type matches the method defined in the following example. This customization will return a set of attribute values that will be used to update an existing Interference object and will return a different set of attribute values for new Interference objects that will be created.
For a comprehensive example, see InterferenceDetectionHooks.java located in <Windchill>/prog_examples/wvs/com/ptc/wvs.
2. Update <Windchill>/codebase/wvs.properties.xconf to configure the WVS Interference processor to call the customization hook. For more information on how to accomplish this step, review the documentation for the property “interferencedetection.report.getinterferenceattributevaluesmethod” in wvs.properties.xconf. For configuring this example, the XConf entry will be:
<Property name="interferencedetection.report.
getinterferenceattributevaluesmethod " default
="ext.customhooks.MyCustomClass/getInterferenceAttributeValues"/>
Procedure : Invoke Customization to Change the Default Set of Rules for Determining Interference Equivalency.
The WVS Interference processor needs to determine if an Interference described in an Interference Report generated by a Creo View Client Adapter is equal to any Interference objects already associated to the Interference Definition that exists in an Interference Report created in a prior execution. The default set of rules used for determining if an existing Interference object is equal to an Interference described in an Interference Report are:
The Master References of the two parts that are interfering must be equal.
The Component Instance Paths of the two parts that are interfering must be equal.
The type of Interference must be the same.
Complete the following steps to create a custom hook for overriding the default rules for determining Interference equivalency.
1. Create a Java class with a static method in which the arguments and return type matches the method defined in the following example. This customization will use all the default rules for determining equivalency first by calling a WVS API. If the API returns “true”, then make an additional check to be sure that the Interference item’s group names are also equivalent.
For a comprehensive examples, see InterferenceDetectionHooks.java located in <Windchill>/prog_examples/wvs/com/ptc/wvs.
2. Update <Windchill>/codebase/wvs.properties.xconf to configure the WVS Interference processor to call the customization hook.
For more information on how to accomplish this step, review the documentation for the property “interferencedetection.report.getinterferenceattributevaluesmethod” in the wvs.properties.xconf.
For configuring this example, the XConf entry will be: <Property name="interferencedetection.report.isinterferenceequivalentmethod " default="ext.customhooks.MyCustomClass/isInterferenceEquivalent"/>