其他 Windchill 功能 > 服务信息管理 > 配置指南 > 配置属性 > 定义属性集
  
定义属性集
AttributeSet 配置文件
AttributeSet 的标记定义可为每个属性类定义默认 includeexclude 行为。AttributeSet 配置文件的路径如下:
<Windchill-path>\codebase\com\ptc\arbortext\windchill\siscore\attset\xml
在配置文件中定义一组属性时,请确保将单一类型的所有属性组合在一起。
有多个配置文件可供使用:
localizable_attset.xml
定义要以 XLIFF 文件发送以进行翻译的属性集。例如,文件的两个部分将标识 name 属性:
<Type name="com.ptc.sis.Base">
<Attribute action="include" name="name"/>
<Attribute action="include" name="organizationName"/>
<Attribute action="include" name="number"/>
</Type>
<Type name="com.ptc.arbortext.windchill.partlist.PartList">
<Attribute action="include" name="name"/>
</Type>
manifest_attset.xml
定义要作为内容清单中的元数据而发送的属性集。例如,文件的一个部分可标识“部件列表”的属性:
<Type name="com.ptc.arbortext.windchill.partlist.PartList">
<Attribute action="include" name="name" />
<Attribute action="include" name="organizationName" />
<Attribute action="include" name="number" />
<Attribute action="include" name="versionIdentifer.versionId" />
<Attribute action="include" name="iteration" />
<Attribute action="include" name="thePersistInfo.modifyStamp" />
<Attribute action="include" name="thePersistInfo.createStamp" />
<Attribute action="include" name="type" />
</Type>
publishable_attset.xml
定义要作为元数据发送到 Arbortext Publishing Engine 以供发布的属性集。例如,文件的一个部分可标识发布结构的属性:
<Type name="com.ptc.sis.PsRoot">
<Attribute action="include" name="lifeCycleState" type="enum"
token="wt.lifecycle.State">
</Attribute>
<Attribute action="include" name="thePersistInfo.modifyStamp" />
<Attribute action="include" name="orgid" />
<Attribute action="exclude" name="securityLabels.internalValue" />
<Attribute action="exclude" name="view" />
<Attribute action="include" name="name" />
<Attribute action="exclude" name="lineNumber" />
<Attribute action="exclude" name="quantityAmount" />
<Attribute action="exclude" name="quantityUnit" />
<Attribute action="exclude" name="traceCode" />
<Attribute action="exclude" name="state.state" />
<Attribute action="include" name="thePersistInfo.modifyStamp" />
<!-- don't remove. It is used in downstream -->
<Attribute action="include" name="thePersistInfo.updateStamp" />
<!-- don't remove. It is used in downstream -->
</Type>
Windchill 中的枚举类型属性作为对象的元数据进行发布。在以下示例中,枚举类型为关键 ”INWORK”,而值 In Work 为名称:
<Property token="lifeCycleState">
<Value key="INWORK">In Work</Value>
</Property>
在文件摘录中,通过对属性进行标识,可同时反映 lifeCycleState 的名称和枚举类型,其中关联的 token 属性实际上指定了枚举类型 (此情况下为 wt.lifecycle.State) 的完整 Java 类名称。
您可以指定“部件”分类类别属性。如果执行此操作,则系统将自动包括或排除子项分类属性。您可以排除主要分类属性本身,以排除所有与分类关联的子项属性。有关分类属性的详细信息,请参阅在 Windchill 中分类部件
* 
publishable_attset.xml 中,请勿更改或移除 thePersistInfo.modifyStampthePersistInfo.updateStamp 的任何属性 include 操作。这些操作将通过文件进行指定,并在 Servigistics InService 束中使用。
如果要执行自定义子类型,则需要将这些语句添加到规范中。
referencedObjects_attset.xml
定义参考 Windchill 中其他要包括在捆绑的 referencedObjects.xml 中的对象的属性集。例如,文件的一个部分可标识动态文档 (EPMDocuments 的子类型) 的属性:
<Type name="wt.epm.EPMDocument">
<Attribute action="include" name="missingDependents" />
<Attribute action="include" name="placeHolder" />
<Attribute action="include" name="revisionNumber" />
<Attribute action="include" name="derived" />
<Attribute action="include" name="name" />
<Attribute action="include" name="number" />
<Attribute action="include" name="CADName" />
<Attribute action="include" name="docType" />
<Attribute action="include" name="docSubType" />
<Attribute action="include" name="authoringApplication" />
<Attribute action="include" name="versionIdentifer.versionId" />
<Attribute action="include" name="thePersistInfo.modifyStamp" />
<Attribute action="include" name="thePersistInfo.createStamp" />
<Attribute action="include" name="iteration" />
<Attribute action="include" name="type" />/Type>
参考另一对象的属性必须定义明确,这样才能被视为参考属性。
publishinfo_attset.xml
定义一组要在有效载荷文件 publishinfo.xml 中包括或排除的属性,该有效载荷文件与待发布的服务结构相关。例如,默认情况下,该文件定义发布结构和信息结构 (由其类型标识) 将包括待发布结构的名称、编号和组织名称:
Type name="com.ptc.sis.PsRoot">
<Attribute action="include" name="name" />
<Attribute action="include" name="number" />
<Attribute action="include" name="orgName" />
</Type>
<Type name="com.ptc.sis.IsRoot">
<Attribute action="include" name="name" />
<Attribute action="include" name="number" />
<Attribute action="include" name="orgName" />
</Type>
通过遵循 Setting Up a Directory Structure for Managing Customized Files and Text TailoringPTC 提供的自定义文件最佳做法中的建议,可以维护这些文件的自定义版本。
AttributeSet 更新命令
可能无法立即加载对属性集文件所做的更改,例如,正在等待更新的发布作业运行时。对属性设置配置文件进行更改后,在 Windchill shell 中重新启动服务器以使更改生效。
如果无法立即重新启动 Windchill,可转为手动清除缓存:
1. 打开 Windchill shell。
2. 输入下面的命令:
windchill com.ptc.arbortext.windchill.publisher.cmdline.
CleanCacheAttibuteSet
该命令可清除缓存并加快更改进程。
Windchill 属性类别
LWCIBAAttDefinition - 基于实例的属性或 IBA
LWCHardAttDefinition - 模型化或不可变属性
LWCLogicalAttDefinition - 逻辑属性
LWCNonPersistedAttDefinition - 非持续属性
LWCFlexAttDefinition - 可变属性 (先前称为弹性属性)
LWCAttributeSetAttDefinition - 属性集
适用于结构的类型属性
下表显示了可自定义的类型属性的列表:
名称和类型
逻辑形式 (不完整类型名称)
说明
部件,结构节点
wt.part.WTPart
部件 (模型化)
信息基础,结构节点
com.ptc.sis.Base
衍生自所有发布结构和信息结构对象的 WTPart 的抽象基本类型。
分区基础,结构节点
com.ptc.sis.BaseDiv
在发布结构和信息结构中使用的分区类型的抽象基本类。
发布结构,结构节点
com.ptc.sis.PsRoot
发布结构根对象。
发布部分,结构节点
com.ptc.sis.PsSection
发布结构中的分区或部分。
信息结构,结构节点
com.ptc.sis.IsRoot
信息结构根对象。
信息组,结构节点
com.ptc.sis.IsGroup
信息结构中的分区或部分。
内容基础,结构节点
com.ptc.arbortext.sis.Content
内容参考和特殊节点的抽象基础。
内容载体,参考节点
com.ptc.sis.ContentRef
内容文件的通用参考。
插图载体,参考节点
com.ptc.sis.IllustrationRef
图形“动态文档”的参考。
部件列表载体,参考节点
com.ptc.sis.PartsListRef
“部件列表”对象的参考。
文本内容载体,参考节点
com.ptc.sis.TextualContentRef
“动态文档”(XML、PDF、文本等) 的参考。
特殊基础,结构节点
com.ptc.sis.PsSpecial
表示生成文本标记的抽象基础。
目录,结构节点
com.ptc.sis.PsToc
在发布结构中指示目录出现位置的标记。
索引,结构节点
com.ptc.sis.PsIndex
在发布结构中指示索引出现位置的标记。
信息使用关系链接,参考对象
com.ptc.sis.BaseUsageLink
用于创建 Windchill Service Information Manager 结构 (模型化) 的两个“基础”节点之间的链接。
部件使用关系链接,参考对象
wt.part.WTPartUsageLink
用于创建结构 (模型化) 的两个 WTPart 节点之间的链接。
部件列表,参考对象
com.ptc.arbortext.windchill.partlist.PartList
“部件列表项”(模型化) 的“部件列表”容器。
部件列表项,参考对象
com.ptc.arbortext.windchill.partlist.PartListItem
链接到实际部件 (模型化) 的“部件列表项”。
EPMDocument,参考对象
wt.epm.EPMDocument
任意 EPMDocumentDynamicDocument (模型化) 的基本类型。
DynamicDocument,参考对象
com.ptc.ptcnet.DynamicDocument
保留文本或图形内容的 Arbortext 动态文档。
Xliff Link,参考对象
com.ptc.sis.XliffLink
翻译文档的链接。
AttributeSet 元素
定义所有对象属性或特定类属性的默认操作。子 Type 元素允许覆盖 Persistable 类型的默认行为。
<!ELEMENT AttributeSet ( Type* )>
<!ATTLIST AttributeSet
default (include | exclude) #IMPLIED
hard (include | exclude) #IMPLIED
soft (include | exclude) #IMPLIED
iba (include | exclude) #IMPLIED
logical (include | exclude) #IMPLIED
classification (include | exclude) #IMPLIED
nonPersisted (include | exclude) #IMPLIED
set (include | exclude) #IMPLIED
>
AttributeSet 元素的属性可定义为下列项目:
default
未由更特定测试包括或排除的所有属性的默认操作。
hard
未由更特定测试包括或排除的所有 hard (LWCHardAttDefinition) 属性的默认操作。
soft
未由更特定测试包括或排除的所有 soft (LWCFlexAttDefinition) 属性的默认操作。
iba
未由更特定测试包括或排除的所有 iba (LWCIBAAttDefinition) 属性的默认操作。
logical
未由更特定测试包括或排除的所有 logical (LWCLogicalAttDefinition) 属性的默认操作。
classification
未由更多特定测试包括或排除的所有 classification 属性的默认操作。如果不存在,请使用 iba 属性的值。有关这些属性的详细信息,请参阅“分类属性”
nonPersisted
未由更特定测试包括或排除的所有 nonPersisted (LWCNonPersistedAttDefinition) 属性的默认操作。
set
未由更特定测试包括或排除的所有 set (LWCAttributeSetAttDefinition) 属性的默认操作。
例如:
<AttributeSet xmlns="http://www.ptc.com" default="exclude"
iba="include" soft="include" logical="include">
Type 元素
对于实行 Persistable 接口 (允许从数据库读取和写入对象) 的任何对象,Type 元素可让您指定 includeexcludeWindchill 属性。类型是模型化 (不可变) 类型,或是以模型化类型或其他子类型为基础的子类型。子类型使用“类型和属性管理器”或加载程序文件创建和管理。
<!ELEMENT Type ( Attribute* )>
<!ATTLIST Type
name CDATA #REQUIRED
token NMTOKENS #IMPLIED
default (include | exclude) #IMPLIED
>
Type 元素的属性可定义为下列项目。
name
可变或模型化类型的逻辑形式。分类属性使用以“@”开头的 name 值标识。
token
可用于将语意映射为此类型的可选名称或名称集合。
default
包括或排除缺少更特定设置的所有此类型属性的默认操作。
所有类型都可按照名为 Logical Form (也称为 LogicalID) 的类型名称字符串标识。逻辑形式必须在站点级别具有唯一性,因为它会唯一标识类型。例如 (忽略换行符):
com.ptc.ptcnet.DynamicDocument =>
WCTYPE|wt.epm.EPMDocument|com.ptc.ptcnet.DynamicDocument
wt.part.WTPart => WCTYPE|wt.part.WTPart
第一个示例为 EPMDocumentDynamicDocument 子类型的名称,而第二个示例为模型化类型 wt.part.WTPart 的名称。逻辑形式会映射为类型的外部形式。如果为模型化类型,则对象的 java 类名称将以 WCTYPE| 为前缀。如果为子类型,则名称为基本类型 (可变或不可变) 的名称,其后加上竖线 | 以及用户定义的类型名称。逻辑形式通常与外部形式的最后段相同。但是,只要逻辑形式具有唯一性,您就可以定义自己的逻辑形式。
例如:
<Type name="com.ptc.sis.PsRoot">
Attribute 元素
Attribute 元素主要指定 include 还是 exclude 属性集中的特定 Windchill 属性。也可用于为属性或其值定义语义。
<!ELEMENT Attribute ( Choice* )>
<!ATTLIST Attribute
name CDATA #REQUIRED
token NMTOKENS #IMPLIED
type CDATA #IMPLIED
action (include | exclude) #REQUIRED
>
Attribute 元素的属性可定义为下列项目。
name 
逻辑形式中的属性名称。
token 
可用于将语意映射为此属性的可选名称或名称集合。
type
指定要包括或排除的属性类型的字符串。type 支持的唯一值是 reference
如果将属性及其类型的 name 指定为 reference,则会将属性值定义为参考对象。
action 
要针对此属性执行的操作。
此操作 (如果指定) 是该属性的最高优先级设置。可能会忽略 action 并允许下一个较高优先级设置控制属性集中此属性的包含内容。
属性为模型化 (不可变) 类型或是可变属性。可变属性使用“类型和属性管理器”或加载程序文件创建和管理。所有属性都可按照名为 Logical Form 的属性名称字符串进行标识。逻辑形式必须对于对象类型具有唯一性,因为它会唯一标识该类型的属性。例如,以下内容会将属性的逻辑形式映射为其外部形式:
name => MBA|masterReference^WCTYPE|wt.part.WTPartMaster~MBA|name
name => MBA|masterReference^WCTYPE|wt.doc.WTDocumentMaster~MBA|name
filename => MBA|masterReference^WCTYPE|wt.epm.EPMDocumentMaster~MBA|CADName
fileName => NPA|filename
指定类型上的字符串 name 仅会唯一标识一个属性。第一个示例标识 wt.part.WTPart 类型的“基于模型的属性”(MBA)。第二个示例标识 wt.doc.WTDocument 的属性。第三个示例是 wt.epm.EPMDocument 类型的 filename 属性。最后一个示例声明先前属性的别名。对象类型不包括在属性的外部形式中。
例如:
<Attribute action="include" name="lifeCycleState" token="STATE">
通过将属性及其类型的 name 指定为 reference,属性值会被定义为参考对象,而且其 URI 将在有效负载中进行转换,以便您能够在 Servigistics InService 中找到对象。
Attribute action="include" name="PartListVersionRef" type=”reference”
Choice 元素
Choice 元素可定义属性的可能值。它不会影响要创建的属性集中包含或排除的属性。但会定义用于下游处理的值的范围。此外,可将一个或多个标记与值相关联,以在下游处理中为该值提供特殊语义。Choice 元素的内容为表示父 Attribute 元素的可能值的字符串。
<!ELEMENT Choice (#PCDATA) >
<!ATTLIST Choice
token NMTOKENS #IMPLIED
>
Choice 元素的 token 属性会定义为可用于将语意映射为此值的可选名称或名称集合。
例如,要扩展 Attribute 示例:
<Attribute action="include" name="lifeCycleState" token="STATE">
<Choice name="Accepted" />
<Choice name="Approved" />
<Choice name="Closed" />
<Choice name="In Work" token="INWORK" />
<Choice name="Obsolete" token="OBSOLETE" />
<Choice name="Open" token="OPEN" />
</Attribute>
计算属性集包含
AttributeSet 配置文件的设计,是为了在不同级别使用明确操作定义属性集。形式为 Element.attribute_of_element。所支持级别如下所示,以降序或优先级排序。
Attribute.action:特定对象类型 (Type.name) 的特定属性 (Attribute.name)
Type.default:对象类型 (Type.name) 的所有属性值
AttributeSet.hardAttributeSet.softAttributeSet.iba 等:某类的所有属性
AttributeSet.default:所有属性值
一般而言,设置越特定,指定给该操作设置的优先级越高。在特定级别忽略对属性的操作,意味着必须检查优先级的下一个最高级别,以查看是否针对该属性提供明确操作。当找到明确操作时,停止搜索。如果找不到明确操作,则会使用默认行为。
系统默认行为取决于上下文。例如,本地化的默认属性集与序列化的默认集不同。发布结构所包含的不可变属性有:
name
state.state
versionIdentifier.versionId
例如,将发布结构或信息结构序列化至有效载荷时,默认行为是包括所有 softibalogical 属性以及不可变属性。
序列化参考其他对象的属性
要在有效载荷中指定对象参考的元数据,必须指定 Attribute 元素的 nametype 属性。例如:
<Type default="include"
name="com.ptc.arbortext.windchill.siscore.serviceeff.ServiceEffectivity">
<Attribute action="include" name="effContextRef" type="reference" />
</Type>
参考对象属性放入有效载荷的 referencedObjects.xml 中。参考形式会从其 Windchill 标识符更改为 URI,该 URI 可用于在将对象发布到 Servigistics InService 之后查找对象。
参考了对象的属性在有效载荷中以 Property 元素 (使用 token 属性标识) 表示。Value 元素具有 ref 属性,该属性用于将对象参考转换为 URI 以便将有效载荷发布至捆绑。多个属性在有效负载中会具有多个 Value 条目。
AttributeSet API
AttributeSet 配置文件标识 Windchill 对象的属性集。该集将随选定对象的不同而异。并非相同类型的所有对象都会针对该集的所有属性定义值,但该集是相同的。配置是上下文特定的。例如,您可能需要使用不同的 XML 文件来配置 localizablepublishable 属性。
AttributeSet 类是一或多个 AttributeSet 配置文件的 API。工厂方法 getAttributeSet 会按照 AttributeSet 配置文件列表中的定义,加载与上下文名称相符且文件扩展名为 .xml 的文件。
public class AttributeSet {

// Load one or more configuration files for a named context
and return an AttributeSet object
public static AttributeSet getAttributeSet(String context);

// Get the context for this AttributeSet
public String getContext();

// Test if a type/attribute is a member of this AttributeSet
public boolean isMember(String typeLogicalForm, String logicalForm);
public boolean isMember(TypeIdentifier type, AttributeTypeIdentifier att);

// Get the set of attributes and their types for an persistable object type.
public Map<String, AttributeTypeIdentifier> getAttributes
(String typeLogicalForm);
public Map<String, AttributeTypeIdentifier> getAttributes
(TypeIdentifier type);

// Get attribute values for a Persistable. Mapped object may be an array.
public Map<String, Object> getAttributeValues(Persistable wtobject);

}