Document Attachment Differences
ERP Connector relies upon the Document Attachment Difference logic to determine the changes to document associations since a RevisionControlled object (such as a WTPart) was last published. This difference information identifies what information must be sent in order to synchronize the data with your ERP systems.
The differences are returned as enumerations of com.ptc.windchill.esi.esidoc.PartDocInfo objects. The PartDocInfo class is a transient class that represents the attachment of a document to a RevisionControlled object.
There are several different associations that represent documentation for a Revision Controlled object. The following document associations are applicable to a WTPart object:
wt.doc.WTDocument associated with wt.part.WTPart via a Described By association
wt.doc.WTDocumentMaster associated with wt.part.WTPart via a References association
wt.epm.EPMDocument associated with wt.part.WTPart via a Build History association
wt.epm.EPMDocument association with wtpart.WTPart via a Described By association
wt.doc.WTDocument associated with wt.esi.ERPMaterial (that represents thegiven WTPart object) via a Described By association
wt.doc.WTDocumentMaster associated with wt.esi.ERPMaterial (that represents the given WTPart object) via a References association
wt.epm.EPMDocument association with the wt.esi.ERPMaterial (that represents the given WTPart object) via a Described By association
wt.doc.WTDocument associated with com.ptc.windchill.enterprise.data.EnterpriseData (that represents the given WTPart object or com.ptc.windchill.enterprise.data.EnterpriseData ) via a Described By association
wt.doc.WTDocumentMaster associated com.ptc.windchill.enterprise.data.EnterpriseData (that represents the given WTPart object or com.ptc.windchill.enterprise.data.EnterpriseData) via a References association
wt.epm.EPMDocument association with the com.ptc.windchill.enterprise.data.EnterpriseData (that represents the given WTPart object or com.ptc.windchill.enterprise.data.EnterpriseData) via a Described By association
Procedure
Procedures for extending classes using the Windchill Information Modeler are defined in the Windchill Customization Guide. 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.
(For more details, see Customizing service properties in the Windchill Customization Guide.)
Example
The following example illustrates how to extend the com.ptc.windchill.esi. esidoc.PartDocInfo class and modify the default behavior for generating document URLs.
Instead of generating a URL to the document properties page, this example generates a URL to the document content.
The source code is located at
<Windchill>/codebase/com/ptc/windchill/esi/examples/Example5MyPartDocInfo.java.
These are the contents of the sample file:
package com.ptc.windchill.esi.examples;
import com.ptc.windchill.esi.esidoc.PartDocInfo; import java.util.HashMap;
import wt.doc.Document;
import wt.fc.ObjectIdentifier; import wt.fc.Persistable; import wt.fc.PersistenceHelper;
import wt.httpgw.GatewayServletHelper; import wt.httpgw.URLFactory;
import wt.util.WTException;
public class Example5MyPartDocInfo extends PartDocInfo
{
public String getDocumentURL()
{String url = null;
try
{
// Generate a URL to download the document content.
URLFactory urlFactory = new URLFactory(); HashMap map = new HashMap();
map.put("action", "DownloadContent"); map.put("oid", getDocumentOID());
url = GatewayServletHelper.buildAuthenticatedHREF(urlFactory, "wt.enterprise.URLProcessor", "URLTemplateAction", map);
}
catch (WTException e)
{
// Use the default logic which generates a URL to display
// the document properties.
url = super.getDocumentURL();
}
return url;
}
private String getDocumentOID() throws WTException
{
Persistable p = (Persistable)getDocument();
ObjectIdentifier oid = PersistenceHelper.getObjectIdentifier(p);
return oid.getStringValue();
Consider the following:
The package statement ensures 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 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 com.ptc.windchill.esi.esidoc.PartDocInfo.
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/Example5.properties) that contains the specification for the example implementation.
wt.services/svc/default/com.ptc.windchill.esi.esidoc.PartDocInfo/null
/java.lang.Object/0=com.ptc.windchill.esi.examples. Example5MyPartDocInfo/duplicate
Was this helpful?