高度なカスタマイズ > ビジネスロジックのカスタマイズ > PDM のカスタマイズ > ダウンロードサービスでのパラメータのカスタマイズ
ダウンロードサービスでのパラメータのカスタマイズ
既成の委任
Windchill には、CAD ドキュメントに関連する追加情報をカスタムシステムパラメータとして渡すための既成のメカニズムが用意されています。
パラメータをカスタマイズするには、サーバー側プリファレンス、「Workgroup Manager クライアント」 > 「カスタムシステム属性とファイルプロパティをマッピング」をサイトレベルで設定します。
この値は、CAD ツールでパラメータまたはプロパティとして表示される CAD ドキュメントに関連するオブジェクトの追加属性のリストです。
この値は、CAD プロパティと Windchill 属性のペアのコンマ区切りリストであり、次のフォーマットで指定します。
<name_of_CAD_property>:<relatedObjectCode>.<WindchillAttributeName>
ここで、
説明
有効な値
name_of_CAD_property
これは CAD ツールでのパラメータまたはプロパティの名前です。
PART_REVISION
relatedObjectCode
これは関連オブジェクトの識別に使用される文字列です
docMaster
associatedPart
relatedECN
promote
WindchillAttributeName
これは Windchill における関連オブジェクトの属性の論理名または内部名です
CAD ドキュメントマスターのソフトタイプ属性
部品の属性
関連部品のブール、日付、整数、実数、実数 (単位付き)、または文字列タイプのソフトタイプ属性
lifeCycleState
lifecycleTemplate.name
name
number
orgid
view.identity
partType
関連 ECN の場合
number
orgid
resolutionDate
プロモートの場合
number
promotionDate
orgid
approvers
approveDates
reviewers
reviewDates
* 
ソフトタイプの属性の場合、CAD ツールに送信される値は、オブジェクトの「情報ページ」に表示される表示値です。表示値では「属性処理」プリファレンスと「タイプおよび属性の管理」設定が使用されますが、レンダリング用のデータユーティリティを使用した複雑な表示のカスタマイズはサポートされていません。
この機能は、パラメータを挿入するときに使用可能な、カスタマイズされたサーバー側の委任 CustomModeledAttributesDelegate がない場合にのみ使用できます (カスタム委任については次のセクションを参照)。
関連付けられた部品の場合:
この機能は、CAD ドキュメントとの間に「オーナー」、「貢献イメージ」、「イメージ」、「貢献コンテンツ」タイプの関連付けがある部品をサポートします。
選択される部品バージョンは、CAD ドキュメントの情報ページの関連部品テーブルとほぼ同じです。
同じ部品の複数のリビジョンが CAD ドキュメントに関連付けられている場合、各部品の最新リビジョンが返されます。
サーバー側プリファレンス「操作」 > 「自動関連付け」 > 「CAD ドキュメントに複数部品の構築を許可」を「はい」に設定することで、複数の構築関連付けを許可するようにシステムが設定されている場合、複数の部品が返されることがあります。この場合、各関連部品の情報が区切りフォーマットで返されます。使用される区切り記号は、サーバー側プリファレンス「Workgroup Manager クライアント」 > 「複数の関連オブジェクトに使用するカスタムシステム属性の区切り記号」によって定義されます。
関連 ECN の場合:
CAD ドキュメントリビジョンが結果オブジェクトとして変更通知に含まれている場合、ECN に関する属性が CAD パラメータに送信されます。
CAD ドキュメントリビジョンが複数の変更通知に含まれている場合、使用される区切り記号は、サーバー側プリファレンス「Workgroup Manager クライアント」 > 「複数の関連オブジェクトに使用するカスタムシステム属性の区切り記号」によって定義されます。
却下された ECN はリストされません。
プロモーションリクエストの場合:
CAD ドキュメントバージョンがプロモーションリクエストに含まれている場合、プロモーションリクエストに関する属性が CAD パラメータに送信されます。
CAD ドキュメントバージョンが複数のプロモーションリクエストに含まれている場合、使用される区切り記号は、サーバー側プリファレンス「Workgroup Manager クライアント」 > 「複数の関連オブジェクトに使用するカスタムシステム属性の区切り記号」によって定義されます。
却下されたプロモーションリクエストはリストされません。
* 
resolutionDate は、CAD ドキュメントに関連する変更通知に基づきます。日付の形式を設定するには、「タイプおよび属性の管理」でフォーマットを設定します。内部名が resolutionDate である変更通知属性のフォーマットを設定します。
promotionDate は、CAD ドキュメントに関連するプロモーションリクエストに基づきます。日付の形式を設定するには、「タイプおよび属性の管理」でフォーマットを設定します。内部名が promotionDate であるプロモーションリクエスト属性のフォーマットを設定します。
approveDatesreviewDates は、プロモーションリクエストに関連するワークアイテムに基づきます。日付の形式を設定するには、「タイプおよび属性の管理」でフォーマットを設定します。内部名が thePersistInfo.modifyStamp であるワークアイテム属性のフォーマットを設定します。
カスタム委任
ビジネスプロセスでほかの属性を CAD ツールに伝達する必要がある場合、ダウンロード時に、Windchill から提供されるサーバー側委任を使用してパラメータを Creo Parametric モデルに挿入できます。このメカニズムを利用して、サーバーから Creo Parametric に情報を渡し、その情報をほかの Creo Parametric パラメータと同じように使用できます (たとえば、図面フォームに情報を配置する場合など)。"PTC" または "PROI" で始まるパラメータは、予約済みのシステムパラメータと見なされ、カスタマイズによって適用することはできません。カスタマイズでこれらのパラメータを追加しても、ダウンロードサービスで無視されます。
* 
この機能はサードパーティの CAD ツールに統合されたすべての Windchill Workgroup Manager に適用可能です。
* 
カスタマイズされたパラメータは、ダウンロード時にクライアントに提供されます。これに対し、PTC_WM_ITERATION などのシステムパラメータは、Creo Parametric セッションでも Windchill 操作 (チェックインなど) 後のローカルキャッシュでも更新されません。
たとえば、カスタマイズされたパラメータに CAD ドキュメント番号の値が割り当てられている場合、その値はモデルのダウンロード時にクライアントに提供されます。後から CAD ドキュメント番号が変更されても、Creo Parametric セッションまたはクライアントキャッシュ内の値は自動的に更新されません。
カスタマイズを可能にするのは、Windchill のサービス代理メカニズムです。以下の手順でカスタマイズプロセスを説明します。
1. PTC クラスとは別の顧客固有の場所 (<WT_ホーム>\com\acme など) に、インタフェース ModeledAttributesDelegate を実装する Java クラスを作成します。このインタフェースの定義は以下のとおりです。
package com.acme.download;
import static org.junit.Assert.assertTrue;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import com.ptc.windchill.uwgm.proesrv.c11n.DefaultModeledAttributesDelegate;
import java.util.Iterator;
import wt.epm.EPMDocument;
import wt.fc.collections.WTCollection;
import wt.fc.collections.WTHashSet;
import wt.preference.PreferenceHelper;
import wt.util.WTException;
/**
* When CustomizedModeledAttributesDelegate is configured following modeled attributes would be added to the CAD
* Document, which would be combination of custom CURRENT_DATE parameter along with Parameters configured in mentioned
* preference "Mapping Custom System Attributes and File Properties". For eg.When preference "Mapping Custom System
* Attributes and File Properties" set with value as
* -CREO_PART_REVISION:associatedPart.revision,CREO_PART_VIEW:associatedPart.view.identity,ECN_NUMBER:relatedECN.number
* Modeled attributes on CAD Document would be- CREO_PART_REVISION=A, ECN_NUMBER=00192, CREO_PART_VIEW=Design,
* CURRENT_DATE=2023/10/11 05:07
*/
public class CustomizedModeledAttributesDelegate extends DefaultModeledAttributesDelegate {
private static final String CUSTOM_SYSTEM_PARAMS_PREF = "system.attribute.mapping.custom";
private static final String PROE = "PROE";
private static final String CURRENT_DATE = "CURRENT_DATE";
// getAvailableAttributes() returns
// HashMap<String, Object> which contains
// HashMap<Attribute name, Attribute type> @Override
public HashMap getAvailableAttributes() {
System.out.println(
"Invoked CustomizedModeledAttributesDelegate extends DefaultModeledAttributesDelegate :: getModeledAttributes() :Returning an empty list of modeled Attributes.");
return new HashMap();
}
/**
* Returns a map of modeled attributes for the EPMDocument objects in the provided collection. This method retrieves
* the modeled attributes from the PTC default implementation.
*
* @param collection a collection of EPMDocument objects for which to retrieve the modeled attributes
* @return a map of modeled attributes for the provided EPMDocument objects
* @throws WTException if an exception occurs while retrieving the modeled attributes
*/
@Override
public HashMap getModeledAttributes(
final Collection collection)
throws WTException {
System.out.println(
"Invoked CustomizedModeledAttributesDelegate extends DefaultModeledAttributesDelegate :: getModeledAttributes() ");
String prefValue = (String) PreferenceHelper.service.getValue(CUSTOM_SYSTEM_PARAMS_PREF,
PROE);
System.out.println("CustomizedModeledAttributesDelegate prefValue " + prefValue);
HashMap objVsAttrNameVsValue = new HashMap();
// Fetching only EPMDocuments from input collection.
WTCollection inEPMDocs = new WTHashSet(collection).subCollection(EPMDocument.class);
Iterator persistableIterator = inEPMDocs.persistableIterator();
if (prefValue != null && (!prefValue.isBlank())) {
while (persistableIterator.hasNext()) {
EPMDocument anEPMDoc = (EPMDocument) persistableIterator.next();
objVsAttrNameVsValue = super.getModeledAttributes(collection);
Map<String, String> attrNameVsValueMap = (Map<String, String>)objVsAttrNameVsValue.get(anEPMDoc);
assertTrue(attrNameVsValueMap != null);
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm");
LocalDateTime now = LocalDateTime.now();
attrNameVsValueMap.put(CURRENT_DATE, dtf.format(now).toString());
System.out.println("CustomizedModeledAttributesDelegate attrNameVsValueMap " + attrNameVsValueMap);
return objVsAttrNameVsValue;
}
}
System.out
.println("Could not find CustomizedModeledAttributesDelegate extends DefaultModeledAttributesDelegate");
return objVsAttrNameVsValue;
}

} // end class
2. PTC から提供されているカスタムシステム属性を DefaultModeledAttributesDelegate で既成で使用できます。ただし、site.xconf ファイル (<Windchill> 内) を次のように変更して、サーバー上のカスタマイズサービスを指定できます。
serviceClass の値の代わりにクラスのパスを使用します (com.ptc.windchill.uwgm.proesrv.c11n.DefaultModeledAttributesDelegate をクラスへのパスで置き換えます)。次に例を示します。
<Service context="default"
name="com.ptc.windchill.uwgm.proesrv.c11n.ModeledAttributesDele
gate" targetFile=codebase/service.properties">
<Option cardinality="singleton"
requestor="java.lang.Object"
serviceClass="com.acme.download.CustomizedModeledAttributesDelegate"/>
</Service>
xconfmanager ツールを使用して、service.properties ファイルに変更を適用します (xconfmanager -p を実行します)。
3. メソッドサーバーを再起動します。
これは役に立ちましたか?