Windchill のその他の機能 > サービス情報管理 > Customizing Windchill Service Information Manager and Windchill Service Parts > 新規の部品構造を生成または再生成するフックのカスタマイズ > 属性の適用とカスタムオブジェクトの永続化
  
属性の適用とカスタムオブジェクトの永続化
サービス構造の生成中および再生成中、既成のサービス NodeResolutionService は、生成される構造でコピー、再利用、除去されるノードまたはエレメントを解決します。このサービスを拡張してカスタムロジックを実装することにより、生成または再生成されるサービス構造に属性値を適用し、カスタムオブジェクトを作成できます。xconfmanager ユーティリティを使用して、実装サービスを登録します。ここで説明したカスタマイズを実装するには、サービス構造の生成後または再生成後、ノードの解決が完了していることが必要条件になります。
フィールド
既成のサービス実装には、カスタマイズしたコードの実行中に作成またはコピーされるカスタムオブジェクトをキャッシュして、後でコンフィギュレーション可能リンクとして永続化できるようにするため、以下のフィールドが提供されています。
List<WTCollection> customObjects;
メソッド
すべてのノードの解決が完了した後、以下のメソッドを使用します。
postGenerate
/**
* Copy forward any attributes from the originals to their copies
*
* @param originalsToCopies An array of CopyObjectInfo objects containing the originals and copied objects
*/
void postGenerate(CopyObjectInfo[] originalsToCopies);
persistCustomCollections
これは既成のメソッドであり、既成のロジック以外でサービス構造用に作成されたオブジェクト、つまりコンフィギュレーション可能リンクまたはカスタムロジック固有の対象を永続化します。カスタマイズでは、クラスフィールド List<WTCollection> にコレクションを追加し、永続化の必要な各オブジェクトタイプのリストに新しいコレクションが追加された状態にします。
/**
* Persists any custom objects created during the generate/regenerate process i.e. configurable links
*
* @throws WTException
*/
void persistCustomCollections() throws WTException;
外部ヘルパーメソッド
オブジェクトの属性を読み込み、オブジェクトに対して属性を設定するには、以下の外部ヘルパーメソッドを使用します。
getAttributesFromPersistables
/**
* Retrieves the list of attribute values from passed in persistables
*
* @param objToattrNames Map with key as the persistable object to
* retrieve the values from and values as the list of attributes to
* attempt to retrieve the value for.
* @return A map containing the attribute and the attribute value
* retrieved from each passed in persistable
* @throws WTException
*/
public static WTKeyedMap getAttributesFromPersistables(
WTKeyedMap objToattrNames)
throws WTException
setAttributesOnPersistables
/**
* Sets the specified attributes with the specified values on the
* collection of specified objects assuming all target objects are
* checked in.
*
* @param updateTargets A map of persistable keys mapped to a map
* containing attribute name and attribute value pairs
* @param persist boolean to specify if the updated persistables
* should be persisted once the update has been processed
* @throws WTException
*/
SisCoreHelper.setAttributesOnPersistables(Map<Persistable, Map<String, Object>> updateTargets)