Product Structure Differences
ERP Connector relies upon the product structure difference logic to determine the changes to the product structure since the part was last published. This difference information identifies what information must be published in order to synchronize the data with your target enterprise systems.
The differences are returned by the Object Comparison Framework (OCF) as a HashMap containing logical type identifiers of relevant links as keys and certain Maps as values. In addition to the included part, the WTPartUsageLink object is used to further query and access the substitutes and reference designators specified for the included part.
Procedure
To customize, extend the default implementation and override specific methods.
Procedures for extending classes using the
Windchill Information Modeler are defined in the
Customizations section. For simple extensions of the default interface implementation use this process:
1. Define the java source file using the editor or Integrated Development Environment (IDE) of your choice.
|
Do not modify or replace any classes that were provided when ERP Connector was installed. These files may be replaced by future software releases.
|
2. Compile the java source file into the Windchill codebase.
3. Change the appropriate property to point to the new implementation.
Example
The following example illustrates how to extend the wt.part.PartUsageInfo class and modify the default behavior for comparison. The example compares line numbers in addition to the default comparisons.
The source code is located at
<Windchill>/codebase/com/ptc/windchill/esi/examples/Example4MyPartUsageInfo.java. These are the contents of the sample file:
package com.ptc.windchill.esi.examples; import wt.part.LineNumber;
import wt.part.PartUsageInfo; import wt.part.WTPartUsageLink; import wt.util.WTException;
public class Example4MyPartUsageInfo extends PartUsageInfo
{
protected boolean isDifferent(PartUsageInfo info)
{
boolean result = super.isDifferent(info);
if (result == false)
{
Example4MyPartUsageInfo other = (Example4MyPartUsageInfo)info; WTPartUsageLink thisLink = this.getPartUsageLink(); WTPartUsageLink otherLink = other.getPartUsageLink(); LineNumber thisLine = thisLink.getLineNumber();
LineNumber otherLine = otherLink.getLineNumber();
if (thisLine == null)
{
if (otherLine != null)
// different line number result = true;
}
}
else
{
if (otherLine == null || thisLine.equals(otherLine) == false)
{
// different line number result = true;
}
}
}
return result;
}
}
Consider the following:
◦ The package statement ensures that the output of the java compiler is written to the correct directory.
◦ The java import statements are required by the class’ inheritance and implementation specifics.
You can compile the example by doing the following:
◦ Launch the Windchill shell, from within the <Windchill> directory that was defined when you installed Windchill PDMLink with this command:
bin/windchill shell
◦ Use the java compiler to compile the class.
javac -d ./codebase ./codebase/com/ptc/windchill/esi/examples/*.java
To activate the new implementation, modify wt.properties to specify a property file that specifies the service implementation for wt.part.PartUsageInfo.
wt.services.applicationcontext.WTServiceProviderFromProperties. customPropertyFiles
Append the name of a property file that contains the specification for the new implementation, using a comma to separate the file names. There is an example property file (<Windchill>/codebase/com/ptc/windchill/esi/examples/Example4.properties ) that contains the specification for the example implementation.
wt.services/svc/default/wt.part.PartUsageInfo/null/java.lang.Object/0=com.ptc.windc hill.esi.examples.Example4MyPartUsageInfo/duplicate