與其他應用程式整合 > Windchill Workgroup Manager 文件集 > Autodesk Inventor > 管理與組態 > 針對 Autodesk Inventor 配置企業實務 > 配置命名與編號 > 自訂命名服務
  
自訂命名服務
命名服務使用 Windchill 服務委派機制,讓您為您要建立的新 CAD 文件指定下列各項:
為 CAD 文件設定編號。
為 CAD 文件設定名稱。
* 
命名服務只適用於上載動作。
系統用於命名原則與自訂的優先順序如下所示。
名稱
1. 命名服務自訂。
2. 針對命名設定的參數 (命名參數)。
3. 檔案名稱。只有在根據檔案名稱 (CAD 名稱) 指派了名稱的情況下,「上載去除名稱副檔名」偏好設定才有效。
編號
1. 命名服務自訂。
2. 針對編號設定的參數 (編號參數)。
3. 檔案名稱 (只有在根據檔案名稱 (CAD 名稱) 指派了名稱的情況下,「上載去除名稱副檔名」偏好設定才有效。)
如果標準 Windchill 命名與編號原則無法滿足您公司的需求,您可以自訂服務,以根據此自訂邏輯將名稱與編號指派給 CAD 文件。請使用下列步驟自訂命名服務:
1. 建立實行介面 EPMDocumentNamingDelegate 的 Java 類別。介面定義如下。
package com.ptc.windchill.uwgm.proesrv.c11n;
public interface EPMDocumentNamingDelegate
{
public void validateDocumentIdentifier
(DocIdentifier docIdentifier);
}
類別 DocIdentifier 的定義如下:
package com.ptc.windchill.uwgm.proesrv.c11n;
import java.util.HashMap;
public class DocIdentifier
{
private String m_modelName;
private String m_docName;
private String m_docNumber;
private HashMap m_parameters;
public DocIdentifier(String modelName, String docName,
String docNumber, HashMap params)
{ m_modelName = modelName; m_docName=
docName; m_docNumber= docNumber; m_parameters= params; }
/** get the CAD Name for the model **/
public String getModelName()
{ return m_modelName; }
/** get the EPMDocument name for the model **/
public String getDocName()
{ return m_docName; }
/** set the EPMDocument name for the model **/
public void setDocName(String docname)
{ m_docName = docname; }
/** set the EPMDocument number for the model **/
public void setDocNumber(String docnumber)
{ m_docNumber = docnumber; }
/** get the EPMDocument number for the model **/
public String getDocNumber()
{ return m_docNumber; }
/** get the Pro/E designated parameters for the model.
These are name-value pairs indexed by the name **/
public HashMap getParameters()
{ return m_parameters; }
}
2. 在新類別中,使用以下方法針對命名/編號 CAD 文件 (EPMDocument) 實行企業邏輯:
public void validateDocumentIdentifier(DocIdentifier docIdentifier)
DocumentIdentifier 物件擁有將由「上載服務」建立的 CAD 文件的 CAD 文件名稱與編號資訊。
使用
DocIdentifier.getModelName()
取得此 DocIdentifier 物件所代表的 CAD 文件的「CAD 名稱」。
指派了參數的 CAD 應用程式可以用來設定 CAD 文件編號/命名。
使用
DocIdentifier.getParameters()
取得關聯參數。
使用 DocIdentifier 上的設定方法來設定新名稱/編號值。如果可行,「上載服務」會使用這些建議。您可以在下列位置找到範例實行:
<Windchill home>/codebase/com/ptc/windchill/uwgm/proesrv/
c11n/EPMDefaultDocumentNamingDelegate.java
3. 編輯 site.xconf 檔案 (位於 <Windchill> 中) 來新增下列屬性,以指示伺服器上自訂服務的可用性:
<Service context="default" name="com.ptc.windchill.uwgm.proesrv.c11n.
EPMDocumentNamingDelegate" targetFile="codebase/service.properties">
<Option cardinality="singleton" requestor="wt.epm.EPMDocument"
serviceClass="com.ptc.windchill.uwgm.proesrv.c11n.EPMDefaultDocument
NamingDelegate"/>
</Service>
然後使用 xconfmanager 工具將變更套用至 service.properties 檔案·(執行
xconfmanager -p
)
使用您類別的路徑來取代 serviceClass 的值 (也就是使用您類別的路徑來取代
com.ptc.windchill.uwgm.proesrv.c11n.EPMDefaultDocumentNami ngDelegate
)。
4. 重新啟動應用伺服器。