其他 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>
您可遵循設定目錄結構以管理自訂檔案與自訂文字PTC 所提供的自訂檔案最佳作法中的下列建議,來維持這些檔案的自訂版本。
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 元素
Type 元素可讓您針對實行 Persistable 介面 (允許從資料庫讀取與寫入物件) 的任何物件,指定要 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 識別元變更為可用來在將物件發行至 Servigistics InService 之後尋找物件的 URI。
參考物件的屬性在有效負載中以 Property 元素表示,可使用 token 屬性來識別該元素。Value 元素有一個 ref 屬性,可將物件參考轉換為要發行為束之有效負載的 URI。多個屬性在有效負載中有多個 Value 項目。
AttributeSet API
AttributeSet 組態檔案可識別 Windchill 物件的屬性集。集合會視所選物件而不同。並非相同類型的所有物件都為集合的所有屬性定義值,但集合會是相同的。組態是前後關聯特定的。例如,您可能需要使用不同的 XML 檔案來配置 localizablepublishable 屬性。
AttributeSet 類別是一或多個 AttributeSet 組態檔案的 API。製造廠方法 getAttributeSet 會載入與前後關聯名稱相符且檔案副檔名為 .xml 的檔案,如 AttributeSet 組態檔案清單中所定義。
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);

}