其他 Windchill 功能 > 服務資訊管理 > 自訂 Service Information Manager and Service Parts > 自訂發行 > 發佈的進階自訂
  
發佈的進階自訂
發佈的擴展點
在建立或處理有效負載期間,有幾個時間點可以實行自訂。您也可以執行後轉換委派。
服務結構追蹤
此一般 ServiceStructureTraversing 委派會修改正在序列化的輸出服務結構,而不影響輸入服務結構。此委派適用於一般性的追蹤,包括翻譯與發佈。
註冊
透過新增下列項目到 service.properties.xconf 檔案以註冊 ServiceStructureTraversing 委派:
<Service context="default" name="com.ptc.arbortext.windchill.siscore.
traversal.ServiceStructureTraversing">
<Option serviceClass="YourCustomTraversingClassName
requestor="wt.part.WTPart" selector="null"/>
</Service>
ServiceStructureTraversing 介面
package com.ptc.arbortext.windchill.siscore.traversal;
import java.util.List;
import wt.part.WTPart;
import wt.util.WTException;
/*
* Interface that allows customization of the nodes returned from
* StandardTraversalService.
* Children may be added, removed and reordered.
*/
public interface ServiceStructureTraversing {
boolean children(WTPart parent, List<pubNode> children)
throws WTException;
}
children() API 方法
傳回 true 以在追蹤的下一個階段使用 children 參數的修改值。
在造訪每個節點子項前,會先呼叫此方法。方法支援:
新增子節點
移除子節點
重新排列子節點
參數:
parent
追蹤程式碼目前造訪的服務結構節點
children
parent 參數的子節點
自訂內容就緒檢查程式
CustomContentReadyChecker 委派在發佈期間會檢查每個動態文件 (包括複合文件的成員連結與從零件清單參考的圖形),並決定內容是否已準備就緒可以發佈。此委派用來決定翻譯是否已就緒,但也可以用來決定文件本身是否已就緒。
發佈參數 OnContentHolderLinkFailed 定義當文件或其翻譯未就緒時應如何處理發佈請求。
註冊
透過新增下列項目到 service.properties.xconf 檔案以註冊 CustomContentReadyChecker 委派:
<Service name="com.ptc.arbortext.windchill.publisher.
CustomContentReadyChecker">
<Option serviceClass="CustomContentCheckerClassName"
requestor="null" selector="null"/>
</Service>
CustomContentReadyChecker 介面
package com.ptc.arbortext.windchill.publisher;
import wt.fc.Persistable;
import wt.util.WTException;
import com.ptc.arbortext.windchill.publisher.payload.PayloadContext;
public interface CustomContentReadyChecker {
boolean isTranslatedContentReady(
Persistable source,
Persistable trans,
PayloadContext context) throws WTException;
// if PTC_DD_TRANSLATE=="yes" && lang set
boolean isContentReady(
Persistable source,
PayloadContext context) throws WTException; // else this
}
isTranslatedContentReady() API 方法
如果文件已就緒,將傳回 true,否則將傳回 false
此方法檢查文件及其翻譯的狀態,以決定其是否已就緒可以發佈。
參數:
source
文件內容
trans
文件的已翻譯內容
context
有效負載前後關聯,包括發佈規則參數與其他發佈資訊
isContentReady() API 方法
如果文件已就緒,將傳回 true,否則將傳回 false
此方法檢查文件的狀態,以決定其是否已就緒可以發佈。
參數:
source
文件內容
context
有效負載前後關聯,包括發佈規則參數與其他發佈資訊
安全性標籤彙總工具
SecurityLabelAggregator 委派根據要發佈的資料及其安全性標籤,設定已發佈表示的安全性標籤。
在發佈流程中,Service Information Manager 會收集為有效負載收集之每個元素的安全性標籤,然後套用安全性標籤屬性。您可以使用根據業務邏輯彙總安全性標籤的 SecurityLabelAggregator 介面,定義元素集合的安全性標籤階層。
介面針對下列幾項處理安全性標籤:
結構中的所有 WTParts
所有連結的 WTDocumentEPMDocument、圖形及零件清單物件
從文件連結的所有片段
從零件清單與文件連結的所有圖形
包括在有效負載中的所有表示
* 
會排除參考物件,除非其內容也包括在有效負載中 (不僅是其中繼資料)。
束發行不支援安全性標籤。
註冊
透過新增下列項目到 service.properties.xconf 檔案以註冊 SecurityLabelAggregator 委派:
<Service name="com.ptc.arbortext.windchill.publisher.
SecurityLabelAggregator">
<Option serviceClass="CustomSecurityLabelAggregatorClassName"
requestor="null" selector="null"/>
</Service>
SecurityLabelAggregator 介面
package com.ptc.arbortext.windchill.publisher;
import java.util.Map;
import wt.access.SecurityLabeled;
import wt.util.WTException;
public interface SecurityLabelAggregator {
/**
*
* @param mergeTo is the output. Initially it has other labels
* @param finalTarget is the object in which the final result is saved
* @param mergeFrom is a collection of labels that will be merged to
* mergeTo.
* @param mergeFromObject is the object where mergeFrom is retrieved.
* If mergeFromObject is a representation, its target object
* is used.
* @param options are the parameters that can be used to control the
* merging.
* @throws WTException, when thrown, the current publish job fails.
*/
public void aggregate(Map<String, String> mergeTo,
SecurityLabeled finalTarget, Map<String, String> mergeFrom,
SecurityLabeled mergeFromObject, Map<String, String> options)
throws WTException;
/**
*
* The method tests if the security labels need the PE alternate
* transaction archive.
* If there is a label called ITAR, an implementation could return true.
* PE would put the publish job's transaction archive in the alternate
* archive.
* @param securityLabels are the aggregated security labels
* @param options parameters
* @return true if secure and false if public
*/
public boolean isSecured(Map<String, String> securityLabels,
Map<String, String> options) throws WTException;
}
aggregate() API 方法
傳回 void。
此方法根據有效負載中收集之所有資料的安全性標籤,設定目標表示的最終安全性標籤。
參數:
mergeTo
finalTarget 的安全性標籤集合。當呼叫此方法時,此變數可能已經包含一些安全性標籤。
finalTarget
儲存最終安全性標籤的物件。
mergeFrom
mergeFromObejct 的安全性標籤集合。這些安全性標籤有助於決定如何設定最終安全性標籤。
mergeFromObject
包含某些安全性標籤的物件
options
發佈規則參數及其值的對應
isSecured() API 方法
傳回 truefalse
此方法會檢查彙總的最終安全性標籤,並決定是否保護已發佈表示。如果 isSecured() 傳回 true,則需要將已發佈表示放置到安全資料夾中。安全交易封存必須在 Arbortext Publishing Engine 上配置。
參數
securityLabels
套用到安全性的最終安全性標籤
options
發佈規則參數及其值的對應
元素篩選器
ElementFilter 委派讓使用者可以從服務結構有效負載中排除資訊元素。例如,此委派可以從有效負載中排除具有特定安全性標籤的資訊元素。
如果已篩選內容物件 (例如 EPMDocument) 或零件清單的任何子項,則應該篩選內容物件或零件清單,否則可能會在發佈不完整文件或零件清單時發生錯誤。
註冊
透過新增下列項目到 service.properties.xconf 檔案以註冊 ElementFilter 委派:
<Service name="com.ptc.arbortext.windchill.publisher.payload.ElementFilter">
<Option serviceClass="CustomElementFilterClassName"
requestor="null" selector="null"/>
</Service>
ElementFilter 介面
package com.ptc.arbortext.windchill.publisher.payload;
import wt.fc.Persistable;
import wt.fc.collections.WTList;
import wt.util.WTException;
/**
* An interface that is used to filter information elements based on
* customized criteria. Only one instance is used for the whole payload.
*
*/
public interface ElementFilter {
/**
*
* @param context
* @param curElement it could be WTPart, PartList
* @param associated a list of Persistable objects. If the current
* element is a structured document, such as dynamic document,
* only its root dynamic document is included.
* Depending on business logic, users may need to check the children.
* @return true means we don't include the Element. Otherwise,
* include the element. If the element is not included and the
* publishing stops, an exception is expected.
* @throws WTException
*/
public boolean filter(PayloadContext context, Persistable curElement,
WTList associated) throws WTException;
}
filter() API 方法
傳回 true 將從有效負載中排除 curElement。傳回 false 將包括 curElement
此方法會檢查服務結構中的每個資訊元素,以決定是否應對其進行篩選。
參數:
context
有效負載前後關聯,包括發佈規則資訊與其他資訊。
curElement
可能新增到有效負載的服務結構節點、零件清單或零件清單插圖。
associated
curElement 關聯之可持續物件的集合。例如,如果 curElement 是指向動態文件的資訊結構節點,則 associated 參數會包含此動態文件。
自訂中繼資料來源提供者
CustomMetaDataSourceProvider 委派讓使用者可以為服務結構中的任何零件清單項目或任何節點提供其他的中繼資料來源。其他中繼資料來源會附加到現有中繼資料來源,然後序列化為 XML 檔案。通常,會根據 publishable_attset.xml 檔案中的設定,從每個結構節點與每個零件清單項目中收集中繼資料來源。如需詳細資訊,請參閱配置屬性
註冊
透過新增下列項目到 service.properties.xconf 檔案以註冊 CustomMetaDataSourceProvider 委派:
<Service name="com.ptc.arbortext.windchill.siscore.operation.
CustomMetaDataSourceProvider">
<Option serviceClass="CustomMetaDataSourceProviderClassName"
requestor="null" selector="wt.part.WTPart|com.ptc.sis.Base|
com.ptc.sis.BaseDiv "/>
</Service>
CustomMetaDataSourceProvider 介面
package com.ptc.arbortext.windchill.siscore.operation;
import java.util.List;
import wt.fc.ObjectToObjectLink;
import wt.fc.Persistable;
import wt.util.WTException;
public interface CustomMetaDataSourceProvider {
List<SISMetaDataSource> getCustomDataSources(Persistable targetNode,
ObjectToObjectLink linkToNode,
Persistable rootNode,
SISOperationServerContext hookContext) throws WTException;
}
getCustomDataSources() API 方法
傳回自訂中繼資料來源集合,其會附加到現有的中繼資料來源,然後序列化為目標節點。
此方法會為指定來源收集其他中繼資料。
參數:
targetNode
值可以是下列任何類型:
呼叫方法時在資訊結構或發佈結構中造訪的節點
當序列化零件清單物件時,連結自零件清單的 wt.part.WTPart
當資訊清單中需要內容物件的中繼資料時,要新增到有效負載的該內容物件,例如動態文件
linkToNode
呼叫方法時,從父節點指向 targetNode 的連結。針對根節點或由 ServiceStructureTraversing 委派新增到樹的節點,這可能是 null。在零件清單項目中,這是連結到 wt.part.WTPartPartListItem。對於內容物件,它可能是特定連結,例如 EPMDescribedByLink
rootNode
服務結構或「零件清單」物件的根。
hookContext
SISOperationServerContext 前後關聯,其提供所執行操作之類型以及套用到結構之篩選器的資訊。
提供自訂中繼資料翻譯
如果您正在使用已翻譯的自訂中繼資料,請使用 RawMetaDataSourcePropertyValue 類別中的 addTranslation() 方法。例如:
RawMetaDataSource.Property p = new RawMetaDataSource.
Property("token2", "property_type", null, authorLang);
p.setLocalizable(true);
RawMetaDataSource.PropertyValue v = new RawMetaDataSource.
PropertyValue("value12", "value_token", "value_key");
v.addTranslation("fr", "value12_fr");
v.addTranslation("de", "value12_de");
p.addValue(v);
properties.add(p);
data.setProperties(properties);
法文 (束預設值) 的中繼資料結果︰
<Metadata source="RawSoftType">
<Property name="token2">
<Value xml:lang="en" transidref="...">value12</Value>
<Value xml:lang="en" transidref="...">value12_2</Value>
</Property>
</Metadata>
translation.xml (PDF 預設值) 中的中繼資料結果︰
<Target xml:lang="fr">
...
<Value transid="07ecb4cfd68fab55">value12_fr</Value>
<Value transid="07ecb4cfd68fse54">value12_2_fr</Value>
...
</Target>
委派可將 Localizable 設定為 "true",表示內容值擁有可顯示在束中的翻譯。addTranslation() 方法可為特定語言提供自訂翻譯。針對一個 PropertyValue,委派可以有多個翻譯,當針對特定語言發佈束時,適當的翻譯 (若提供) 就會顯示在束中。
如果將內容標記為可本地化,但委派未針對發佈目標語言提供翻譯,則發佈工作將失敗 (若將 CompleteTranslationCheck 發佈規則設定為 "true")。
比較彙總時間戳記的自訂中繼資料
在自訂中繼資料中,彙總時間戳記的詳細資訊透過零件清單的 SIM.lastUpdated 屬性與 EPM 文件的 SIM.lastUpdatedMetadata 屬性提供。請使用 CustomMetaDataSourceProvider 委派 RawMetadasourceAttributeMetaDataSource 類別的 getTimeStamp() 方法。
發佈將會包括由 getTimeStamp() 針對根內容 (即內容持有者下的「動態文件」與零件清單) 傳回的值,而略過該內容的其餘部份。例如,如果子動態文件的自訂資料也包含時間戳記,則發佈時將不會在其父項的計算時間戳記中包括這部份資訊。
時間戳記透過 RawMetadasource 傳回且在 AttributeMetaDataSource 類別中定義。
public class AttributeMetaDataSource implements SISMetaDataSource {
private WTReference targetRef;
protected List<Property> properties;
protected List<Object> incrementalList;
protected long timeStamp;
資訊清單自訂中繼資料來源提供者
ManifestCustomMetaDataSourceProvider委派會新增及移除內容的中繼資料來源,以及將新屬性新增至有效負載中 manifest.xml 檔案內的現有中繼資料。其他中繼資料來源會附加到現有中繼資料來源,然後序列化為 XML 檔案。服務生失效就是典型的現有中繼資料來源。當針對有效負載序列化服務結構內容 (例如動態文件、零件清單) 時,會根據 manifest_attset.xml 中的設定收集中繼資料來源。如需詳細資訊,請參閱配置屬性
註冊
透過新增下列項目到 service.properties.xconf 檔案以註冊 ManifestCustomMetaDataSourceProvider 委派:
<Service name="com.ptc.arbortext.windchill.siscore.operation.
ManifestCustomMetaDataSourceProvider">
<Option cardinality="singleton" serviceClass=
"ManifestCustomMetaDataSourceProviderClassName"
requestor="null" />
</Service>
選取器屬性指定了前後關聯。類別會註冊為單一項目。請確保物件可同時在多個執行緒中重新使用。
ManifestCustomMetaDataSourceProvider 介面
package com.ptc.arbortext.windchill.siscore.operation;
import java.util.List;
import java.util.Map;
import wt.fc.WTReference;
import wt.fc.collections.WTKeyedMap;
import wt.util.WTException;
public interface ManifestCustomMetaDataSourceProvider {
/**
*
* @param currentData
* @param hookContext
* @return
* @throws WTException
*/
Map<WTReference, List<SISMetaDataSource>> getCustomDataSources
(WTKeyedMap currentData,SISOperationServerContext hookContext)
throws WTException;
}
getCustomDataSources() API 方法
傳回目標參考與其自訂中繼資料資訊的對應。
參數:
currentData
值是目標參考與其子項的對應。
hookContext
SISOperationServerContext 前後關聯,其提供所執行操作之類型以及套用到結構之篩選器的資訊。
新增中繼資料的範例
初始化 OperationMetaDataSource 物件。
OperationMetaDataSource om = new OperationMetaDataSource
(OperationMetaDataSource.E_Operation.Add);
WTArrayList list = new WTArrayList();
list.add(PersistableObject);
om.setTargets(list);
傳回 OperationMetaDataSource 物件。
Map<WTReference, List<SISMetaDataSource>> ret = new HashMap
<WTReference, List<SISMetaDataSource>>
List<SISMetaDataSource> src = new ArrayList<SISMetaDataSource>()
src.add(om);
ret.put(targetRef, src);
移除中繼資料的範例
初始化 OperationMetaDataSource 物件。
OperationMetaDataSource om = new OperationMetaDataSource
(OperationMetaDataSource.E_Operation.Remove);
WTArrayList list = new WTArrayList();
list.add(PersistableObject);
om.setTargets(list);
傳回 OperationMetaDataSource 物件。
Map<WTReference, List<SISMetaDataSource>>
ret = new HashMap<WTReference,
List<SISMetaDataSource>>List<SISMetaDataSource> src = new
ArrayList<SISMetaDataSource>();
src.add(om);
ret.put(targetRef, src);
將屬性新增至現有中繼資料的範例
初始化 AttributeMetaDataSource 物件。
AttributeMetaDataSource am = new AttributeMetaDataSource(ref);
List<RawMetaDataSource.Property> properties = new ArrayList
<RawMetaDataSource.Property>();
RawMetaDataSource.Property p = new RawMetaDataSource.Property
("NewCustomAttributeId", null);
RawMetaDataSource.PropertyValue v = new RawMetaDataSource.PropertyValue
(ref.toString(), null, null);
p.addValue(v);
properties.add(p);
am.setProperties(properties);
傳回 AttributeMetaDataSource 物件。
Map<WTReference, List<SISMetaDataSource>>
ret = new HashMap<WTReference,
List<SISMetaDataSource>>List<SISMetaDataSource> src = new
ArrayList<SISMetaDataSource>();
src.add(am);
ret.put(targetRef, src);
提供自訂中繼資料翻譯
如果您正在使用已翻譯的自訂中繼資料,請使用 RawMetaDataSourcePropertyValue 類別中的 addTranslation() 方法。例如:
RawMetaDataSource.Property p = new RawMetaDataSource.
Property("token2", "property_type", null, authorLang);
p.setLocalizable(true);
RawMetaDataSource.PropertyValue v = new RawMetaDataSource.
PropertyValue("value12", "value_token", "value_key");
v.addTranslation("fr", "value12_fr");
v.addTranslation("de", "value12_de");
p.addValue(v);
properties.add(p);
data.setProperties(properties);
法文 (束預設值) 的中繼資料結果︰
<Metadata source="RawSoftType">
<Property name="token2">
<Value xml:lang="en" transidref="...">value12</Value>
<Value xml:lang="en" transidref="...">value12_2</Value>
</Property>
</Metadata>
translation.xml (PDF 預設值) 中的中繼資料結果︰
<Target xml:lang="fr">
...
<Value transid="07ecb4cfd68fab55">value12_fr</Value>
<Value transid="07ecb4cfd68fse54">value12_2_fr</Value>
...
</Target>
委派可將 Localizable 設定為 "true",表示內容值擁有可顯示在束中的翻譯。addTranslation() 方法可為特定語言提供自訂翻譯。針對一個 PropertyValue,委派可以有多個翻譯,當針對特定語言發佈束時,適當的翻譯 (若提供) 就會顯示在束中。
如果將內容標記為可本地化,但委派未針對發佈目標語言提供翻譯,則發佈工作將失敗 (若將 CompleteTranslationCheck 發佈規則設定為 "true")。
比較彙總時間戳記的資訊清單自訂中繼資料
在自訂中繼資料中,彙總時間戳記的詳細資訊透過零件清單的 SIM.lastUpdated 屬性與 EPM 文件的 SIM.lastUpdatedMetadata 屬性提供。請使用 ManifestCustomMetadataSourceProvider 委派 RawMetadasourceAttributeMetaDataSource 類別的 getTimeStamp() 方法。
發佈將會包括由 getTimeStamp() 針對根內容 (即內容持有者與零件清單下的「動態文件」) 傳回的值,而略過該內容的其餘部份。例如,如果子動態文件的自訂資料也包含時間戳記,則發佈將不會在其父項的已計算時間戳記中包括這部份資訊。
public class AttributeMetaDataSource implements SISMetaDataSource {
private WTReference targetRef;
protected List<Property> properties;
protected List<Object> incrementalList;
protected long timeStamp;
* 
不會監視從此勾點傳回的中繼資料是否發生了增量發佈。
自訂翻譯勾點
CustomTranslationHook 可以在發佈期間擷取 Windchill 屬性的翻譯值。如果傳回 null 值,則表示翻譯不可用。發佈的輸出會包括在 translation.xml 中。指定的屬性必須包括在 localizable_attset.xml 組態檔案中,才能包括在有效負載中。
註冊
可將如下所示的項目新增至 sis.service.properties.xconf 檔案,來註冊自訂翻譯勾點委派:
<Service name="com.ptc.arbortext.windchill.siscore.CustomTranslationHook">
<Option serviceClass="YourCustomTranslationHookClassName"
requestor="null" selector="null"/>
</Service>
CustomTranslationHook 介面
package com.ptc.arbortext.windchill.siscore.translation;
import wt.util.WTException;
public abstract class CustomTranslationHook {
/**
*
* @param softtype Windchill soft type name
* @param attributeName Windchill soft attribute name
* @param sourceLanguage source or authored language of attributeValue
* @param attributeValue attributeValue to fetch translation for
* @param targetLanguage target language of translation to fetch
* @throws WTException
*/
public abstract String translateAttribute(String softtype,
String attributeName, String sourceLanguage,
String attributeValue, String targetLanguage)
throws WTException;
}
translateAttribute() API 方法
此方法可指定您要擷取其翻譯屬性值的屬性。
如果存在翻譯,則傳回的值為指定屬性的已翻譯字串。如果此方法傳回 null 或拋出例外,則表示翻譯不可用,且將會使用來源屬性字串。
參數:
softtype
服務結構的 Windchill 子類型
attributeName
Windchill 子類型屬性名稱
sourceLanguage
attributeValue 的來源或編寫語言
attributeValue
應擷取其翻譯的屬性值
targetLanguage
應擷取其翻譯的目標語言
裝載中的自訂資料夾
CustomArtifactProvider 委派將提供一個將自訂加工品包括至裝載束的勾點。
註冊
可將類似於如下的項目新增至 sis.service.properties.xconf 檔案,來註冊 CustomArtifactProvider 委派︰
<Service name="com.ptc.arbortext.windchill.publisher.payload.CustomArtifactProvider">
<Option serviceClass="YourCustomArtifactProviderImplementation"
requestor="null" selector="null"/>
</Service>
CustomArtifactProvider 介面
package com.ptc.arbortext.windchill.publisher.payload;
import com.ptc.wvs.common.util.VSResult;
import wt.util.WTException;
public interface CustomArtifactProvider {
/**
* This method is passed the path for a newly created empty temporary
* directory as well as the payload context object.
* @param tempDirPath : empty temporary directory
* @param context : payload context object
* @return VSResult.SUCCESSFUL or VSRESULT.FAIL
* @throws WTException
*/
public VSResult initiateCustomFolder(String tempDir, PayloadContext context) throws WTException;
/**
* If the method returns VSResult.SUCCESSFUL, then the contents of the directory
* will be copied to the custom folder in the payload.
Otherwise if the method returns VSRESULT.FAIL, the temporary directory
will be permanently deleted with including its content in the payload.
* @return VSResult.SUCCESSFUL or VSRESULT.FAIL
* @throws WTException
*/
public VSResult publishCustomFolder() throws WTException;
/**
* cleanUp is called regardless what happens to publish
* to clean up resources in customization.
*/
public void cleanUp();
initiateCustomFolder() API 方法
此方法會傳回新建立的空白暫時目錄的路徑,以及裝載前後關聯物件的路徑。如果它傳回 VSResult.FAIL,則發佈工作會停止並傳回錯誤。
參數:
tempDir
空白暫時目錄
context
裝載前後關聯物件
傳回 VSResult.SUCCESSFULVSRESULT.FAIL
publishCustomFolder() API 方法
此方法會修改暫時目錄的內容。例如,壓縮某些加工品。
傳回 VSResult.SUCCESSFULVSRESULT.FAIL。如果此方法傳回 VSResult.SUCCESSFUL,則目錄的內容會複製到裝載中的自訂資料夾。如果此方法傳回 VSRESULT.FAIL,則會永久刪除暫時目錄及其在裝載中的內容。
編碼目錄和檔案名稱的方法
encodePayloadFileName 公用程式使用百分比樣式編碼來為裝載或發佈束中目錄或加工品檔案名稱中出現的特殊字元進行編碼。此公用程式會將檔案名稱中所包含的特殊字元和非字母數字字元取代為底線 (_) 字元,後接被取代之字元的十六進位 (#) 值。
在編碼期間,將不會逸出下列字元︰
A-Z (大寫拉丁字元)
a-z (小寫拉丁字元)
0–9 (阿拉伯數字)
. (句點)
~ (波浪符號)
公用程式的方法簽名︰
public static String encodePayloadFileName(String fname)
公用程式的完全合格方法簽名︰
com.ptc.arbortext.windchill.publisher.payload.util.FileNameUtil.encodePayloadFileName(String fname)
其中,fname 為檔案名稱。
發佈非使用中的產品階層節點
CustomPHHook 會偵測產品階層樹之外的產品階層節點,並將它們發佈為非使用中的節點。如果該節點是樹的一部份,則會標記為非使用中。若非如此,則會作為根 PH 的子項插入並標記為非使用中。
註冊
可將類似於如下的項目新增至 sis.service.properties.xconf 檔案,來註冊自訂產品階層勾點委派:
<Service name="com.ptc.arbortext.windchill.publisher.payload.CustomPHHook">
<Option cardinality="singleton" serviceClass="YourCustomPHHook"
requestor="null" selector="null"/>
</Service>
CustomPHHook 介面
package com.ptc.arbortext.windchill.publisher.extract;
import com.ptc.arbortext.windchill.publisher.payload.PayloadContext;
import wt.fc.collections.WTCollection;
import wt.filter.NavigationCriteria;
import wt.part.WTPart;
import wt.util.WTException;
Public abstract class CustomPHHook {
public abstract WTCollection getInactivePHNodes(WTPart rootPH, NavigationCriteria phNC, PayloadContext payloadContext);
}
getInactivePHNodes() API 方法
傳回在產品階層中為非使用中節點的 Wtpart 集合。如果此方法傳回不屬於產品階層的節點或者物件不是 WTPart,則會發生例外。如果此方法傳回產品階層樹以外的節點或部份,則該節點會新增為結構中的新產品階層資訊元素。
參數:
rootPH
產品階層結構的根
phNC
產品階層導覽條件
payloadContext
前後關聯
後轉換委派
PostConvertDelegate 讓使用者可以在發佈工作後,對從 Arbortext Publishing Engine 傳回的回應進行後處理。回應包括有錯誤或警告的 composerlog.xml 檔案中的資訊。此資訊會觸發工作流程動作或傳送電子郵件通知。無論發佈工作通過或失敗,都會呼叫此委派。
如果 PostConvertDelegate 發生例外,此例外會在 WVS 記錄檔中註記,但該例外不會變更發佈工作的狀況。
註冊
透過新增 WVS PostConvertDelegate 發佈參數到發佈規則並指定自訂委派的類別名稱,可註冊您的自訂後轉換委派,例如:

<worker name="com.ptc.arbortext.wvs/PostConvertDelegate">
com.ptc.arbortext.windchill.publisher.CustomPostConvertDelegate</worker>
PostConvertDelegate 介面
package com.ptc.arbortext.windchill.publisher;
import java.io.InputStream;
import java.util.Map;
import com.ptc.wvs.common.util.VSResult;
import com.ptc.wvs.server.publish.PublishParams;
import wt.fc.collections.WTCollection;
import wt.representation.Representable;
import wt.representation.Representation;
import wt.util.WTException;
/**
* The abstract class is designed to invoke after the response is returned
* from PE whether the publish job fails or succeeds.
*/
public abstract class PostConvertDelegate {
/**
* The method is invoked after getting response from PE.
* Its result is displayed in the WVS monitor.
* Any exception it throws is logged in method server log,
* but doesn't affect existing publish process;
*
* @param representable is the target object
* @param targetRep is the targeted representation in the targeted object.
* It is not null only for republishing or incremental publishing.
* @param parameters are publishing parameters for this publishing job.
* @param responseStreams is the map that includes all the file names
* and file output streams
* @param publishedList is the list of content included in the payload.
* If it is null, audit is disabled.
* @return is the messages sent to WVS job monitor */
public abstract VSResult execute(Representable representable,
Representation targetRep,
PublishParams parameters,
Map<String, InputStream> responseStreams,
WTCollection publishedList) throws WTException;
}
execute() API 方法
傳回值會顯示在 WVS 工作監視器中。
在從 Arbortext Publishing Engine 傳回發佈工作回應後,會立即呼叫此方法。
參數:
representable
已發佈的目標物件
targetRep
目標物件中的目標表示。此參數僅用於重新發佈與增量發佈。當其不為空值時,會包含目標物件的舊表示。其他所有情況下都為空值。
parameters
此發佈工作使用的發佈規則參數
responseStreams
包含回應的所有檔案名稱與檔案輸出串流的對應
publishedList
有效負載中包含之內容的集合。如果禁用稽核,則為空值。