ドキュメント添付資料差異
ERP Connector はドキュメント添付資料差異ロジックを使用して、RevisionControlled オブジェクト (WTPart など) が最後にパブリッシングされた後のドキュメント関連付けに対する変更を特定します。この差異情報により、データを ERP システムと同期化するために送信する必要がある情報が明らかになります。
差異は com.ptc.windchill.esi.esidoc.PartDocInfo オブジェクトの列挙として返されます。PartDocInfo クラスは、RevisionControlled オブジェクトへのドキュメントの添付資料を表す一時的なクラスです。
制御リビジョンオブジェクトのドキュメンテーションを表すいくつかの異なる関連付けがあります。WTPart オブジェクトには次のドキュメント関連付けが適用されます。
詳細関連付けによる wt.doc.WTDocumentwt.part.WTPart の関連付け
参照関連付けによる wt.doc.WTDocumentMasterwt.part.WTPart の関連付け
構築履歴関連付けによる wt.epm.EPMDocumentwt.part.WTPart の関連付け
詳細関連付けによる wt.epm.EPMDocumentwtpart.WTPart の関連付け
詳細関連付けによる wt.doc.WTDocument と (特定の WTPart オブジェクトを表す) wt.esi.ERPMaterial の関連付け
参照関連付けによる wt.doc.WTDocumentMaster と (特定の WTPart オブジェクトを表す) wt.esi.ERPMaterial の関連付け
詳細関連付けによる wt.epm.EPMDocument と (特定の WTPart オブジェクトを表す) wt.esi.ERPMaterial の関連付け
詳細関連付けによる wt.doc.WTDocument と (特定の WTPart オブジェクトまたは com.ptc.windchill.enterprise.data.EnterpriseData を表す) com.ptc.windchill.enterprise.data.EnterpriseData の関連付け
参照関連付けによる wt.doc.WTDocumentMaster と (特定の WTPart オブジェクトまたは com.ptc.windchill.enterprise.data.EnterpriseData を表す) com.ptc.windchill.enterprise.data.EnterpriseData の関連付け
詳細関連付けによる wt.epm.EPMDocument と (特定の WTPart オブジェクトまたは com.ptc.windchill.enterprise.data.EnterpriseData を表す) com.ptc.windchill.enterprise.data.EnterpriseData の関連付け
手順
Windchill Information Modeler を使用してクラスを拡張する手順については、Windchill Customization Guide を参照してください。デフォルトのインタフェース実装の単純な拡張では、次のプロセスを使用します。
1. エディタまたは任意の統合開発環境 (IDE) を使用して java ソースファイルを定義します。
* 
ERP コネクタのインストール時に提供されたクラスを修正したり置き換えたりしないでください。これらのファイルは将来ソフトウェアがリリースされる際に置き換えられる可能性があります。
2. java ソースファイルを Windchill コードベースにコンパイルします。
3. 該当するプロパティを変更して新しい実装を指定します。
(詳細については、Windchill Customization Guide の「サービスプロパティのカスタマイズ」を参照してください。)
以下の例は、com.ptc.windchill.esi. esidoc.PartDocInfo クラスを拡張してドキュメント URL 生成のデフォルト動作を修正する方法を示しています。
この例では、ドキュメントのプロパティページへの URL を生成する代わりに、ドキュメントのコンテンツへの URL を生成しています。
ソースコードは以下の場所にあります。
<Windchill>/codebase/com/ptc/windchill/esi/examples/Example5MyPartDocInfo.java
サンプルファイルのコンテンツを以下に示します。
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:
package ステートメントは、Java コンパイラの出力が正しいディレクトリに書き込まれるようにします。
Java import ステートメントは、クラスの継承と実装の詳細を指定するために必要です。
以下の方法によってこの例をコンパイルできます。
Windchill をインストールしたときに定義された <Windchill> ディレクトリ内から、次のコマンドを使用して Windchill シェルを起動します。
bin/windchill shell
Java コンパイラを使用してクラスをコンパイルします。
javac -d ./codebase ./codebase/com/ptc/windchill/esi/examples/*.java
新しい実装をアクティブ化するには、wt.properties を修正して、com.ptc.windchill.esi.esidoc.PartDocInfo のサービス実装を指定するプロパティファイルを指定します。
wt.services.applicationcontext.WTServiceProviderFromProperties. customPropertyFiles
ファイル名の後ろに、新しい実装の仕様が含まれているプロパティファイルの名前をコンマで区切って追加します。実装例の仕様が含まれているプロパティファイルの例 (<Windchill>/codebase/com/ptc/windchill/esi/examples/Example5.properties) が用意されています。
wt.services/svc/default/com.ptc.windchill.esi.esidoc.PartDocInfo/null
/java.lang.Object/0=com.ptc.windchill.esi.examples. Example5MyPartDocInfo/duplicate
これは役に立ちましたか?