其他 Windchill 功能 > 服務資訊管理 > Customizing Windchill Service Information Manager and Windchill Service Parts (自訂 Windchill Service Information Manager and Windchill Service Parts) > 自訂翻譯建立勾點
  
自訂翻譯建立勾點
可使用翻譯建立勾點來自訂針對翻譯封裝建立之翻譯物件的一般屬性。翻譯建立勾點由 wt.properties 檔案中的 xconf 內容 com.ptc.tml.preparation.CustomTranslationCreationHook 控制。
自訂翻譯建立勾點的步驟如下:
1. 開發 java 程式碼 - 根據您企業的需求建立延伸抽象類別 com.ptc.tml.preparation.CustomTranslationCreationHook 與實行所需行為的 java 類別。
2. 註冊自訂 - 將 com.ptc.tml.preparation.CustomTranslationCreationHook 內容新增至 codebase\wt.properties 檔案。內容的值應該是在步驟 1 中實行的類別名稱。
3. 重新啟動應用伺服器。
* 
不建議修改翻譯文件的 CADNAME。
以下是將字首 'PTC' 新增至翻譯文件之「翻譯編號」屬性的範例程式碼。
package com.ptc.tml.preparation.sample;
import java.util.List;
import wt.util.WTException;
import wt.util.WTPropertyVetoException;
import com.ptc.tml.preparation.CustomTranslationCreationHook;
/** Example implementation of CustomTranslationCreationHook that customizes translation objects by prepending "PTC"
* to each translation object's Number. This is enabled by adding
* 'com.ptc.tml.preparation.CustomTranslationCreationHook=com.ptc.tml.preparation.sample.PrefixCustomTranslationObjectCreationHook'
* to wt.properties. */
public class PrefixCustomTranslationObjectCreationHook extends CustomTranslationCreationHook {

@Override
protected void customize(List<EPMDocumentCopyInfo> documentCopies) throws WTException, WTPropertyVetoException {

for (EPMDocumentCopyInfo info : documentCopies) {
final String initialNumber = info.getTarget().getNumber();
info.getTarget().setNumber("PTC" + initialNumber);
}
}
}