其他 Windchill 功能 > 服务信息管理 > 自定义 Windchill Service Information Manager 和 Windchill 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 委派会基于要发布的数据及其安全标签来为所发布的表示设置安全标签。
在发布进程中,Windchill 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 transidref="...">value12</Value>
<Value 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() 针对根内容 (即内容载体下的动态文档和 PartList) 返回的值,而忽略其余部分内容。例如,如果子动态文档的自定义数据也包含时间戳,则发布不会在其父项的计算时间戳内包括这部分信息。
时间戳将通过 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 transidref="...">value12</Value>
<Value 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() 针对根内容 (即内容载体下的动态文档和 PartList) 返回的值,而忽略其余部分内容。例如,如果子动态文档的自定义数据也包含时间戳,则发布不会在其父项的计算时间戳内包括这部分信息。
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="YourCustomArtifactProvider实施"
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
有效载荷中包括的内容集合。如果禁用审计功能,则它将为空。